Results 1 to 11 of 11

Thread: how to optimize QSqlQuery?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2013
    Location
    India
    Posts
    153
    Thanks
    27
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Exclamation how to optimize QSqlQuery?

    Hello Everyone,

    I am working with QSqlQuery to fetch data from database tables.
    Somehow i find it is quite slow for me.

    What i am doing is i am fetching data from table around 15539502 rows.
    which itself take 40-45 seconds., which is fine.
    But when i am traversion this much amount of data it takes around 7-10 minutes.
    which is quite long time.

    Qt Code:
    1. QString query("SELECT * FROM DATA_TABLE_1 (TICK_DATE BETWEEN :date_to AND :date_from) ORDER BY TICK_DATE ASC, TICK_TIME ASC");
    2. QSqlQuery sql_query(m_ServerDB);
    3. sql_query.prepare(query);
    4. sql_query.setForwardOnly(true);
    5. bool ok = sql_query.exec();
    6.  
    7. if(ok &&
    8. sql_query.size() > 0) {
    9. // Do calculations
    10. }
    To copy to clipboard, switch view to plain text mode 

    is there any way to doing the same with multiple threads to save time?
    or anyidea to solve my problem.?
    Last edited by karankumar1609; 9th April 2014 at 11:18.
    Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.

Similar Threads

  1. Replies: 2
    Last Post: 9th April 2013, 09:15
  2. Replies: 1
    Last Post: 18th July 2011, 12:12
  3. Optimize QGraphicsItem update
    By paolom in forum Qt Programming
    Replies: 10
    Last Post: 21st March 2011, 15:29
  4. How to optimize qt libs for embedded x86?
    By yangyunzhao in forum Installation and Deployment
    Replies: 2
    Last Post: 30th June 2009, 09:47
  5. Optimize Qt Library
    By Svaths in forum Qt for Embedded and Mobile
    Replies: 11
    Last Post: 15th July 2007, 22:25

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.