Thanks I filed this as Ticket 1431 and requested they add your diagram to lockingv3.html
Sam Christian Smith wrote: >On Fri, 16 Sep 2005, Amin Azez wrote: > > > >>FAQ 7 >> >>(7) Can multiple applications or multiple instances of the same >>application access a single database file at the same time? >> >> Multiple processes can have the same database open at the same time. >>Multiple processes can be doing a SELECT at the same time. But only one >>process can be making changes to the database at once..... >> >> >> >>This answer fails to make clear whether or not the multiple readers can >>read while the single writer is writing, or whether the writer blocks >>the readers and the readers block pending writers (like mysql non-innodb >>tables) >> >>Could someone please clairify this point. >> >> > > >Locking in SQLite is detailed here: >http://www.sqlite.org/lockingv3.html > >In summary: >SQLite uses multiple readers/single writer locking. A writer can operate >concurrently with readers until it is ready to commit or spill data from >it's cache. In this case, it waits for readers to finish, then gets an >exclusive write lock and writes it's data. Thus, the following concurrency >is available to SQLite: > > time ----> >Reader >-------------| >Reader >-------------| >Reader >----------| >Writer >-------c***----| >Reader >***********-------------| > >Key: >- Executing query >c Commit >* Blocked by lock > > >>Start of query >> >> >| End of query > >The last reader above is blocked from starting by the writer until the >writer commits. If the writer commits before the last reader has finished, >it is blocked. > >It might be worth raising a ticket (http://www.sqlite.org/cvstrac/tktnew) >to have the FAQ reference the locking document. > > > > >>Sam >> >> >> > >Christian > > >