Paul Tomblin <[EMAIL PROTECTED]> wrote:
> I'm curious about the duration of locks, specifically when other processes
> can get in to do their bit, since SQLite is so different from other
> RDBMSes that I've used (Oracle, Sybase, PostgreSQL, MySQL).
> 
> If I have a process that opens a database with autocommit turned off (I'm
> talking the perl DBI interface, so I might not gives things the proper
> SQLite terminology) which does a lot of querying (that might take some
> minutes), but every now and then does some updates and commits within a
> few seconds of the updates.
> 
> Assuming that another one of these processes starts up after the first one
> is running:
> - Can the second one query while the first one is querying?

Yes

> - Can the second one query while the first one is updating?

No.  Actually, the first one doesn't really start updating until
you do the COMMIT or until the page cache fills up and has to spill
to disk.  Until then, all your updates are held in memory.  And
until the changes start going to disk, the second query can keep
reading merrily away.

> - Can the second one update while the first one is updating?

No.

> - does committing in the first one release the lock and allow the seocnd
>   one to continue?
> 

Yes.

You forgot to ask:  Can the first one commit while the second one
is still in the middle of a query?  Answer: No.  A writer has to
wait until all readers are finished before it can start writing.

--
D. Richard Hipp <[EMAIL PROTECTED]>

Reply via email to