DEV Community

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

Posted on

1 1

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:

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay