>From personal experience on Windows and Linux, if your sqlite database is smaller than the amount of available RAM, then sequentially read()ing the database file in 8K or larger chunks (and ignoring the read results) outside of the SQLite API is several times faster than first running a dummy query. It's not even important that the initial database read() takes place in the same process, since it's an OS thing.
Most modern OSes (and hard drives?) implement very efficient sequential read-ahead. Jumping around to various spots in the file tend to increase disk-head movement and defeats this look-ahead mechanism. OS file-caching is now so finely tuned that SQLite actually runs slightly faster on a disk-based file database than a :memory: database. Try it for yourself on a cold file-cache. It's completely counter-intuitive. --- John Stanton <[EMAIL PROTECTED]> wrote: > If you want to get as much as possible of the Sqlite database into > physical memory on the computer, read all of it. If you just want to > preload the cache and VM so that the first user gets faster response > execute a dummy query like one you would expect the first user to run. > > Since the VM logic will work on a least recently used algorithm the > preload using a read of the file will not be very successful if you have > a huge database and not much physical memory. You will only have the > tail of the DB in physical memory. > > My preference would be to execute a dummy query as part of the DB open. > That would leave the cache primed with a working set of pages likely > to satisfy the first user query. After that the cache takes care of > itself. This method not only primes the Sqlite cache but also makes the > pages resident in physical memory. Reading the file alone does not > prime the Sqlite cache. ____________________________________________________________________________________ Need a quick answer? Get one in minutes from people who know. Ask your question on www.Answers.yahoo.com ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------