Hi Igor, I have an in memory database and a single multiplexed thread for all readers and writes. I like to be able to read tables without locking out other readers and writers. Is this possible? I don't mind writers using locks but some of my readers are slow and I don't want them to hold locks for long periods.
Thanks, -Alex On Wed, Jul 2, 2008 at 10:51 AM, Igor Tandetnik <[EMAIL PROTECTED]> wrote: > Joanne Pham <[EMAIL PROTECTED]> wrote: > > I read the online document regarding "Table Level Locking" as below: > > At any one time, a single table may have any number of active > > read-locks or a single active write lock. To read data a table, a > > connection must first obtain a read-lock. To write to a table, a > > connection must obtain a write-lock on that table. If a required > > table lock cannot be obtained, the query fails and SQLITE_LOCKED is > > returned to the caller > > So the question that I had is while writing the data to table(write > > lock) another process can read the data from same table without any > > problem? > > The article you quote applies to connections that have opted into shared > cache. Only connections in the same process can share cache. Connections > from different process use the traditional file-level locking. > > Even connections with shared cache cannot read and write the same table > simultaneously (unless you also turn on "read uncommitted" option). > Consider the passage you yourself have just quoted: "at any one time, a > single table may have any number of active read-locks *OR* a single > active write lock" (emphasis mine). > > Igor Tandetnik > > > > _______________________________________________ > 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