"Also please note that SQLite does a 'lazy open'.  When you create your 
connection to the database file, SQLite doesn’t actually open the file.  
Instead the file handling is done the first time SQLite needs the data from the 
file.  So the first SELECT after a new connection is made takes longer than the 
others.

Simon."


I think this is the big thing. "Opening" a database doesn't actually do much. 
That 14ms is probably from parsing the database schema. That won't happen until 
your first select.

When doing a "begin transaction" the default is a deferred begin, which won't 
lock the database or read the schema until you run a select/update/etc. Once it 
does lock the file with that first select after the begin, then the connection 
doesn't have to parse anything again since no other process could have changed 
it.

With individual selects though, the connection has to check every time if the 
schema has been changed on it while it was sitting idle. Remember that a "read 
only connection" only means that "I can't change it." It doesn't mean "no one 
else can change it either."
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to