This document is an introduction to BigQuery table snapshots. It is the first of a set of documents that describes how to work with BigQuery table snapshots, including how to create, restore, copy, update, get information about, and query table snapshots. This document set is intended for users who are familiar with BigQuery and BigQuery tables.
A BigQuery table snapshot preserves the contents of a table (called the base table) at a particular time. You can save a snapshot of a current table, or create a snapshot of a table as it was at any time in the past seven days. A table snapshot can have an expiration; when the configured amount of time has passed since the table snapshot was created, BigQuery deletes the table snapshot. You can query a table snapshot as you would a standard table. Table snapshots are read-only, but you can create (restore) a standard table from a table snapshot, and then you can modify the restored table.
Benefits of using table snapshots include the following:
Keep a record for longer than seven days. With BigQuery time travel, you can only access a table's data from seven days ago or more recently. With table snapshots, you can preserve a table's data from a specified point in time for as long as you want.
Minimize storage cost. BigQuery only stores bytes that are different between a snapshot and its base table, so a table snapshot typically uses less storage than a full copy of the table.
Table snapshots are not fully supported in the Cloud Console. For best results, use the
bqcommand-line tool, APIs, or SQL statements that you run using the
Table snapshots are read-only; you can't update the data in a table snapshot unless you create a standard table from the snapshot and then update the data. You can only update a table snapshot's metadata; for example, its description, expiration date, and access policy.
You can only take a snapshot of a table's data as it was seven days ago or more recently, due to the seven-day limit for time travel.
You can't take a snapshot of a BigQuery view or materialized view.
You can't overwrite an existing table or table snapshot when you create a table snapshot.
You can't take a snapshot of a table that has data in streaming buffers.
Quotas and limits
For information about quotas and limits that apply for table snapshots, see Table snapshots quotas and limits.
Access control for table snapshots
Access control for table snapshots is similar to access control for tables. For more information, see Introduction to table access controls.
Querying table snapshots
You query a table snapshot's data in the same way as you query other types of BigQuery tables. For more information, see Querying BigQuery data.
Storage costs apply for table snapshots, but BigQuery only charges for data in a table snapshot that no longer exists in its base table, or that has changed in its base table.
When a table snapshot is created, there is initially no storage cost for the table snapshot.
If new data is added to the base table after the table snapshot was created, then you don't pay for storage of that data in the table snapshot.
If you change or delete data in the base table that also exists in the table snapshot, then you are charged for the table snapshot storage of the changed or deleted data.
- Create a table snapshot.
- Restore a table snapshot.
- Update a table snapshot's description, expiration date, or access policy.
- Create monthly snapshots of a table by using a service account that runs a scheduled query.