Stay organized with collections
Save and categorize content based on your preferences.
Garbage collection for sequential numbers in timestamps
You may have a reason, not related to garbage collection, to assign sequential
numbers to the timestamp property for a cell, rather than assigning a date and
time. This page describes Bigtable garbage collection for data with this
type of artificial timestamps.
Before you read this page, you should read the overview of garbage collection,
including the description of real and artificial timestamps.
Number of versions
If timestamps are sequence numbers, your garbage collection policy should be
based on the number of versions. This means that you specify the number of cells
to retain. An age-based garbage collection policy is unsafe if you use
sequential numbers instead of real timestamps, because age-based policies remove
data 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 the
cells' timestamps for any other use case, such as determining how old a value
is. As a workaround, you can write a real timestamp to a separate column, but
this will increase the amount of data you store.
Because garbage collection is asynchronous, you still should always use
filters when you read the data.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThis page covers garbage collection in Bigtable when sequential numbers are used as timestamps instead of actual dates and times.\u003c/p\u003e\n"],["\u003cp\u003eWhen using sequential numbers, garbage collection policies should be based on the number of versions, rather than on data age.\u003c/p\u003e\n"],["\u003cp\u003eUsing sequential numbers allows for monotonically increasing timestamps, but prevents switching to age-based garbage collection.\u003c/p\u003e\n"],["\u003cp\u003eSequential number timestamps can't be used to determine a value's age, requiring a separate column for real timestamps, which increases storage needs.\u003c/p\u003e\n"],["\u003cp\u003eIt is important to use filters when reading the data even when using sequential number timestamps, because garbage collection is asynchronous.\u003c/p\u003e\n"]]],[],null,["Garbage collection for sequential numbers in timestamps\n\nYou may have a reason, not related to garbage collection, to assign sequential\nnumbers to the timestamp property for a cell, rather than assigning a date and\ntime. This page describes Bigtable garbage collection for data with this\ntype of artificial timestamps.\n\nBefore you read this page, you should read the overview of garbage collection,\nincluding the description of [real and artificial timestamps](/bigtable/docs/garbage-collection#timestamps).\n\nNumber of versions\n\nIf timestamps are sequence numbers, your garbage collection policy should be\nbased on the number of versions. This means that you specify the number of cells\nto retain. **An age-based garbage collection policy is unsafe** if you use\nsequential numbers instead of real timestamps, because age-based policies remove\ndata based on the timestamp.\n\nAdvantages of storing sequential numbers in timestamps\n\n- You are able to use monotonically increasing timestamps if you need to.\n\nDisadvantages of storing sequential numbers in timestamps\n\n- You cannot switch to age-based garbage collection.\n\n- Because your timestamps aren't an actual date and time, you cannot use the\n cells' timestamps for any other use case, such as determining how old a value\n is. As a workaround, you can write a real timestamp to a separate column, but\n this will increase the amount of data you store.\n\n- Because garbage collection is asynchronous, you still should always use\n filters when you read the data.\n\nWhat's next\n\n- Read an [overview of Bigtable garbage collection](/bigtable/docs/garbage-collection).\n- Explore strategies to [simulate cell-level TTL](/bigtable/docs/gc-cell-level).\n- Review code samples showing how to [configure garbage collection](/bigtable/docs/configuring-garbage-collection).\n- Learn more about [storage pricing](/bigtable/pricing#storage)."]]