4 ms·
> Single-File Documents. An SQLite database is contained in a single file, which is easily copied or moved or attached. The "document" metaphor is preserved. I
by LeoNatan25 8y ago
> Single-File Documents. An SQLite database is contained in a single file, which is easily copied or moved or attached. The "document" metaphor is preserved.
Is this still true by default? With write-ahead (wal) and shared memory (shm) enabled, it is no longer safe to consider only the database file. Pragmas exist to disable those, but people should be familiar of these features and use with care. The document should be updated to introduce these concepts.
- kccqzy 8y agoIt's mentioned on the WAL docs on https://sqlite.org/wal.html https://sqlite.org/wal.html > 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.
- adzm 8y agoWhy would you realistically need wal or shm for an application file format anyway? That's for high concurrency in general.
- gumby 8y agoThe article explicitly mentions concurrent access.
- marton78 8y agoThat's true, however it's possible to remove the wal file after closing the database: > The only safe way to remove a WAL file is to open the database file using one of the sqlite3_open() interfaces then immediately close the database using sqlite3_close().
- imh 8y agoCan you expand on that? How do those two features break things?
- darkpuma 8y agoIt's not so much that they break things, but if those features are enabled sqlite will be writing multiple files instead of just one, which somewhat nullifies the "single file" benefit of sqlite.