Free tool · BigQuery and Snowflake
Compare warehouse cost before and after a change
Did the change you shipped cut warehouse spend? What put the bill up? Export your query history once, pick a period before and a period after, and see each period's compute cost, the change in total and per day, and the users, dbt models and dashboards it came from — without an account, a credential, or the file leaving your computer.
What it compares, and what it does not
- Compute that the export prices, in whole UTC days. BigQuery: on-demand
total_bytes_billed, at 6.25 USD per TiB billed by default. Snowflake:credits_attributed_compute, at 3 USD per credit by default. List prices; type your contract rate below. Both periods use the same rate. - Comparable periods only. Both come from one export, so one platform and one account. They may not overlap, the before period comes first, and both lie inside the whole UTC days the export covers: its first and last days are partial and left out.
- Who and what changed. The 5 users, dbt models and dashboards whose cost per day changed most, the rest on one line, and queries with no mark from their tool as unattributed — never guessed.
- Not what the export cannot see, each named as unavailable: BigQuery jobs on a reservation (counted, not priced), Snowflake idle warehouse time (not in QUERY_ATTRIBUTION_HISTORY), and cloud services, storage and data transfer.
1. Export the query history
BigQuery: INFORMATION_SCHEMA.JOBS_BY_PROJECT
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)- Run it in the BigQuery console, in that project. It needs a role with
bigquery.jobs.listAll, such as BigQuery Resource Viewer, and is billed like any other query. - Under the results, choose Save results and then CSV (or Google Drive, for a large result).
- It reads the last 30 days. To reach further back, change
INTERVAL 30 DAY; BigQuery keeps job history for 180 days.
Snowflake: QUERY_ATTRIBUTION_HISTORY with QUERY_HISTORY
SELECT a.query_id, TO_VARCHAR(a.start_time, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZH:TZM') AS start_time, a.user_name, a.warehouse_name, a.warehouse_id, q.query_type, LEFT(q.query_text, 20000) AS query_text, a.query_tag, q.bytes_scanned, a.credits_attributed_compute, q.total_elapsed_time, q.bytes_spilled_to_remote_storage, q.partitions_scanned, q.partitions_total FROM snowflake.account_usage.query_attribution_history a LEFT JOIN snowflake.account_usage.query_history q ON q.query_id = a.query_id AND q.start_time >= DATEADD(day, -31, CURRENT_TIMESTAMP()) WHERE a.start_time >= DATEADD(day, -30, CURRENT_TIMESTAMP())
- Run it in a Snowsight worksheet. It needs ACCOUNTADMIN or the SNOWFLAKE database roles
USAGE_VIEWERandGOVERNANCE_VIEWER, and is billed to the warehouse it runs on. - Download the results as CSV from the results pane.
- It reads the last 30 days. To reach further back, change both
-30and-31; ACCOUNT_USAGE keeps a year.
2. Choose the file
The synthetic example is a made-up BigQuery project over 16 UTC days, with a made-up change on2026-09-08: one dbt model starts a full refresh every night, a dashboard refreshes half as often, and a reservation takes over one nightly job.
3. Choose the two periods
Explain every change as it happens
This is one export, one time. Connected with a read-only account, dwhat reads the history every few hours, adds Snowflake's idle warehouse time from metering, emails you when a day costs much more than usual and names who and what caused it, and builds a monthly report for finance that compares each month with the one before.