Sql speed issue



  • 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



  • Hi,

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



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.