Prepare and test your skills

Prepare and test your skills

Capacity management in BigQuery (opens in a new tab) is the practice of buying and assigning dedicated query compute to meet performance, cost, and business requirements. Compute is measured in slots, which are virtual compute units that execute SQL queries and other jobs such as load, export, query, and copy jobs. BigQuery separates compute, memory, and storage into independently managed services, so choosing slot capacity is separate from storing data.
Slots as isolated compute capacity are units of computational power that run queries independently of how much data is stored. Storage scales to dozens of petabytes in Google's distributed file system where data is compressed, encrypted, and replicated, while compute slots connect to memory through a remote distributed service over Google's petabit network. Google manages all underlying infrastructure and automatically decides how many slots each query uses based on data volume, query complexity, and available capacity.
Because storage growth does not consume query slots, adding slots increases concurrency and throughput without resizing storage or copying data. High wait times in query execution plans combined with high slot utilization signals that more slots are needed. A practical reference is reserving about 4,000 slots to run about 100 medium-complexity queries concurrently, then adjusting as concurrency grows.
Reservations (opens in a new tab) and assignments are two linked objects that guarantee capacity for assigned workloads. A reservation is a pool of slots created in an administration project (opens in a new tab) and shared by assigning projects, folders, or organizations to it. Queries issued from an assigned project flow to the assigned reservation for execution, so production and deadline-driven work does not compete with ad hoc work in the shared on-demand pool.
Each reservation can combine baseline slots, which are always allocated, with autoscaled slots that are added or removed dynamically with demand. Every reservation starts at a minimum of 50 slots and can scale up to regional quota, while a slot budget configured per reservation acts as the maximum cost cap. Administrators can dynamically create, resize, and delete reservations, but a reservation with assignments cannot be deleted until its assignments are removed. Shuffle size quota is computed per reservation and sliced across assigned projects, so noisy work in one project affects the shared reservation quota.
On-demand versus capacity-based Editions billing is the choice between paying for bytes scanned from a shared pool and paying for dedicated slots in a reservation. The billing model applies per project, so the same organization can run some projects on on-demand and other projects on Editions at the same time and can switch a project at any time. There is no charge for bytes processed when a query runs under the capacity-based model.
| Model | How capacity is obtained | Cost basis |
|---|---|---|
| On-demand pricing | Queries draw from the BigQuery shared resource pool with fixed per-project capacity | Pay per TiB of bytes scanned, with a 10 MiB minimum per query |
| Capacity-based pricing with Editions | Queries draw from dedicated baseline plus autoscaled slots in an assigned reservation | Pay for slot-hours consumed, with optional monthly or annual commitments |
On-demand billing fits variable, exploratory, or low-volume work because no capacity is provisioned, but it is capped at 2,000 slots per project and shares performance with other tenants. Capacity-based billing fits enterprise data warehouse, reporting, and extract-load-transform workloads with many concurrent queries because dedicated slots isolate performance and support higher concurrency. Optional capacity commitments provide cheaper steady-state capacity for predictable load, while autoscaling absorbs peaks without manual resizing.
Exam tip: On-demand projects are capped at 2,000 slots per project; exceeding that capacity requires switching to the capacity-based model with reservations.
Monitoring utilization and right-sizing capacity use historical consumption and performance signals to set baselines, ceilings, and commitments correctly. Cost control (opens in a new tab) depends on regular review of slot use, query times, and bytes scanned to prevent both throttling from too few slots and overspending from too large a baseline. The Slot estimator uses historical performance metrics to estimate organization capacity requirements, and the Workload management page shows commitments and reservation assignments.
Project and reservation slot usage can be observed in complementary ways:
reservation_id field that identifies which reservation served each job.Custom charts and alert policies extend this foundation by notifying operators when conditions such as excessive query execution time occur. Capacity-based usage is metered in slot-hours and billed in minimum one-second increments, with a one-minute minimum duration by default and no minimum duration when opting in to fluid scaling.
Isolating workloads and sharing idle slots control how centralized capacity is divided without wasting unused compute. Reservations isolate workloads by assigning projects, folders, or organizations to a named pool such as prod for production and test for testing, so test jobs do not compete for production capacity. Child resources inherit a parent folder or organization assignment unless explicitly reassigned, and a None assignment forces those projects or folders to use on-demand pricing to opt out of centralized capacity.
When a workload does not use all of its dedicated slots, BigQuery automatically shares those unused slots with other workloads that need them. The BigQuery scheduler handles allocation within a reservation, so capacity cannot be pinned to a single assignment and queries fairly share the pool over time. The number of slots shown in use can appear higher than the reservation size because of how BigQuery provisions resources, but billing does not exceed the reservation slot count. Legacy flat-rate reservations (opens in a new tab) function as Enterprise edition slots and are labeled as flat-rate for pricing model and Enterprise for edition.
Continue with this study guide: Capacity management (e.g., BigQuery Editions and reservations)
Interactive or batch query jobs are two execution priorities and architectures for running data processing work on Google Cloud. Interactive queries execute as soon as possible and are the default priority for low-latency analysis, while batch queries queue on behalf of the user and start as soon as idle resources are available in the shared pool or reservation. The choice affects latency, concurrency limits, cost, and which engine and orchestration tool should run the work.
BigQuery interactive architecture is a platform as a service design that separates compute, memory, and storage so each can scale independently. Compute is measured in slots grouped into reservations assigned to projects, folders, or organizations. Memory is provided by a remote distributed service connected to slots by a petabit network, while storage uses a distributed file system where data is automatically compressed, encrypted, replicated, and distributed without consuming query compute.
A BigQuery query flows through an ordered execution path from request to cached results:
Concurrency is smoothed by running many queries in parallel, queuing additional queries until resources free, and fairly redistributing slots between new and running queries as queries start and finish. Batch priority increases effective concurrency because more batch queries can be queued than interactive queries, and spreading high-volume interactive work across projects or converting it to batch reduces pressure on the interactive queue limit.
Batch processing with Dataflow and ephemeral Spark prioritizes parallel throughput and restartability over single-query latency. Dataflow is a fully managed service for executing batch and streaming pipelines written with the Apache Beam software development kit, available in Java, Python, and Go. When a Dataflow job runs, the service allocates a pool of Compute Engine worker virtual machines to execute the pipeline, autoscales workers, dynamically rebalances work, and automatically deletes the workers when the job completes or is cancelled.
Managed Service for Apache Spark provides ephemeral Spark clusters orchestrated by Managed Service for Apache Airflow, where clusters exist only while the processing stage runs. In the documented batch pattern, Managed Airflow carries out an ordered workflow:
The data lake phase stores processed data in Cloud Storage in columnar formats such as Parquet and optimized row columnar (ORC) for efficient storage and faster analytical access. Metadata about databases, tables, columns, and partitions is stored in the Hive metastore service supplied by Dataproc Metastore, while directed acyclic graph files that define the Airflow steps are stored in a separate Cloud Storage bucket.
State, partitioning, and fault tolerance are the three architectural properties that drive service selection between interactive and batch systems. BigQuery uses stateless workers and separated storage, Dataflow ties pipeline state and temporary files to worker region and zone, and ephemeral Spark keeps no persistent cluster state. The differences determine latency, throughput, and recovery behavior.
| Service | State management | Partitioning and storage | Fault tolerance |
|---|---|---|---|
| BigQuery | Stateless workers exchange intermediate data via shuffle tier; final results persist with cache | Columnar Capacitor storage with encoded statistics used to compile optimal plans; storage separated from compute | Automatic replication and distribution; dynamic plan adjustment and fair resource redistribution |
| Dataflow | Pipeline state artifacts, sources, sinks, and temporary files tied to worker region and zone | Parallel processing across workers; sources and sinks include Pub/Sub and BigQuery | Exactly-once processing by default, with at-least-once mode for lower cost and latency; Pub/Sub subscriptions buffer unacknowledged messages up to 7 days |
| Managed Service for Apache Spark | No persistent cluster state; clusters are ephemeral and recreated after failure | Ingested files in Cloud Storage; processed data in Parquet or ORC; table metadata in Dataproc Metastore | Recovery focuses on data, not compute; batch jobs restart after disaster; Cloud Storage retry resumes ingestion with little to no loss |
BigQuery suits repeated interactive exploration because cached results and dynamic optimization reduce work on identical queries. Dataflow suits continuous or large parallel pipelines because work distributes across workers and Beam pipelines remain portable to other runners such as Apache Flink or Apache Spark. Ephemeral Spark suits scheduled extract-transform-load where maintaining idle clusters would waste capacity, since only the Cloud Storage data and metastore must survive.
Orchestration, scheduling, and storage separation coordinate batch transforms and interactive analysis into one reliable sequence. Separation of storage and computation means the data storage layer and data computation layer run on different platforms in the same zone and region to reduce latency, transfer cost, and I/O. A common pattern moves storage from Hadoop Distributed File System to Cloud Storage and runs computation on an ephemeral Spark cluster rather than maintaining one long-lived monolithic cluster.
The choice of scheduling tool depends on focus and code type:
| Tool | Focus | Choose when |
|---|---|---|
| Scheduled queries | Straightforward GoogleSQL chains, including data definition and manipulation statements | The work is time-driven with no external dependencies |
| Dataform | Version-controlled SQL transformations in BigQuery | The work transforms raw BigQuery data into tested datasets and tables |
| Workflows | Chaining microservices and HTTP-based operations | The work needs very low-latency service orchestration across systems |
| Managed Service for Apache Airflow | Durable production extract-transform-load and MLOps processes | The work spans BigQuery, training, and external systems with complex dependencies |
Time-driven scheduling starts work on defined intervals and fits recurring loads, scheduled queries, and Dataform runs driven by Cloud Scheduler. Event-driven scheduling starts work when something happens, such as a file arriving in Cloud Storage or a Pub/Sub message arriving, and fits Workflows and Airflow event triggers. A hybrid freshness pattern often combines both in order: first an arrival event triggers ingestion, then a time-driven batch transform consolidates data, and only after that transform succeeds do downstream interactive tables refresh.
Dependencies, cost controls, and workload optimization ensure multi-step sequences run in order, recover without duplication, and minimize bytes and slots consumed. Batch (opens in a new tab) represents each unit of work as a job containing an array of tasks that each run the same sequence of runnables, where a runnable is a script or container. Each Batch job provisions its own regional managed instance group of Compute Engine virtual machines, and the number of machines depends on hardware requirements and task scheduling options.
Dependencies flow from upstream jobs to downstream jobs, so a downstream job does not start until its dependency jobs succeed or fail as configured. Separating low-demand preparation from compute-intensive processing into different jobs reduces cost and quota usage because each job can request different machine types. Automated retries reduce friction for temporary errors, which matters for Spot virtual machines that offer discounts but can be preempted, while timeouts prevent excess run time from creating unexpected cost. Workload optimization further lowers cost by partitioning by ingestion time, date, timestamp, or integer range, clustering on frequently filtered columns, and using materialized views and caching so queries read filtered partitions or precomputed results instead of full scans.
Exam tip: Choose interactive priority when a query must start immediately, and choose batch priority when the query can wait for idle shared resources.
Continue with this study guide: Interactive or batch query jobs
On-demand pricing uses the BigQuery shared resource pool with fixed per-project capacity and charges per TiB of bytes scanned with a 10 MiB minimum per query, capped at 2,000 slots per project. Capacity-based pricing with Editions uses dedicated baseline plus autoscaled slots in an assigned reservation and charges for slot-hours consumed with no charge for bytes processed. On-demand fits variable exploratory work while capacity-based fits enterprise data warehouse, reporting, and extract-load-transform workloads with many concurrent queries.
Use interactive query priority in BigQuery when a query must start immediately because interactive queries execute as soon as possible and are the default priority for low-latency analysis. Use batch query priority when the query can wait for idle shared resources because batch queries queue and start as soon as idle resources are available in the shared pool or reservation. Batch priority also increases effective concurrency because more batch queries can be queued than interactive queries.
A BigQuery reservation is a pool of slots created in an administration project and shared by assigning projects, folders, or organizations to it so assigned queries draw execution resources from the reservation rather than the shared on-demand pool. Child resources inherit a parent folder or organization assignment unless explicitly reassigned, while a None assignment forces those projects or folders to use on-demand pricing. When a workload does not use all of its dedicated slots, BigQuery automatically shares those unused slots with other workloads that need them.
Last updated