Introduction to table snapshots
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.
If you need mutable, lightweight copies of your tables, consider using table clones.
Access control for table snapshots
Access control for table snapshots is similar to access control for tables. For more information, see Control access to resources with IAM.
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 the data in a table snapshot that is not already charged to another 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 data is changed or deleted in the base table that also exists in a table snapshot, then you are charged for the table snapshot storage of the changed or deleted data. If there are multiple snapshots that contain the changed or deleted data, you are only charged for the storage used by the oldest snapshot.
The difference between base table and table snapshot storage charges is shown in the following image:
For more information, see BigQuery storage pricing.
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 view or a materialized view.
You can't take a snapshot of an external table.
You can't overwrite an existing table or table snapshot when you create a table snapshot.
If you snapshot a table that has data in write-optimized storage (streaming buffer), the data in the write-optimized storage is not included in the table snapshot.
If you snapshot a table that has data in time travel, the data in time travel is not included in the table snapshot.
If you snapshot a partitioned table that has a partition expiration set, the partition expiration information isn't retained in the snapshot. The snapshotted table uses the destination dataset's default partition expiration instead. To retain the partition expiration information, copy the table instead.
You can't copy a table snapshot.
Quotas and limits
For information about the quotas and limits that apply for table snapshots, see Table snapshots quotas and limits.
- 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.
- Automate snapshots at the dataset level.