이 페이지에서는 Bigtable 테이블의 열에서 최근 값만 유지할 수 있게 해주는 전략을 설명합니다.
모든 Cloud Bigtable 클라이언트 라이브러리에서 필터를 사용하여 특정 행과 열의 최근 값이나 셀을 읽을 수 있습니다. 그러나 경우에 따라 이전 버전의 데이터는 전혀 읽지 않아도 됩니다. 열에 셀을 하나만 유지하도록 지정하는 버전 기반 가비지 컬렉션 정책을 사용할 수 있지만, 가비지 컬렉션이 수행되려면 최대 일주일이 소요될 수 있으므로 실제로 테이블에 읽을 계획이 없는 오래된 데이터가 포함될 수 있습니다.
최신 값만 유지하려면 삭제 후 쓰기 방식을 사용하여 테이블의 열을 셀 하나로만 제한하는 것이 좋습니다.
삭제 후 쓰기
열에 값을 하나만 유지하려면 열을 삭제하는 요청을 보낸 후 하나의 원자적 동작에서 새 값과 타임스탬프를 사용하여 다시 만들면 됩니다.
다음 자바 의사코드 예시는 작동 방식을 보여줍니다. 순서가 중요합니다. 삭제는 쓰기 전에 수행되어야 합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-03-06(UTC)"],[[["This page details a strategy for maintaining only the most recent value in a Bigtable column, ensuring that older, unnecessary data is not stored."],["While Bigtable offers version-based garbage collection, it can take up to a week to remove old data, so a more immediate approach is to use a delete-then-write strategy to have only one cell."],["The recommended delete-then-write method involves sending a request to delete a column and then recreate it with a new value and timestamp in a single, atomic action, which is provided in Java pseudocode."],["Although setting a timestamp of 0 for writes was previously suggested, the delete-then-write approach is now preferred as it better leverages the use of valid timestamps."],["Using an age-based garbage collection policy with timestamps of 0 or less than the current time can result in unintended data deletion during garbage collection."]]],[]]