BigQuery Cost Control

How to find what is driving BigQuery costs and cap spend before it spikes.

  • Put hard caps in place before tuning queries: caps stop the bill, while tuning only lowers it.
  • Find the source of a spike by querying INFORMATION_SCHEMA.JOBS to see which users, service accounts, and individual queries billed the most bytes (on-demand is about $6.25 per TiB).
  • Common culprits: BI dashboards re-running the same query on every filter change, scheduled queries scanning whole tables hourly, SELECT * on wide tables (LIMIT doesn't reduce bytes scanned), and events_* wildcards with no _TABLE_SUFFIX filter.
  • Set a per-user daily query quota first, since it's the only control that would have stopped the spike; also use maximum bytes billed (failed queries cost nothing) and a project-wide daily quota.
  • Budget alerts only send emails and do not stop spending, so never treat them as a cap.
  • Give dashboards their own service account so quotas on it can't block analysts, and vice versa.
  • The GA4 export link is free; nearly all cost comes from queries against the wide events_* table, so build a small daily sessions/conversions table and point reports at it.
  • Check current pricing before enabling Gemini features: they're billed separately, and AI functions like AI.GENERATE and ML.GENERATE_TEXT incur per-row Vertex AI charges that can exceed the rest of your project's cost.
  • Beyond partitioning and clustering: require partition filters, pre-aggregate with summary tables or materialized views, load incrementally, compare slot-based editions for steady heavy workloads, consider physical storage billing, and set expiration on staging tables.

A single unbounded query or dashboard can run up a large BigQuery bill in hours.

If you want to control BigQuery costs, find what’s driving them and put hard caps in place before you tune a single query. Caps stop the bill. Tuning only lowers it.

Find the Job & User Behind a Spike

On-demand pricing charges for bytes scanned, about $6.25 per TiB in US regions. Every query is logged with who ran it and what it billed:

SELECT
  user_email,
  COUNT(*) AS jobs,
  ROUND(SUM(total_bytes_billed) / POW(1024, 4), 2) AS tib_billed,
  ROUND(SUM(total_bytes_billed) / POW(1024, 4) * 6.25, 2) AS est_cost_usd
FROM `region-us`.INFORMATION_SCHEMA.JOBS
WHERE creation_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 7 DAY)
  AND job_type = 'QUERY'
GROUP BY user_email
ORDER BY tib_billed DESC

Then list the most expensive single queries:

SELECT
  creation_time,
  user_email,
  ROUND(total_bytes_billed / POW(1024, 3), 1) AS gib_billed,
  LEFT(query, 200) AS query_start
FROM `region-us`.INFORMATION_SCHEMA.JOBS
WHERE creation_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 7 DAY)
  AND job_type = 'QUERY'
ORDER BY total_bytes_billed DESC
LIMIT 25

What I usually find:

  • A service account behind a Looker Studio report or BI tool that re-runs the same query on every page view and filter change.
  • A scheduled query that scans a whole table hourly when it only needs yesterday.
  • SELECT * on a wide table. LIMIT doesn’t reduce the bytes scanned.
  • A wildcard over every day of events_* with no _TABLE_SUFFIX filter.

Set Hard Caps

Cap Where What It Does
Maximum bytes billed Query settings, or --maximum_bytes_billed The query fails, at no charge, if it would scan more than the limit.
Query usage per user per day IAM & Admin > Quotas Stops one person or service account after a daily amount.
Query usage per day IAM & Admin > Quotas Stops the whole project after a daily amount.
Budget alerts Billing > Budgets & alerts Emails you. It doesn’t stop anything.
bq query --maximum_bytes_billed=10737418240 --use_legacy_sql=false 'SELECT ...'

Set the per user quota first. It’s the only thing that would have stopped the spike you just found. Give dashboards their own service account so a quota on it can’t block analysts, and the other way around.

A budget alert is not a cap. I’ve seen teams assume it was until the invoice arrived.

What the GA4 Export Costs

The GA4 link to BigQuery is free. What you pay for:

  • Storage. Small for most sites, and it grows every day.
  • Streaming export, if it’s on, billed per GB streamed. The daily export has no ingestion charge.
  • Queries. This is nearly all of the cost. The events table is wide and nested, and a report that reads events_* with no date filter scans your whole history each time.

Build a small daily table of sessions and conversions from the raw export, and point reports at that. I cover this in optimizing slow Looker Studio reports.

Gemini in BigQuery

Gemini features in BigQuery are billed separately from normal queries, and the terms have changed more than once. Two things to check on the current pricing page before turning them on:

  • Which assistive features are included with your edition or on-demand usage, and which are charged.
  • That SQL functions which call a model, like AI.GENERATE and ML.GENERATE_TEXT, are billed as Vertex AI usage per row, on top of the query. Run one across a few million rows and it will cost more than the rest of your project.

Beyond Partitioning & Clustering

At high volume, partitioned and clustered tables are the starting point. What lowers cost after that:

  • Require a partition filter on large tables so a query without a date range fails.
  • Pre-aggregate. Scheduled summary tables or materialized views, so dashboards never read raw rows.
  • Incremental loads. Process only new partitions, not the full table every run.
  • Compare editions. Steady heavy workloads can cost less on slot based capacity than on-demand. Spiky ones usually don’t.
  • Check storage billing. Physical storage billing is cheaper for data that compresses well.
  • Expire what you don’t need. Set table and partition expiration on staging and temporary datasets.

For query level tuning, see optimizing queries to reduce costs in BigQuery and BigQuery cost and speed optimization.

Resume