SQLite Forum

Question on internals: Sync between WAL and B Tree
Login
WAL means Write Ahead Log. This is performed on page level, not on record level.

Any pages changed by the current write transaction are written to the WAL file. If the transaction commits, a commit record is written; if it rolls back, the entire transaction is deleted from the WAL file

If multiple transactions modify any given page, there may be several copies of that page corresponding to the states created by each of the committed transactions.

A read transaction will always continue to see the last commited state of any page as it was at the beginning of the read transaction.

Eventually, pages from committed transactions are written back to the db file. The delay also depends on read transactions still requiring outdated versions of modified pages.