DEV Community

Cover image for How to clone tables in BigQuery
Marcelo Costa
Marcelo Costa

Posted on

How to clone tables in BigQuery

The long awaited table clones function became GA in BigQuery, why is it such a powerful feature?

A table clone is a lightweight, writeable copy of another table (called the base table). You are only charged for storage of data in the table clone that differs from the base table, so initially there is no storage cost for a table clone. Other than the billing model for storage, and some additional metadata for the base table, a table clone is similar to a standard table β€” you can query it, make a copy of it, delete it, and so on. β€” docs

bigquery clones

To create a clone:

CREATE TABLE
myproject.myDataset_backup.myTableClone
CLONE myproject.myDataset.myTable;
Enter fullscreen mode Exit fullscreen mode

The cool thing is that your original export stays totally untouched. No need to worry about messing it up. When you simply copy a table, you don't have to pay for all that "unchanged" storage.

Simply put, whenever you require data isolation, whether it's for testing or any form of analysis, make sure to include table clones in your arsenal for reducing expenses!

Other strategies that may be useful in your costs reduction toolbox:

Top comments (0)