dwhat

Free tool · BigQuery cost guardrail

BigQuery maximum bytes billed: a per-query cost guardrail

Decide what one query may cost, and get the byte ceiling that enforces it — with the bq query flag and the Python client setting to paste into your code or a code review.

Nothing you type leaves this page. The ceiling is worked out by this page's JavaScript; it is not sent, stored or put in the address. No account, no credentials and no SQL is run.

What maximum bytes billed does

On on-demand pricing BigQuery charges for the bytes a query processes, per TiB (binary: 1 TiB = 240bytes). The maximum bytes billed setting puts a ceiling on one query: if the query would bill more bytes than the limit, it fails without incurring a charge. A budget per query is therefore a byte count — the budget divided by your price per TiB.

BigQuery bills at least 10 MB per query and per table it references, and rounds up to the nearest MB, so a ceiling must leave room for that. On a capacity (slot) reservation you pay for slots, not bytes, and a byte ceiling does not cap that cost. To limit what a whole day of queries can process for a project or a user, Google offers custom quotas instead.

Google's documentation, checked on 2026-10-31:limit query costs by restricting the number of bytes billed,BigQuery pricing,bq query andQueryJobConfig.

1. Enter a budget for one query

Prefilled with one made-up example: a fictional analyst allows one ad-hoc query 2.50 USD at 6.25 USD per TiB.

6.25 is an example: Google's US on-demand list price on 2026-10-31.

2. The byte ceiling

3. Apply it to a query

Both examples run a dry run first, which reports what the query would process without running it, then run the query with the ceiling. The SQL and names are placeholders.

Replace the placeholders

Keep the ceiling as a whole number of bytes. In bq, keep the SQL inside single quotes so the shell leaves the backticks alone, and --use_legacy_sql=false for GoogleSQL. The Python needs thegoogle-cloud-bigquery package and credentials that can run queries in the project.

Check that it works

  1. Run the dry run first. It reports the bytes the query would process without running it; if that is more than the ceiling, expect the real run to be refused.
  2. Run the query with the ceiling. A query that would bill more than the limit fails with an error about the bytes billed limit, and Google does not charge for it.
  3. When it succeeds, compare its bytes billed with the ceiling: total_bytes_billed on the Python job, or the total_bytes_billed column for its job_id in INFORMATION_SCHEMA.JOBS_BY_PROJECT.
  4. To see a refusal on purpose, set the ceiling below the dry run's figure (but at 10 MiB or more) and run it again: it should fail without billing anything.

What this calculator assumes and leaves out

Know the workload behind the limit

A ceiling stops one expensive query; it does not say which queries need one. dwhat's audit reads your BigQuery query history and estimates on-demand compute by day, user, dbt model and dashboard, with the most expensive queries and what they billed — the figures to set these limits from.

Connect a read-only account for a free auditOr audit a CSV export in your browser

Related guides