On 28 May 2014, at 1:44pm, Stephen Chrzanowski <pontia...@gmail.com> wrote:

> What I found was that even changing the files read-only attribute
> (Old-school DOS 3.3 days file attribute kinda thing) the initial query lag
> hit.  The same thing happened when I unset the R/O attrib and set the NTFS
> permissions to read access only.  The database had maybe a single empty
> table and a single simple query execute.  The lag was about a second and a
> half to two seconds, I don't remember exactly.  Not a SIGNIFICANT hit, but
> a hit needless to say.  The test was done with my own application
> specifically written to test the theories, as well as using the SQLite CLI
> downloaded from the SQLite site.

You just gave a good description of how Windows's file caching system works.  
If you open a read-only file under Windows it reads some of it into cache as an 
attempt to speed up future access. If the file is opened read/write then it 
doesn't do this because you might be going to overwrite the old contents so you 
won't care what's there.

This strategy on Windows' part is a good strategy which is quite effective for 
the average user who does normal things with their computer.  It can speed up 
reading an application file and its preference file quite a bit.  But it's not 
a good strategy for people who will only want to read a small amount of data 
from a database then close it again.

It's worth noting that this strategy does not add significant time to the 
entire operation.  The entire time of accessing the database file does not 
change much.  It simply shifts time taken to the 'open' command rather than 
spread it out through subsequent read commands.

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

Reply via email to