SQLite Forum

Most efficient way to tell if any database content has changed
Login
The simplest way is probably to hold-open a second connection to the database and periodically execute `PRAGMA data_version`.  If the value changes then *a different connection* has updated the data in the database.  Since this connection is used for nothing other than polling the data_version, you only need a very small cache_size for it.

<https://sqlite.org/pragma.html#pragma_data_version>

Note that this is basically how a connection determines internally that the database file has been modified by another connection and must flush its page cache.