Vania,
Vania Smrkovski <[EMAIL PROTECTED]>
15/01/2004 01:20 PM
Please respond to vania
To: [EMAIL PROTECTED]
cc: "SQLite-Users (E-mail)" <[EMAIL PROTECTED]>
Subject: Re: [sqlite] Clarification on file locking in web-served apps
> Okay, I think I figured out one piece that I was forgetting.... Check
> me on this:
> SQLite locks the DB during the Open only so long as it takes to read
> through the DB file. I seem to recall running across that fact
> somewhere in the FAQs or on this user list....
Yes, that's right. After sqlite has read the schema it unlocks the
database again.
> Put another way, can I have my web server spawn off a sort of pseudo
> server for my couldn't-help-but-make-it-huge database so that it only
> gets "opened" once during the day or week and shares the instance with
> every web user that hits any of several pages?
The base sqlite library doesn't impliment this "spawned server" concept,
although I have heard mention several tools that do this in past list
postings. Bearing in mind that if you execute all your queries and updates
in a single thread they won't be able to execute concurrently things can
still run quite well in this mode. Beware of premature optimisation,
though. Presuming you do a lot more queries than updates through your
web-site, I suspect things would actually run faster if you allow each
thread to keep a separate sqlite handle.
To be honest, sqlite will probably be fast enough for your purposes
without having to do any special tweaking beforehand. I suggest you do
things the way they are simplest to code, and then find out if you're
running into performance problems. I suspect the simplest way to code it
up front would be to have your PHP open and close the database whenever it
gets a http request :)
Benjamin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]