Make sure to wrap your transactions in BEGIN / COMMIT. Use BEGIN IMMEDIATE for transactions that you know are going to write, and plain BEGIN for read-only transactions. You can omit the explicit BEGIN / COMMIT if each transaction consists of only a single statement since autocommit will do a BEGIN / COMMIT around the statement automagically.
--- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-----Original Message----- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of David Raymond >Sent: Tuesday, 7 August, 2018 11:13 >To: SQLite mailing list >Subject: Re: [sqlite] Database locks > >I think what he's saying is "my reads are slow, and I don't want them >to block my writes" which would mean he <should> use WAL mode. > >i.e. the long reads are going to cause a traffic jam of backed up >writes in rollback journal mode, but will be ok in WAL mode. > > > >-----Original Message----- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of Simon Slavin >Sent: Tuesday, August 07, 2018 12:56 PM >To: SQLite mailing list >Subject: Re: [sqlite] Database locks > >On 7 Aug 2018, at 3:04pm, Gerlando Falauto ><gerlando.fala...@gmail.com> wrote: > >> What might happen in my case is that reads could take a very long >time to >> consume/process all the data (30s for instance), and I believe the >lock is >> held until all data is consumed. >> I believe in that case the read would see all the data up to the >point in >> time when the SELECT was first issued, ignoring whatever happened >later, is >> that right? > >If your writes are fast, and your reads are slow, you should not use >WAL mode. Just set a good long timeout on both connections and let >SQLite do its thing. A sixty second timeout should be about the >minimum you should set, since you wouldn't want your program to crash >for anything less than that. > >Simon. >_______________________________________________ >sqlite-users mailing list >sqlite-users@mailinglists.sqlite.org >http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >_______________________________________________ >sqlite-users mailing list >sqlite-users@mailinglists.sqlite.org >http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users