Re: How to open an sqlite3 for reading without being blocked by process writing to it?
Peng Yu <[email protected]> Mon, 9 Mar 2020 08:17:06 -0500
| Newsgroups | gmane.comp.db.sqlite.general |
|---|---|
| Message-ID | <CABrM6wmyU-kABGOdmw33DsZsQsBMVK_DAqz-80zec9863QE0gQ@mail.gmail.com> |
I see this. What does it mean? Does it mean even when the sqlite3 session is closed there is still -wal and -shm left on the disk? """ There is an additional quasi-persistent "-wal" file and "-shm" shared memory file associated with each database, which can make SQLite less appealing for use as an application file-format. """ On 3/8/20, Simon Slavin <[email protected]> wrote: > [This explanation is much simplified for clarity. Before filling in missing > details please consider what the OP wants. Don't just show off your > exhaustive knowledge of SQLite.] > > A database is normally in delete journal mode, as if you'd executed > > PRAGMA journal_mode=DELETE > > In this journal mode you can't read from a database which is being changed. > If one process is changing the database it has the database locked. Another > process cannot read it until it is unlocked. Because the reading process > might read some of the row before it is changed, and the rest of the row > after it is changed. > > To fix this, change the journal mode to WAL: > > PRAGMA journal_mode=WAL > > In this mode one process can read a database while another process is > changing it. The process that reads the database gets the data as it was > before the change. > > For further details see > > <https://sqlite.org/wal.html> > _______________________________________________ > sqlite-users mailing list > [email protected] > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > -- Regards, Peng _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users