Sqlite Optimization: Read Only Script

I use SQLite for a number of desktop and PDA applications. Most of the operations are read-only, since SQLite functions as a data warehouse for reference material in my applications.

Basically, I'm looking for suggestions for improving performance in a scenario when you know that data access is read-only.

Maybe using various pragma settings? etc...

SQLite's performance is excellent, but on the PDA, when you have several databases, I see little success. I do not think that this is a problem with SQLite, just the reality of the speed of the PDA. However, having said that, perhaps there are ways to improve it.


Good advice and well put. I hope for something more specific, telling the engine about what I'm doing. For example, when informing the engine, there will be no multiple entries in the database or the cache processing will be changed in some way.

However, I am glad that you drew attention to the "design" of the database aspect as the main problem.

+4
source share
3 answers

You can call sqlite3_open_v2 () with the SQLITE_OPEN_READONLY flag. I have no idea if sqlite3 really uses this to optimize its behavior or as a way to set the appropriate permissions for the open call it makes for the OS.

-1
source

Standard database performance recommendations still apply:

  • Make sure your queries use indexes, not a full table scan.
  • Be as selective as you can in your queries so as not to pull unnecessary lines from db
  • Select only the columns you want
+2
source

sqlite3_open_v2 () with the SQLITE_OPEN_READONLY flag changes the way SQLite handles opportunistic locks without real performance benefits. You can use pragma cache_size if you do a lot of reads or depending on the size of db, make a copy in db memory with the option: memory open.

+2
source

All Articles