Reclaiming Old Database Versions
Keep the version each active snapshot can still need and account for the memory effects of long-running readers.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
A version can be obsolete for new reads and necessary for old ones
Suppose a record has committed versions at times five and ten. A reader with snapshot time eight may still need the version at five. Deleting every version earlier than the oldest snapshot timestamp would incorrectly delete it. Instead preserve an appropriate visible predecessor and any versions still needed by active snapshots, replicas or other stated retention obligations.
Cleanup and transaction lifetime affect each other
Long readers can pin old state and cause storage growth even while new updates finish normally. Logs, indexes and historical readers may use distinct retention cutoffs. Chunking maintenance or changing reader lifetimes is a workload choice, while safe reclamation derives from version eligibility. Snapshot isolation explains which version a reader selects. LSM compaction removes versions only when the relevant lower layers and readers no longer require them.[1][2]