Glossary · BigQuery
What is partitioned table?
A partitioned table in BigQuery is split into segments by a date, timestamp or integer column, or by ingestion time. Queries that filter on that column scan only the matching partitions, which cuts bytes billed, and each partition ages into long-term storage on its own.
How partitioning works
You choose one partitioning column when you create the table:
- Time-unit column: a
DATE,TIMESTAMPorDATETIMEcolumn, with daily (the default), monthly or yearly partitions, or hourly ones forTIMESTAMPandDATETIME. Rows withNULLgo to a__NULL__partition, and dates outside 1960 to 2159 go to__UNPARTITIONED__. - Ingestion time: BigQuery assigns rows by arrival time and exposes it as the
_PARTITIONTIMEand_PARTITIONDATEpseudocolumns. - Integer range: an
INT64column split into ranges you define.
CREATE TABLE analytics.events
PARTITION BY DATE(event_time)
OPTIONS (require_partition_filter = TRUE, partition_expiration_days = 400)
AS
SELECT * FROM analytics.events_unpartitioned;
require_partition_filter rejects queries with no usable filter on the partitioning column (the cannot query without partition filter error), and partition_expiration_days deletes partitions as they age out. Syntax details are on PARTITION BY.
What it does to the bill
On demand, you pay only for the partitions a query cannot skip. Take 365 daily partitions holding 10 GiB each of the columns a dashboard reads: a full scan is 3,650 GiB, about $22.28 at $6.25 per TiB; the last 7 days are 70 GiB, about $0.43. On editions, pruning saves slot time instead of bytes.
Pruning needs a constant filter on the partitioning column:
-- Prunes: the boundary is a constant expression
SELECT customer_id, COUNT(*) AS events
FROM analytics.events
WHERE event_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 7 DAY)
GROUP BY customer_id;
-- Scans every partition: the boundary comes from another table
SELECT customer_id, COUNT(*) AS events
FROM analytics.events
WHERE event_time >= (SELECT MAX(loaded_at) FROM analytics.load_log)
GROUP BY customer_id;
Storage gains too: each partition qualifies for long-term storage separately, so old partitions get the lower rate while new ones keep loading. Unlike clustering, partitioning gives an accurate dry-run estimate before the query runs.
Find queries that miss the partition filter
INFORMATION_SCHEMA.JOBS lists the tables each query referenced. The most expensive queries on a partitioned table are where missing or non-pruning filters show up:
SELECT
job_id,
user_email,
ROUND(total_bytes_billed / POW(1024, 3), 1) AS gib_billed,
ROUND(total_bytes_billed / POW(1024, 4) * 6.25, 2) AS approx_on_demand_usd,
LEFT(query, 120) AS query_start
FROM `region-us`.INFORMATION_SCHEMA.JOBS AS j
WHERE creation_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 7 DAY)
AND job_type = 'QUERY'
AND EXISTS (
SELECT 1 FROM UNNEST(j.referenced_tables) AS t
WHERE t.dataset_id = 'analytics' AND t.table_id = 'events')
ORDER BY total_bytes_billed DESC
LIMIT 20;
Pitfalls
- Too many small partitions. Google suggests clustering instead when partitions would hold less than about 10 GB each; many tiny partitions add metadata overhead.
- Partition modification quota. Jobs that append to many partitions, file by file, hit the daily partition modification limit. Batch the loads.
- Date-sharded tables.
events_20261123-style tables are slower and harder to manage than one partitioned table; Google recommends partitioning over sharding. - Unfiltered DML. A
MERGEorDELETEwithout a filter on the partitioning column scans every partition, and each partition it changes goes back to active storage pricing.
Estimate the savings for your own tables with the pricing calculator.
FAQ
How many partitions can a BigQuery table have?
Up to 10,000 partitions per table, and a single load or query job can modify up to 4,000 of them. If daily partitions would exceed that, use monthly or yearly partitions, or cluster instead.
Can I partition an existing BigQuery table?
Not in place. Create a new partitioned table from the old one with CREATE TABLE ... PARTITION BY ... AS SELECT, then swap names. The partitioning column must be a top-level DATE, TIMESTAMP, DATETIME or INTEGER column, and only one column is allowed.
Why does my query still scan the whole partitioned table?
The filter on the partitioning column must be a constant expression. A boundary that comes from a subquery or another table, or an expression that mixes the partitioning column with other columns, does not prune. A dry run shows the bytes before you pay for them.
