On 2018/01/17 4:26 PM, Bart Smissaert wrote:
3. Start a transaction and hold the DB read locks for the duration of
your application (again, if it won't need writing)
I had a look at this but couldn't see a speed increase.
This was for a single statement, so that is repeated (in a
loop) sqlite3_step, sqlite3_column_xxx etc.
In what situation should this increase read speed?
Apologies, should have been more clear - this will increase the speed
between queries FOR consecutive queries, not so much inside any single
query.
To see why is easy, the loop amounts to either:
// Slower loop:
for each q in queries do {
Acquire read lock;
Prepare;
Loop query results;
Release readlock;
}
- OR -
// Faster loop:
Start Transaction;
Acquire read lock;
for each q in queries do {
Prepare;
Loop query results;
}
Release readlock;
End Transaction;
(This is very simplified and not technically 100% accurate how SQLite
does it, but you get the idea).
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users