On Tuesday, 3 September, 2019 14:14, Peng Yu <pengyu...@gmail.com> wrote:

>In other words, if two processes write to the same sqlite file but to
>different tables, will one wait for the other? What if to the same
>table but different rows? Thanks.

You will not be permitted to do that as there is no locking at a grain finer 
than the entire database between processes.  One of the processes will be able 
to obtain the update transaction lock, and the other will fail to obtain that 
update transaction lock.  Unless you are using WAL journal mode, then in such a 
circumstance even the successful process may never be able to commit its 
changes if the other process never releases its shared lock (this is called a 
deadlock).  That is why you must always acquire all needed locks at one go by 
using the appropriate type of BEGIN statement, and if your lock acquisition 
fails you must release all held locks.

-- 
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to