일반적으로 BigQuery는 쿼리를 실행할 때 열 전체를 검색합니다.
legacy SQL에서 테이블 데코레이터를 사용하면 데이터의 하위 집합에 대한 쿼리를 더욱 경제적으로 실행할 수 있습니다. 테이블 복사, 테이블 내보내기 또는 tabledata.list를 사용한 데이터 나열 작업에서처럼 테이블을 읽을 때마다 테이블 데코레이터를 사용할 수 있습니다.
테이블 데코레이터는 <time>의 상댓값과 절댓값을 사용합니다. 상댓값은 음수로, 절댓값은 양수로 표시됩니다. 예를 들어 -3600000은 현재 시간 기준 1시간 전을 밀리초 단위로 표시한 것이며, 3600000은 1970년 1월 1일 이후의 1시간을 밀리초 단위로 표시한 것입니다.
시간 데코레이터
시간 데코레이터(이전에는 스냅샷 데코레이터)는 특정 시점의 테이블 이전 데이터를 참조합니다.
구문
@<time>
에포크 이후의 <time>(밀리초)에서 테이블의 이전 데이터를 참조합니다.
<time>은 지난 7일 이내여야 하며 테이블 생성 시간보다 길거나 같아야 하지만, 테이블 삭제 또는 만료 시간보다 작아야 합니다.
@0은 테이블에 사용할 수 있는 가장 오래된 데이터를 참조하는 특수한 사례입니다.
시간 데코레이터는 legacy SQL 외부에서도 사용됩니다. bq cp 명령어에서 테이블을 삭제한 후 7일 이내에 삭제된 테이블(/bigquery/docs/managing-tables#undeletetable)을 복원하기 위해 사용할 수 있습니다.
예시
1시간 전의 테이블 이전 데이터를 가져오려면 다음 안내를 따르세요.
상댓값 예시
#legacySQL
SELECT COUNT(*) FROM [PROJECT_ID:DATASET.TABLE@-3600000]
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-12-22(UTC)"],[[["Table decorators in legacy SQL allow for cost-effective querying of data subsets, as opposed to full column scans, and can be used when copying, exporting, or listing table data."],["Time decorators, indicated by `@\u003ctime\u003e`, reference a table's historical data at a specific point in time, measured in milliseconds since the epoch and within the last seven days."],["Range decorators, using the `@\u003ctime1\u003e-\u003ctime2\u003e` syntax, specify a range of time to target data added between the two times, with the second time defaulting to \"now\" if not specified."],["Time decorators can also be used in the `bq cp` command to restore tables deleted within seven days, expanding beyond their usage just within SQL queries."],["GoogleSQL's `FOR SYSTEM_TIME AS OF` clause and time-partitioned tables offer comparable functionality to time and range decorators, respectively, making table decorators not available in GoogleSQL."]]],[]]