BigQuery partitioning vs clustering and storage choices for the Professional Data Engineer exam
The "Storing the data" section is about 20% of the Professional Data Engineer exam, but storage choices and BigQuery optimization show up across the other sections too: design, operations, cost. This article focuses on the two decisions you will meet most often: partitioning versus clustering in BigQuery, and which storage service fits a given access pattern. Each part has a decision table, SQL examples and practice questions.
Key takeaways
- The data storage section is about 20% of the PDE exam, but storage-choice and BigQuery-optimization questions also show up in other sections.
- Partition when most queries filter by date or you want old data to expire; cluster when you filter on high-cardinality columns; use both for a large table filtered by date and customer.
- Questions describe an access pattern and ask you to choose: BigQuery for SQL analytics, Bigtable for heavy writes and key lookups, Spanner for globally scalable relational transactions.
- Bigtable: put an evenly distributed field first in the row key (sensor_id#timestamp, not timestamp#sensor_id) to avoid hotspots.
Partitioning and clustering: get the mechanics right first
BigQuery on-demand pricing bills the bytes a query reads. Partitioning and clustering both reduce bytes read, in different ways:
- Partitioning splits a table into physical segments on one column. When a query filters on that column, BigQuery skips non-matching partitions (pruning). Because metadata knows exactly which partitions are read, a dry run gives an accurate cost estimate before the query runs.
- Clustering sorts data within the table (or within each partition) by up to four columns. Queries that filter or aggregate on those columns scan only the relevant blocks. The trade-off: the real cost is only known after the query runs, and a dry run may overestimate.
There are three partitioning types: time-unit column (DATE, TIMESTAMP, DATETIME, with hourly/daily/monthly/yearly granularity), ingestion time (the _PARTITIONTIME pseudo-column) and integer range. A table is partitioned on a single column, and you cannot convert an existing non-partitioned table in place; create a new table with CREATE TABLE ... AS SELECT.
Decision table: partition, cluster or both
| Situation | Sensible choice | Notes |
|---|---|---|
| Most queries filter by date and you need costs known upfront | Partition on the date column | Accurate dry-run estimates; consider require_partition_filter |
| Automatically delete data older than N days | Partition + partition expiration | Drops whole partitions with no scan cost |
| Reload one day without touching others | Partition | Load jobs can write to a specific partition |
| Filter on a high-cardinality column (user_id, sku) | Cluster on it | Partitioning on high cardinality creates too many tiny partitions |
| Filters combine several columns (country, status, category) | Cluster on up to 4 columns | Order matters: put the most frequently filtered column first |
| Each partition would only be a few hundred MB | Prefer clustering, or coarser partitions (month instead of day) | The docs suggest an average partition size of about 10 GB or more when combining with clustering |
| Large table filtered by date and by customer | Partition by date + cluster by customer_id | The most common combination on the exam |
| DML modifies most partitions every few minutes | Consider clustering instead of partitioning | Per the official guidance on when to use clustering |
An often-missed point: partitioning also saves storage cost. Each partition that is not modified for 90 consecutive days qualifies for long-term storage pricing on its own; an unpartitioned table only qualifies if the whole table is untouched for 90 days.
Example of a table that is both partitioned and clustered:
CREATE TABLE analytics.events
PARTITION BY DATE(event_ts)
CLUSTER BY customer_id, event_type
OPTIONS (
partition_expiration_days = 400,
require_partition_filter = TRUE
) AS
SELECT * FROM staging.events_raw;
A query with WHERE DATE(event_ts) BETWEEN '2026-10-01' AND '2026-10-07' AND customer_id = 'C123' reads only 7 partitions, and within each only the blocks holding C123. If instead you wrap the partitioning column in an expression that does not support pruning, or filter through a complex subquery, BigQuery may scan everything.
Other BigQuery optimizations that come up
- Materialized views: when many queries repeat the same aggregation over constantly changing data. BigQuery refreshes them and can rewrite queries to use them. See practice question #346.
- BI Engine: in-memory acceleration for dashboards.
- Denormalize with
STRUCT/ARRAY: BigQuery usually performs better on nested data than on joins between large tables. For a small transactional database (like the patient records in question #3), normalization is still the right answer. Don't apply one rule to every system. - Streaming writes: use the BigQuery Storage Write API; the legacy
insertAllAPI still exists but is no longer the recommended choice for new pipelines. - Compute cost: on-demand by bytes scanned, or BigQuery Editions (Standard, Enterprise, Enterprise Plus) by slots with reservations and autoscaling. A typical question: large steady workloads favor capacity; small spiky workloads favor on-demand, with a maximum bytes billed limit to block runaway queries.
Choosing a storage service: start from the access pattern
PDE rarely asks "what is service X". It describes an access pattern and asks you to choose. Ask in order: is the data structured? key lookups or analytical scans? multi-row transactions? what scale and latency? global or regional?
| Access pattern | Service | Signals in the question |
|---|---|---|
| SQL analytics over terabytes to petabytes | BigQuery | "data warehouse", "ad hoc analysis", "BI dashboard" |
| Raw files, unstructured data, data lake | Cloud Storage (+ BigLake for querying and access control) | "images, logs, Parquet", "cheapest storage", "archive" |
| Massive writes, key lookups, time series, IoT | Bigtable | "millions of writes per second", "single-digit millisecond latency", "sensor data" |
| Relational transactions, strong consistency, global scale | Spanner | "global", "horizontal scale", "strong consistency", "financial transactions" |
| Conventional relational apps on MySQL/PostgreSQL/SQL Server | Cloud SQL | "lift and shift", "existing MySQL application", moderate scale |
| High-performance PostgreSQL, mixed transactional and analytical | AlloyDB | "PostgreSQL-compatible", "high performance", "HTAP" |
| Documents, web/mobile apps, client sync | Firestore | "JSON documents", "mobile app", "offline sync" |
| Caching, sessions, sub-millisecond latency | Memorystore (Redis/Valkey/Memcached) | "cache", "leaderboard", "session store" |
For example, a financial system with high concurrent throughput, low-latency reads and writes on individual records and strong consistency at scale points to Spanner (question #344). IoT telemetry growing by hundreds of terabytes a year with key-based reads leans toward Bigtable or equivalent wide-column NoSQL such as HBase/Cassandra.
Bigtable: the row key decides everything
Bigtable stores rows in lexicographic order of the row key and splits data into tablets by key range. If the row key increases monotonically (timestamps, sequence numbers), every new write lands on the same node — a hotspot. Rules of thumb:
- Lead with an evenly distributed field (device ID, user ID) and put the timestamp after it:
sensor_id#timestamp, nottimestamp#sensor_id. See question #29. - Design keys around queries: Bigtable is most efficient reading one key or a contiguous key range.
- When performance is poor, the cause is usually the schema, not the node count. Spreading reads and writes evenly across the row space is the right fix (question #32). Key Visualizer shows hotspots.
- Bigtable is not built for joins or multi-row transactions; if the scenario needs them, go back to Spanner or BigQuery.
Data lakes and governance
For multi-format data from many sources, the usual pattern is Cloud Storage and BigQuery as repositories plus a governance layer for metadata discovery, data quality and lineage. Current exam answers usually call that layer Dataplex Universal Catalog (question #348); on 10 April 2026 Google renamed it Knowledge Catalog, with the same features and APIs. The old Data Catalog was discontinued from 1 June 2026.
When moving Hadoop/Spark to the cloud, keep data in Cloud Storage (Cloud Storage connector) rather than HDFS so you can shut clusters down between jobs and separate compute from storage (question #17).
Lifecycle and storage cost
- Cloud Storage: Standard, Nearline, Coldline, Archive; lifecycle rules change class or delete by object age. Autoclass when access patterns are unpredictable.
- BigQuery: partition expiration, default table expiration at dataset level, automatic long-term storage after 90 days unmodified; time travel and snapshots for recovery.
- DR: cross-region dataset replication for BigQuery (question #340), cross-region read replicas for Cloud SQL, multi-region configurations for Spanner, replication between clusters for Bigtable.
Self-check before exam day
- Explain why a dry run on a clustered table may overestimate the real cost.
- Write the DDL for a table partitioned by day, clustered on two columns, with partition expiration.
- Name three signals that make you pick Bigtable over BigQuery, and three that make you pick Spanner over Cloud SQL.
- Fix a Bigtable row key that causes hotspots.
- Know when to use materialized views, BI Engine and authorized views.
Start practicing
Try the 60 free PDE questions and watch for the BigQuery, Bigtable and Spanner ones; once confident, take a timed exam (Pro). For the big picture, read the Professional Data Engineer study guide.