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

No, it's one write transaction per table.

> To put it another way, is there anything gained in terms of concurrency
> by using shared cached mode versus not using it?

If you're looking on concurrency only then the benefit of shared cache
is possibility of several simultaneous write transactions per each
table. Though it's a bit tricky because shared cache allows only one
active sqlite3_step() call. Thus if all of your transactions consist
of only one insert/update statement and so will be committed at the
end of each sqlite3_step() then you won't see this benefit at all.
But, shared cache has other speed and memory consumption benefits.
Without shared cache each connection to database file will have its
own cache. So with read-only transactions your memory consumption will
increase proportionally to number of connections you open. Also after
each write transaction on one connection cache on another connection
will be invalidated and re-read from disk again (not all of course but
on demand only necessary part). With shared cache you can effectively
cache more with the same total memory consumption and your cache will
be re-read from disk only when other process changes database. So if
your application work only from one process and does frequent write
transactions from several connections shared cache can significantly
speed up your app eliminating unnecessary I/O.


Pavel

On Tue, Nov 24, 2009 at 1:22 PM, Nicolas Rivera <nicolas.riv...@ac4s.com> wrote:
> 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?
>
> 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.
>
> Thanks in advance,
>
> Nicolas Rivera
>
> _______________________________________________
> 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

Reply via email to