Database change counter in WAL mode
(1) By anonymous on 2020-06-14 23:29:06 [source]
Is there a reason SQLite doesn't bother to update the change counter of the main database file while in WAL mode? I'd like to be able to determine the "version" of the database after the connections have been closed. Is this in anyway possible?
(2) By Richard Hipp (drh) on 2020-06-14 23:42:54 in reply to 1 [link] [source]
Is there a reason SQLite doesn't ... update the change counter ... in WAL mode?
Yes. WAL mode does not use the change counter. And updating the change counter involves extra code, extra CPU cycles, and extra I/O. So SQLite is smaller and runs faster without WAL-mode change counter updates.
(3) By anonymous on 2020-06-15 19:17:47 in reply to 2 [link] [source]
I think it might be useful to update the change counter after each checkpoint; so that at least you can determine the change status of the database file after the log and index files are deleted.