SQLite Forum

What changes show with "file change counter" in .DBINFO

What changes show with "file change counter" in .DBINFO

(1) By anonymous on 2020-10-11 10:23:38 [link] [source]

A simple vacuum increments the .dbinfo "file change counter:" by one when from a logical point of view nothing really changed.

My question is what types of changes are considered file changes? Is every successful insert, update, delete a file change? Is a change counted for each row affected or the whole transaction is a single change?

When does the number reach a limit (32-bit)? Does it then wrap around to zero or stop counting?

What is a practical use of this number?

(2) By Richard Hipp (drh) on 2020-10-11 11:22:48 in reply to 1 [source]

The purpose of the file change counter is to alert other database readers that something in the database file has changed and that they need to flush their cache and reread the database.