Home / Companies / Cockroach Labs / Blog / Post Details
Content Deep Dive

Protected Timestamps: For a future with less garbage

Blog post from Cockroach Labs

Post Details
Company
Date Published
Author
Aditya Maru
Word Count
2,194
Language
English
Hacker News Points
24
Summary

CockroachDB employs multi-version concurrency control (MVCC) to maintain data consistency by keeping multiple data revisions, which can increase query execution costs if not managed properly. To address this, the concept of Protected Timestamps is introduced, allowing CockroachDB to retain only necessary data while safely clearing outdated versions. This mechanism is achieved through Protected Timestamp Records (PTS records), which safeguard specific data revisions from garbage collection, crucial for operations like backups and analytical queries that require historical data. In a multi-tenant architecture, PTS records apply protections at the schema object level, cascading down the database hierarchy, ensuring that operations remain efficient and resilient without compromising data integrity. The implementation of protected timestamps enables CockroachDB to aggressively manage garbage collection, particularly benefiting backup processes by protecting necessary data until successful backups are completed. This approach allows for a shorter default garbage collection time-to-live, reducing unnecessary data accumulation and enhancing performance.