Results 1 to 1 of 1

Thread: Slow SQLite performance

  1. #1
    Join Date
    Sep 2011
    Posts
    20
    Qt products
    Qt5
    Platforms
    Windows

    Default Slow SQLite performance

    1) The database file is 455MB in size with 6 large tables with only a few columns in each, but millions of rows
    2) I am using prepared statements
    3) I am using transactions
    4) Database was default created with:
    Qt Code:
    1. QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    2. db.setDatabaseName("filmquery.db3");
    3. db.open();
    To copy to clipboard, switch view to plain text mode 
    5) The tables have proper indexes and all the queries run in 0-2ms when run from e.g. SQLiteSpy

    My app needs to do a lot of DB queries and when I first run the database querying function it takes a very long time to execute the queries and you can hear the hard drive reading a lot, but when I run it again then it's very fast, like it caches the whole database. Could I e.g. load the database in memory when I load the app? What optimization tricks are there to make it faster?

    Thanks.

    edit: Vacuuming seemed to work.
    Last edited by themagician; 26th April 2012 at 17:24.

Similar Threads

  1. QT App performance is too slow on OSX
    By joshhhab in forum Newbie
    Replies: 1
    Last Post: 28th May 2011, 08:30
  2. Slow performance of QGraphicsView - why?
    By zeldaknight in forum Newbie
    Replies: 2
    Last Post: 25th August 2010, 03:34
  3. Replies: 1
    Last Post: 8th August 2010, 20:04
  4. [Qt][SQLite] Two problems with SQLite.
    By Xandareva in forum Newbie
    Replies: 6
    Last Post: 6th April 2010, 23:06

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.