dwhat

Free tool · BigQuery on-demand

Audit a BigQuery CSV export, privately, in your browser

Run one query on your project's job history, save the result as CSV and choose the file below. This page works out the last 30 days of on-demand compute cost by user, dbt model and dashboard, the days that spiked, and the 20 most expensive queries with fix hints — without an account, a credential, or the file leaving your computer.

Nothing is uploaded. The file is read by this page's own JavaScript and the audit is drawn in the page; there is no request that sends it anywhere, which your browser's network tab will confirm. Close the tab and it is gone. dwhat counts visits to this page and nothing else.

What it prices, and what it does not

1. Export the job history

Export query
SELECT
  job_id,
  FORMAT_TIMESTAMP('%Y-%m-%dT%H:%M:%E3SZ', creation_time) AS creation_time,
  user_email,
  statement_type,
  SUBSTR(query, 1, 20000) AS query,
  TO_JSON_STRING(labels) AS labels,
  total_bytes_billed,
  total_bytes_processed,
  total_slot_ms,
  TIMESTAMP_DIFF(end_time, start_time, MILLISECOND) AS elapsed_ms,
  cache_hit,
  reservation_id
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 IFNULL(statement_type, '') != 'SCRIPT'
  AND (IFNULL(total_bytes_billed, 0) > 0 OR IFNULL(total_slot_ms, 0) > 0)
  1. Run it in the BigQuery console, in that project. It reads INFORMATION_SCHEMA.JOBS_BY_PROJECT, which needs a role with bigquery.jobs.listAll on the project, such as BigQuery Resource Viewer. It is a query like any other, billed to the project.
  2. Under the results, choose Save results and then CSV. If the console says the result is too large for a local file, save it to Google Drive as CSV and download it from there.
  3. One project and one region per export. Run it again for another region.

2. Choose the file

An export made with the query on /audit works too, but it has no reservation_id column.

Keep it up to date

This is one export, one time. Connected with a read-only account, dwhat reads the history every few hours, works for Snowflake too, emails you when a day costs much more than usual, and builds a monthly report for finance.

Connect a read-only account for a free auditSee a sample audit first