At the moment we always review all handles when a checkpoint is started. That can be disruptive if there are a lot of tables, and is not necessary for read-only workloads. We could skip the handle gathering phase if we knew that there haven't been changes since the last checkpoint.
The mechanism Could be:
- The connection is marked as clean on open.
- The connection is marked as clean as soon as the transaction ID is allocated for a checkpoint.
- If the checkpoint fails with an error the connection is marked as dirty.
- Any time a btree is currently marked as dirty the connection is also marked as dirty.
Once those markers are in place a full non-forced checkpoint could skip creating a new checkpoint if the connection is clean.
It'd also be worthwhile to add assertions to validate the scheme. Maybe sweep could ensure that the connection is dirty any time it encounters a dirty btree handle.