Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can one have hourly partitions in a BigQuery table?

The google documentation only talks about daily partitions. But is there anything in the model that hinders one from stuffing partitions in a table with other time period (e.g., hour or week)?

Are there any limits or drawbacks from having partitions in a "small" table?

like image 457
jrydberg Avatar asked Jan 12 '17 15:01

jrydberg


People also ask

How many partitions can a BigQuery table have?

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

How many partitions can a table have?

With up to 15,000 partitions allowed per partitioned table or index, you can store data for long durations in a single table. However, you should retain data only for as long as it is needed and maintain a balance between performance and the number of partitions.

How do I partition a BigQuery table?

In the Partition and cluster settings section, in the Partitioning list, select Partition by field, and then choose the partitioning column. This option is only available if the schema contains a DATE , TIMESTAMP , or DATETIME column.

Can I add a partition to an existing table in BigQuery?

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.


2 Answers

Yes, now Big Query supports hourly partitioning on Ingestion time.

Here is the documentation

like image 92
New Coder Avatar answered Oct 11 '22 17:10

New Coder


Yes.
Big Query now supports hourly partitioning based on any TIMESTAMP field, and not just on Ingestion time, by using TIMESTAMP_TRUNC:

 CREATE TABLE
   mydataset.newtable (transaction_id INT64,
     transaction_ts TIMESTAMP)
 PARTITION BY
   TIMESTAMP_TRUNC(transaction_ts, HOUR)
 OPTIONS
   ( partition_expiration_days=3,
     description="a table partitioned by transaction_ts" )
like image 29
raul7 Avatar answered Oct 11 '22 19:10

raul7