On 05/04/2012 12:52 AM, Igor Tandetnik wrote:
On 5/3/2012 1:42 PM, msantha wrote:
I am using sqlite in my application only for read access.

But someone else might open and modify the same database. You may know
this doesn't happen, but SQLite doesn't.

The DB gets hit
often by my application and I could see that the header(100 bytes) of the
database is read every time when i access the database.

Most likely, checking the schema cookie, to confirm that the database
schema remains unchanged and prepared statements are still valid.

It's checking if the "change-counter", a field updated each time the
database is written, has changed. If the change-counter has changed
since the last time the db was written, all cached pages are discarded
from the cache and SQLite moves on to checking the schema cookie.

can we make it read it only once?

Try starting a transaction at the beginning, and keeping it open the
whole time the application runs.

You could also use "PRAGMA locking_mode=EXCLUSIVE". That way, SQLite
could be as confident as you are that no other process is modifying
the db. And it won't feel the need to inspect the db header each
time you read.

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to