Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Pembersihan sampah memori untuk angka berurutan dalam stempel waktu
Anda mungkin memiliki alasan, yang tidak terkait dengan pembersihan sampah, untuk menetapkan angka
berurutan ke properti stempel waktu untuk sel, bukan menetapkan tanggal dan
waktu. Halaman ini menjelaskan pembersihan sampah Bigtable untuk data dengan jenis stempel waktu buatan ini.
Sebelum membaca halaman ini, Anda harus membaca ringkasan pembersihan sampah,
termasuk deskripsi stempel waktu asli dan buatan.
Jumlah versi
Jika stempel waktu adalah nomor urutan, kebijakan pembersihan sampah Anda harus
didasarkan pada jumlah versi. Ini berarti Anda menentukan jumlah sel yang akan dipertahankan. Kebijakan pembersihan sampah berbasis usia tidak aman jika Anda menggunakan
angka berurutan, bukan stempel waktu sebenarnya, karena kebijakan berbasis usia menghapus
data berdasarkan stempel waktu.
Keuntungan menyimpan angka berurutan dalam stempel waktu
Anda dapat menggunakan stempel waktu yang meningkat secara monoton jika perlu.
Kekurangan menyimpan nomor berurutan dalam stempel waktu
Anda tidak dapat beralih ke pembersihan sampah berbasis usia.
Karena stempel waktu Anda bukan tanggal dan waktu sebenarnya, Anda tidak dapat menggunakan stempel waktu sel untuk kasus penggunaan lainnya, seperti menentukan usia nilai. Sebagai solusi, Anda dapat menulis stempel waktu sebenarnya ke kolom terpisah, tetapi hal ini akan meningkatkan jumlah data yang Anda simpan.
Karena pembersihan sampah bersifat asinkron, Anda tetap harus selalu menggunakan
filter saat membaca data.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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)."]]