Re: How to open an sqlite3 for reading without being blocked by process writing to it?

David Raymond <[email protected]> Mon, 9 Mar 2020 14:16:45 +0000
Newsgroups gmane.comp.db.sqlite.general
Message-ID <VI1PR07MB60293DF4C04606C4AA2BD24E87FE0@VI1PR07MB6029.eurprd07.prod.outlook.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.
"""


In rollback journal mode the -journal file only shows up when you're making changes. In wal mode the -wal and -shm files are there for the entire life of the connection, as long as there's anything even reading the file, they're there.

In general I believe the last connection tries to do a complete checkpoint when it closes, and if it succeeds then it'll delete the -wal and -shm files. If you have automatic checkpointing turned off (maybe you're doing regular checkpoints from a separate dedicated process) then it's possible for all connections to finish and close the database without error, but still have those files sitting around because they haven't been checkpointed yet.

Some combination of those two is what is being referred to there I believe.

_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users