Re: [sqlite] SQLITE Header access
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 sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] SQLITE Header access
On Thu, 3 May 2012 10:42:38 -0700 (PDT), msantha wrote: > > I am using sqlite in my application only for read access. 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. > Precisely speaking, 16 bytes from the 24th byte of the header is read > everytime. My question is , if the database is used only for read purpose, > why the header is read everytime as the database connection is not > closed?.. Your process may promise that it will only read the database, but there might be some other process writing to it. Not being a server, sqlite has no other way to find that out than by reading the header over and over again. It has to check whether the schema was changed, or whatever other info is in those bytes. > can we make it read it only once? I don't think so, unless you patch the source code. I wouldn't worry about it too much, the operating system will notice that particular page is read often and keep it in it's file system cache, so access is fast. > Thanks!! Hope this helps. -- Regards, Kees Nuyt ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] SQLITE Header access
> My question is , if the database is used only for read purpose, > why the header is read everytime as the database connection is not > closed?..can we make it read it only once? Even though your connection is used only for reading, some other connection (maybe in a different process) can be used for writing. Thus SQLite have to check before each transaction if anything was changed in the database. Pavel On Thu, May 3, 2012 at 1:42 PM, msantha wrote: > > I am using sqlite in my application only for read access. 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. > Precisely speaking, 16 bytes from the 24th byte of the header is read > everytime. My question is , if the database is used only for read purpose, > why the header is read everytime as the database connection is not > closed?..can we make it read it only once? > > Thanks!! > > -- > View this message in context: > http://old.nabble.com/SQLITE-Header-access-tp33763427p33763427.html > Sent from the SQLite mailing list archive at Nabble.com. > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] SQLITE Header access
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. 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. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] SQLITE Header access
I am using sqlite in my application only for read access. 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. Precisely speaking, 16 bytes from the 24th byte of the header is read everytime. My question is , if the database is used only for read purpose, why the header is read everytime as the database connection is not closed?..can we make it read it only once? Thanks!! -- View this message in context: http://old.nabble.com/SQLITE-Header-access-tp33763427p33763427.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users