BigQuery capacity commitments are essentially pre-purchased slots, allowing you to reserve compute resources for your data warehousing needs, and they often end up being cheaper than on-demand pricing for heavy users.

Let’s see this in action. Imagine you have a data pipeline that runs a set of complex analytical queries every hour. On-demand pricing means BigQuery charges you per terabyte scanned. If your queries scan a lot of data, this can add up quickly.

Here’s a sample query that might be part of such a pipeline:

SELECT
    region,
    SUM(sales_amount) AS total_sales
FROM
    `your_project.your_dataset.sales_data`
WHERE
    sale_date BETWEEN '2023-10-01' AND '2023-10-31'
GROUP BY
    region
ORDER BY
    total_sales DESC;

If this query scans 5TB of data and runs daily, that’s 150TB per month. At the standard on-demand price of $6.25 per TB, you’re looking at $937.50 per month for just this one query.

This is where Capacity Commitments shine. Instead of paying per TB scanned, you commit to a certain number of "slots" – the computational units that execute your queries. You can choose between a 1-year or 3-year commitment, with the longer commitments offering deeper discounts.

For a workload like the one above, you’d likely need a relatively small commitment. BigQuery offers different slot capacities. Let’s say you determine you need 100 slots to handle your hourly workload without contention.

You can purchase a 1-year commitment for 100 slots. The pricing varies, but let’s assume for demonstration that 100 slots for a 1-year commitment costs $1,500 per month.

The Mental Model:

Think of BigQuery’s on-demand model as a pay-as-you-go taxi service. You pay for each trip (each query) based on the distance (data scanned). It’s flexible, but if you take many trips, it gets expensive.

Capacity Commitments are like leasing a fleet of taxis. You pay a fixed monthly fee for the vehicles (slots), regardless of how many miles they drive (how much data they process). This is more predictable and cost-effective if you have consistent, heavy usage.

How it Works Internally:

When you purchase capacity commitments, BigQuery reserves dedicated processing units for your project. These slots are then available to execute your queries. The BigQuery query engine assigns your queries to these available slots. The key is that your queries don’t incur per-TB scanning costs; they consume the committed slots.

The number of slots you need depends on several factors:

  • Query Complexity: More complex queries (joins, aggregations on large datasets) consume more slots.
  • Data Size: While you’re not charged per TB scanned, larger datasets might still require more slot-time to process.
  • Concurrency: How many queries are running simultaneously?
  • SLA/Performance Requirements: Do you need queries to finish within seconds, or are minutes acceptable?

You can monitor your slot utilization in the BigQuery console under "Capacity" -> "Reservations." This dashboard shows you how many slots you’ve purchased, how many are in use, and your average utilization.

Levers You Control:

  1. Commitment Term: Choose between annual or multi-year commitments for better pricing.
  2. Slot Quantity: Purchase the number of slots that best matches your workload. This is the most critical lever for cost optimization.
  3. Reservations: You can create reservations to assign specific slots to particular projects or folders, ensuring that critical workloads have dedicated resources. This is also useful for cost allocation and isolation.

The BigQuery slot autoscaler can dynamically adjust the number of slots available to your project based on real-time demand, but capacity commitments provide a baseline of guaranteed performance and cost predictability.

One crucial aspect often overlooked is how slot contention can impact performance even with commitments. If your workload spikes unexpectedly and you haven’t allocated enough slots, queries will queue up, leading to increased latency. This is why understanding your peak demand is vital when deciding on the number of slots to commit to. Monitoring historical slot usage patterns is key to right-sizing your commitment.

After optimizing your slot commitments, the next logical step is to explore query optimization techniques to reduce the actual slot-time your queries consume.

Want structured learning?

Take the full Bigquery course →