What concurrency level is of sqlite?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

What concurrency level is of sqlite?

Peng Yu
Hi,

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.

--
Regards,
Peng
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: What concurrency level is of sqlite?

Simon Slavin-3
On 3 Sep 2019, at 9:13pm, Peng Yu <[hidden email]> 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.

SQLite has only a lock for the entire database.  It does not lock tables or rows.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: What concurrency level is of sqlite?

Keith Medcalf
In reply to this post by Peng Yu
On Tuesday, 3 September, 2019 14:14, Peng Yu <[hidden email]> 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
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] What concurrency level is of sqlite?

Hick Gunter
In reply to this post by Peng Yu
Just the same.

-----Urspr√ľngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von Peng Yu
Gesendet: Dienstag, 03. September 2019 22:14
An: SQLite mailing list <[hidden email]>
Betreff: [EXTERNAL] [sqlite] What concurrency level is of sqlite?

Hi,

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.

--
Regards,
Peng
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users