Home » Bigquery » Tutorials » TRUNCATE table

BigQuery TRUNCATE table

The TRUNCATE TABLE statement removes all rows from a table but leaves the table metadata intact, including the table schema, description, and labels

TRUNCATE table example

TRUNCATE TABLE dataset.Inventory

Explanation

TRUNCATE table is a metadata operation and hence costs 0$. Whereas, DELETE is a data operation and costs $

TRUNCATE table wipes out the TIME TRAVEL history in case of a customer managed table. Make sure to use DELETE if you want to retain the TIME TRAVEL snapshots

Syntax reference

TRUNCATE TABLE [[project_name.]dataset_name.]table_name