Garbage collection for sequential numbers in timestamps
You may have a reason, not related to garbage collection, to assign sequentialnumbers to the timestamp property for a cell, rather than assigning a date andtime. This page describes Bigtable garbage collection for data with thistype of artificial timestamps.
Before you read this page, you should read the overview of garbage collection,including the description ofreal and artificial timestamps.
Number of versions
If timestamps are sequence numbers, your garbage collection policy should bebased on the number of versions. This means that you specify the number of cellsto retain.An age-based garbage collection policy is unsafe if you usesequential numbers instead of real timestamps, because age-based policies removedata based on the timestamp.
Advantages of storing sequential numbers in timestamps
- You are able to use monotonically increasing timestamps if you need to.
Disadvantages of storing sequential numbers in timestamps
You cannot switch to age-based garbage collection.
Because your timestamps aren't an actual date and time, you cannot use thecells' timestamps for any other use case, such as determining how old a valueis. As a workaround, you can write a real timestamp to a separate column, butthis will increase the amount of data you store.
Because garbage collection is asynchronous, you still should always usefilters when you read the data.
What's next
- Read anoverview of Bigtable garbage collection.
- Explore strategies tosimulate cell-level TTL.
- Review code samples showing how toconfigure garbage collection.
- Learn more aboutstorage pricing.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.