On Feb 22, 2009, at 9:40 PM, efimd wrote:

>
> I deal with a relevantly small database that fits into cache. The  
> database is
> accesseed by single application and single thread for both read and  
> write. I
> also use PRAGMA locking_mode=exclusive.
> As far as I understand between transactions the cache is invalidated  
> and all
> pages are removed. I would like to avoid this. There was a question  
> on this
> topic several years ago.
> http://www.nabble.com/Cleared-pager-cache-td1037035.html#a1037035

Things have changed since then. When using exclusive mode the cache
is never invalidated (not quite 100% true - under some circumstances it
may be invalidated if an IO, or OOM error occurs).

In non-exclusive mode (PRAGMA locking_mode=normal), then each time a
transaction is started SQLite inspects the 'change-counter' field in
the header of the database file. The 'change-counter' field is  
incremented
each time a process writes to the database file. If this field has been
changed by another process since the database was last locked, then  
SQLite
concludes that the database file has changed on disk and the cache  
must be
invalidated. Otherwise, the cache contents may be retained and used by  
the
next transaction.

So in your situation you probably have nothing to worry about.

Dan.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to