Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Garbage collection per i numeri sequenziali nei timestamp
Potresti avere un motivo, non correlato al garbage collection, per assegnare numeri sequenziali alla proprietà timestamp di una cella anziché una data e un'ora. Questa pagina descrive la raccolta dei rifiuti di Bigtable per i dati con questo tipo di timestamp artificiali.
Prima di leggere questa pagina, ti consigliamo di leggere la panoramica della raccolta dei rifiuti,
inclusa la descrizione dei timestamp reali e artificiali.
Numero di versioni
Se i timestamp sono numeri di sequenza, il criterio di raccolta dei rifiuti deve essere basato sul numero di versioni. Ciò significa che devi specificare il numero di celle da conservare. Un criterio di garbage collection basato sull'età non è sicuro se utilizzi numeri sequenziali anziché timestamp reali, perché i criteri basati sull'età rimuovono i dati in base al timestamp.
Vantaggi dell'archiviazione di numeri sequenziali nei timestamp
Se necessario, puoi utilizzare timestamp in aumento monotonico.
Svantaggi dell'archiviazione di numeri sequenziali nei timestamp
Non puoi passare alla raccolta dei rifiuti in base all'età.
Poiché i timestamp non sono date e ore effettive, non puoi utilizzare i timestamp delle celle per altri casi d'uso, ad esempio per determinare l'età di un valore. Come soluzione alternativa, puoi scrivere un timestamp reale in una colonna separata, ma questo aumenterà la quantità di dati archiviati.
Poiché la raccolta dei rifiuti è asincrona, devi comunque sempre utilizzare i filtri quando leggi i dati.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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)."]]