Does SQLite lock the database file on reads?

后端 未结 3 542
清酒与你
清酒与你 2021-01-30 20:12

I\'m investigating SQLite as a storage engine, and am curious to know whether SQLite locks the database file on reads.

I am concerned about read performance as my planne

3条回答
  •  旧时难觅i
    2021-01-30 21:06

    Adding more info for this answer:

    Q: Does SQLite lock the database file on reads?

    A: No and Yes

    Ref: https://www.sqlite.org/atomiccommit.html#_acquiring_a_read_lock

    The first step toward reading from the database file is obtaining a shared lock on the database file. A "shared" lock allows two or more database connections to read from the database file at the same time. But a shared lock prevents another database connection from writing to the database file while we are reading it

提交回复
热议问题