Sqlite - Concurrent Read-Write

Written By Sanjir Habib On Dec-6th, 2017

Looks like sqlite3 can handle concurrent users quite gracefully.

One doesn’t need to explicitly lock anything. The system and underlying library handles that transparently.

One process can open a db, make some update, and wait for a while without closing the database. And in the meantime other processes can concurrently open the db file and make more updates.

Well two processes can’t write to the file in the same instance. But that’s not what I am looking for.

Being able to write over a database, while another process has it open, is a minimal requirement.

There is more info in sqlite’s documentation

But I have made a few practical tests to confirm and check for gotchas.


  1. Process 1: opens a database, adds a record, and then sleeps/waits without closing.
  2. Process 2: opens the same database. Deletes the record process 1 added.
  3. Process 1: closes the connection, performs some more writes and exits.

The above process works without error and as expected.