Loading Academy Hub...
Master Google BigQuery architecture: Borg compute scheduling, Capacitor columnar storage, slot reservations (On-Demand vs Editions), partition pruning (ingestion-time vs column-based), and multi-column clustering.
[!NOTE] Google BigQuery decouples compute from storage via Google's Jupiter petabit network. The compute tier consists of dynamic worker units called Slots orchestrated by Borg, while the storage tier uses Capacitor, Google's proprietary columnar format.
| Dimension | Partitioning | Clustering |
|---|---|---|
| Mechanics | Divides table into distinct storage segments (by day, hour, or integer range). | Sorts and co-locates data within storage segments based on 1 to 4 columns. |
| Limit | Max 4,000 partitions per table. | Up to 4 columns per table. |
| Cost Estimate | BigQuery validator calculates exact bytes to be scanned before query execution. | Query cost cannot be estimated prior to execution (calculated dynamically). |
| Best For | Date/timestamp columns queried with range filters (WHERE _PARTITIONDATE >= ...). | High-cardinality keys (customer_id, status) frequently used in filters and joins. |
SELECT * pays a massive byte-scan & network penalty—always project explicit columns (SELECT user_id, amount).4,000 Partition Limit): Partition exclusively on coarse low-cardinality fields (usually DATE(event_ts)—BigQuery enforces a 4,000-partition hard limit per table), then apply Clustering (CLUSTER BY tenant_id, event_type) up to 4 columns to sort storage blocks within each day for zero extra storage fee.Autoscale Slots): On-Demand bills $6.25/TB scanned (logical or physical bytes—always audit Active vs Time-Travel compression ratios before switching a dataset to Physical Storage Billing!). High-concurrency teams move to BigQuery Editions (Standard/Enterprise) with baseline + autoscaling Slots and require_partition_filter = true guardrails.Review the production code, company interview Q&As, incident traces, and comprehension quiz inside this lesson.
-- Production BigQuery Table Definition
CREATE OR REPLACE TABLE `enterprise-lakehouse-prod.finance.fact_transactions` (
transaction_id STRING NOT NULL,
account_id INT64 NOT NULL,
merchant_id STRING NOT NULL,
amount NUMERIC(18, 4) NOT NULL,
status STRING NOT NULL,
transaction_time TIMESTAMP NOT NULL
)
PARTITION BY DATE(transaction_time)
CLUSTER BY account_id, merchant_id, status
OPTIONS (
partition_expiration_days = 1095, -- 3 years retention
require_partition_filter = TRUE -- Prevents accidental $1,000 full-table scans
);google.api_core.exceptions.BadRequest: 400 Cannot query table 'finance.fact_transactions' without a filter over column 'transaction_time'.