Estimate what a query costs before you run it
This recipe tells you what already happened. The analyzer takes a query you have not run yet and estimates what it will scan, in your browser.
Who is spending the most in BigQuery?
Cost by user and service account over the last 30 days.
Reads metadata only, a fraction of a cent to run (10 MB minimum)Reviewed against Google’s docs, 23 Oct 2026
Permissions. Needs bigquery.jobs.listAll on the project for JOBS (BigQuery Resource Viewer has it); bigquery.jobs.create to run any query (BigQuery Job User has it).
Pick the region your data is in: every INFORMATION_SCHEMA view here is qualified by region.
-- Spend by principal. Service accounts usually dominate; that is fine,
-- what matters is which ones, and whether their cost fits what they produce.
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_on_demand_usd,
ROUND(SUM(total_slot_ms) / 1000 / 3600, 1) AS slot_hours,
ROUND(COUNTIF(cache_hit) / COUNT(*), 3) AS cache_hit_rate
FROM `region-us`.INFORMATION_SCHEMA.JOBS_BY_PROJECT
WHERE creation_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
AND job_type = 'QUERY'
AND IFNULL(statement_type, '') != 'SCRIPT'
AND state = 'DONE'
GROUP BY user_email
ORDER BY est_on_demand_usd DESC;What it returns
- user_email
- Human user or service account that submitted the job.
- cache_hit_rate
- Fraction of that principal's jobs served from cache.
How to read it
- Publish this, do not weaponise it. The reliable outcome of a cost leaderboard used for blame is that people stop using BigQuery, which is more expensive than the queries were.
- A service account at the top is normal; it is a pipeline. The question is whether the pipeline's cost is proportionate to what it produces.
- A near-zero cache_hit_rate on an interactive user often means a BI tool that appends a timestamp to every query.
- est_on_demand_usd prices every job at $6.25/TiB. Jobs that ran on a reservation are not billed for bytes (Google calls their total_bytes_billed "informational only"), so for them the dollar figure is hypothetical and slot_hours is what they cost.
Run this once, or have it run every day.
Finitizer evaluates this class of question continuously against your live BigQuery estate, tracks how each number moves between runs, and turns findings into assigned tasks. Read-only and keyless.
See how Finitizer works