Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Sql speed issue
Forum Update on Monday, May 27th 2025

Sql speed issue

Scheduled Pinned Locked Moved Installation and Deployment
3 Posts 2 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    geanni
    wrote on 17 Jul 2013, 08:45 last edited by
    #1

    Hello,
    I'm working on a project with QMYSQL connection to a mysql database. Everything works fine on local but when I connect to a remote server the speed is considerable slow -7 times slower. I tried to execute a simple query on both local and remote server and I get the same result - on remote it is too much slow. I tried to execute the same query to the same server/database using another mysql client (heidiSQL) and it woks in heidi very fast. I tried also with other client and I get good results, so the problem is not the internet speed connection. Do you have any idea from where this problem could be?

    Thanks,
    Geanni

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on 19 Jul 2013, 11:03 last edited by
      #2

      Hi,

      Have you tried the native mysql client?
      Qt uses native Database drivers to connect.

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • G Offline
        G Offline
        geanni
        wrote on 22 Jul 2013, 20:51 last edited by
        #3

        Hi,

        What I have done was to build the mysql.pro project, copy the resulting dlls into the plugins directory then using a code like:
        QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL", "DataSource1");
        db.setHostName("hostname");
        db.setDatabaseName("db");
        db.setUserName("usr");
        db.setPassword("pass");

        if (db.open())
        {
               QSqlQuery q(db);
              qDebug()<<"before "<<QTime::currentTime().toString("mm:ss:zzz");
              q.prepare("select * from table...");
              q.exec&#40;&#41;;
             if(q.lastError().isValid())
             {
                   qCritical()<<q.lastError().text();
             }
            qDebug()<<"after "<<QTime::currentTime().toString("mm:ss:zzz");
        

        }

        Isn't it the best way to query a mysql?

        Thanks,
        Geanni

        1 Reply Last reply
        0

        1/3

        17 Jul 2013, 08:45

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved