BigQuery FinOps Query Pack

Which BigQuery queries cost me the most last month?

Rank the last 30 days of queries by bytes billed, with the on-demand dollar cost for each.

Free to run — INFORMATION_SCHEMA scans no billable bytesChecked 4 Aug 2026

JOBS and TABLE_STORAGE are region-scoped.

-- Top queries by on-demand cost, last 30 days.
-- Change 6.25 to your region's per-TiB rate if you are not in US/EU.
SELECT
  job_id,
  user_email,
  DATE(creation_time)                                   AS run_date,
  total_bytes_billed,
  ROUND(total_bytes_billed / POW(1024, 4), 3)           AS tib_billed,
  ROUND(total_bytes_billed / POW(1024, 4) * 6.25, 2)    AS est_on_demand_usd,
  TIMESTAMP_DIFF(end_time, start_time, SECOND)          AS runtime_seconds,
  cache_hit,
  SUBSTR(REGEXP_REPLACE(query, r'\s+', ' '), 0, 300)    AS query_preview
FROM `region-us`.INFORMATION_SCHEMA.JOBS_BY_PROJECT
WHERE creation_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
  AND job_type = 'QUERY'
  AND state = 'DONE'
  AND error_result IS NULL
ORDER BY total_bytes_billed DESC
LIMIT 50;

What it returns

total_bytes_billed
What you are charged for, which is not the same as bytes processed.
est_on_demand_usd
Bytes billed × your regional per-TiB rate.
cache_hit
TRUE means this run was free — it served from cache.
query_preview
First 300 characters, whitespace collapsed, so the grid stays readable.

How to read it

  • Sort by cost, but act on repetition. One 8 TiB query is a bad afternoon; a 200 GiB query on an hourly schedule is $1,100 a month and nobody has noticed it.
  • If you have a reservation, this dollar figure is hypothetical — under Editions you pay for slot-time, not bytes. Use the slot-time ranking instead.
  • Rows with cache_hit = TRUE cost nothing. If a large query shows up repeatedly with cache_hit = FALSE, something is defeating the cache — usually a non-deterministic function like CURRENT_TIMESTAMP() in the query text.

Variants

Organization-wide
Swap JOBS_BY_PROJECT for JOBS_BY_ORGANIZATION. Needs org-level permissions.
Group by query shape
GROUP BY the query text with literals stripped to find the repeated offenders rather than single runs.

Take it further

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.