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....

I know the general SQL theory on transactions, sorry if I didn't get
that across correctly earlier.  So in other SQL engines, accessing a
table can be done concurrently by several processes, and the granularity
for updates and inserts is generally record-only, unless one uses a
transaction.  I'm sure that slightly over-simplified, but it should be
about accurate....

I know from an earlier email by Richard Hipp... 
>>> 1.  Everytime you call sqlite_open(), SQLite must read and parse
        the entire database schema.  This is surprisingly quick, but
        you still might want to keep your schema small if you are
        calling sqlite_open() a lot.

    2.  SQLite uses course-grained locking.  While most client-server
        database engines lock a table or row of data at a time, SQLite
        locks the entire database.  So if concurrency is an issue for
        you, it is better to break the data up into separate files
        so that you can have more (and finer grained) locks.
<<<
...that sqlite_open() does have a bite to take from the processing
time.  I think I see now where I got confused....  I must have taken
statements 1 and 2 and rolled them together in my mind....  

> sqlite_open does not lock the database. You can keep the database open
as 
> long as you like, and whenever you're not actually executing SQL the file 
> will be unlocked.

But I would like to ask a follow up question regarding your comment
about keeping SQLite open....  On a web server, can this be done and
shared by all users?

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?

Thanks so much for taking the time to answer!
-- 

Vania Smrkovski
http://www.pandorasdream.com

On Wed, 2004-01-14 at 21:36, [EMAIL PROTECTED] wrote:
> Vania,
> 
> 
> 
> 
> 
> Vania Smrkovski <[EMAIL PROTECTED]>
> 15/01/2004 12:14 PM
> Please respond to vania
> 
>  
>         To:     "SQLite-Users (E-mail)" <[EMAIL PROTECTED]>
>         cc: 
>         Subject:        [sqlite] Clarification on file locking in web-served apps
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to