--- On Tue, 11/24/09, Nicolas Rivera <nicolas.riv...@ac4s.com> wrote:

> From: Nicolas Rivera <nicolas.riv...@ac4s.com>
> Subject: [sqlite] multiple threads with shared cache mode
> To: sqlite-users@sqlite.org
> Date: Tuesday, November 24, 2009, 12:22 PM
> Hi,
> 
> It is my understanding, per 
> http://www.hwaci.com/sw/sqlite/sharedcache.html section
> 2.1, that only 
> one write transaction may exist while in shared cache
> mode.  Is that 
> correct?

Correct.

> 
> If so, then I am trying to figure out what is the advantage
> of having 
> table level locks in shared cache mode.  If only one
> write transaction 
> can be pending at a time, irrespective of the table, then
> what advantage 
> is there to having table level locks?
> 
> To put it another way, is there anything gained in terms of
> concurrency 
> by using shared cached mode versus not using it?  BTW,
> I am not 
> interested in reading uncommitted data.

Yes only one write transaction may occur at a time. But it is possible that a 
write be happening on two separate tables by two separate threads. Then once 
one of the threads needs to spill its "writes" to disk the locks are acquired 
and a journal is created. At this point if the other thread attempts to write 
it will encounter the SQLITE_BUSY error. 

So given this one must also take care not to introduce self dead locks.

At least thats my understanding of it! 
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to