Request a demo

BigQuery cost query · Where the money goes

BigQuery cost by project across the organization

This query ranks every project in the organization by bytes billed, on-demand cost estimate and slot-hours over the last 30 days, from one INFORMATION_SCHEMA view. It is the starting point for showback: which teams and products spend what.

Runs on INFORMATION_SCHEMA metadata only · Columns checked against the Google Cloud docs in November 2026

The query

SELECT
  project_id,
  COUNT(*)                                                AS queries,
  COUNT(DISTINCT user_email)                              AS principals,
  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) / 3600000, 1)                  AS slot_hours
FROM `region-us`.INFORMATION_SCHEMA.JOBS_BY_ORGANIZATION
WHERE creation_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
  AND job_type = 'QUERY'
  AND statement_type != 'SCRIPT'
GROUP BY project_id
ORDER BY est_on_demand_usd DESC;

How it works

JOBS_BY_ORGANIZATION holds the jobs of every project in the organization for the region, so one query covers the whole estate. Jobs are attributed to the project they ran in, which is also the project that pays for on-demand queries, even when the data lives in another project.

Compare est_on_demand_usd with slot_hours per project: projects that scan a lot per slot-hour are candidates for an editions reservation, the others for staying on-demand. On-demand vs editions does that comparison.

Output columns

ColumnMeaning
principalsDistinct users and service accounts that ran queries in the project.
est_on_demand_usdOn-demand list price of the bytes billed in the project.
slot_hoursSlot time used in the project.

Permissions and notes

Needs: bigquery.jobs.listAll on the organization, for example the BigQuery Resource Viewer role (roles/bigquery.resourceViewer) granted at the organization level.

  • The 6.25 is the on-demand list price per TiB in the US and EU multi-regions. If your projects run on editions, cost follows slot-hours instead: multiply slot_hours by your edition's price per slot-hour (see BigQuery pricing).
  • statement_type != 'SCRIPT' drops the parent row of multi-statement queries. The parent repeats the bytes and slots of its child statements, so keeping it would count them twice.
  • Replace region-us with the location your jobs run in (region-eu, region-europe-west2, ...). Each region has its own INFORMATION_SCHEMA views, so a multi-region estate needs one query per region.
  • Without organization-level access, run the same query against JOBS in each project.

FAQ

Which project pays for a query that reads tables in another project?

The project the job runs in. On-demand bytes are billed to the project that runs the query, not to the project that owns the data.

Does this include storage?

No, this is compute only. Storage cost per project comes from TABLE_STORAGE: see storage cost by table.

All BigQuery cost queries · Data FinOps playbook · Pricing calculator

Cut BigQuery spend without guessing

Masthead attributes compute and storage cost to every project, user, pipeline and table, finds unused and dead-end tables, and shows where editions or on-demand pricing is cheaper. Mnemonic cut its BigQuery compute cost by 20% within 24 hours of onboarding.