Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a partitioned table in bigquery

Google recently announced partitioned tables in BigQuery which have many advantages. However, I found no documentation of how to create such tables. How do I create such a table, either in the UI, the CLI, or the API (java etc.)?

like image 360
Ran Avnimelech Avatar asked Jun 02 '16 14:06

Ran Avnimelech


People also ask

How to partition in BigQuery?

You can partition BigQuery tables by: Time-unit column: Tables are partitioned based on a TIMESTAMP , DATE , or DATETIME column in the table. Ingestion time: Tables are partitioned based on the timestamp when BigQuery ingests the data. Integer range: Tables are partitioned based on an integer column.

How do I add a partition to an existing BigQuery table?

BigQuery allows us to add partition to existing table using create table statement alone. Let's use CREATE TABLE AS SELECT * statement to add the partition to existing table. This statement will create the new table with partition. Also it copy the data from old to new table.

How many partitions can you have in a BigQuery table?

BigQuery has a limit of 4,000 partitions per table.


1 Answers

Take a look at timePartitioning property of table resources.
You can experiment with it I think :o)
More about it in Partitioned Tables and Creating and Updating Date-Partitioned Tables

like image 154
Mikhail Berlyant Avatar answered Oct 12 '22 11:10

Mikhail Berlyant