Skip to main content
BigQuery jobs is in beta.
The GCP billing export shows BigQuery compute as one Analysis line, billed per TiB scanned on demand, plus a separate reservation line if you buy slots. Neither line says who ran the queries, which SQL they ran, or how much slot time they used. reads job metadata from the projects you grant and attaches it to those billing lines. Costory then reallocates slot cost to the user who actually ran the job. On-demand Analysis and reservation spend sit in the same view, grouped by cos_query_user, statement, or destination table. This is a different connector from BigQuery. That page queries any table live as an external metric. This page attaches jobs to the GCP bill. Use this when you need to:
  • See all BigQuery compute in a single view: on-demand and slots, attributed to the person or service account that ran the query
  • Attribute cost to a user, service account, statement type, or destination table
  • Build such as cost per query, cost per TiB billed, or slot-hours per TiB
  • See spend on failed or stopped queries
  • Estimate on-demand vs Editions slots per workload
  • Ask Costory Agent why a query used too many slots, from the SQL and the expensive stages

Key terms used in this article

  • Analysis: the GCP billing SKU for on-demand BigQuery compute.
  • BigQuery jobs enrichment: job metadata attached to those billing lines, including slot reallocation to the user who ran the job.
  • Unlabelled: cost with cos_query_user empty, usually a project Costory cannot list jobs on.
  • : slot-hours per TiB billed.
See the Glossary for a full list of terms.

Prerequisites

  • A GCP billing export already connected to Costory.
  • Admin access in Costory.
  • Permission to grant IAM on every GCP project that runs queries, not only the billing-export project.

Connect BigQuery jobs

1

Open BigQuery jobs

Go to Integrations, click + Add integration, then under External metric choose GCP. On Choose what to connect, pick BigQuery jobs. The connect URL is /integration/new/gcp/bigquery-jobs. You need to be an admin.
2

Grant job access on every query project

Copy the Service account from the connect screen. Grant BigQuery Resource Viewer (roles/bigquery.resourceViewer) on every project that runs queries, so Costory can list all jobs (bigquery.jobs.listAll). Access on the billing-export dataset is not enough.Run the command shown on the page, or paste this and replace the placeholders:
Repeat for each project that submits jobs. A project without this grant still has cost, and that cost shows up as Unlabelled.
3

Enter connection details

Set Connection name and GCP project ID. Click Validate, then Save connection. Save connection stays disabled until validation succeeds.
4

Group cost by user in Explorer

After the next billing refresh, open Explorer, filter to BigQuery, and group by cos_query_user. On-demand Analysis and reallocated slot cost appear in the same query. Add usage metrics such as query_count or query_compute_ms in Advanced Explorer.
BigQuery keeps job history for 180 days. Costory starts attaching jobs from the moment you connect. There is no older backfill from Google.

What Costory adds

Dimensions

These fields follow Standard Columns naming (cos_*). They are attached by this connector. They are not in the raw GCP billing export.

Usage metrics

On-demand and slots in one view

GCP bills slots as a reservation line, not per query. Costory reallocates that spend onto the user who ran the job, using query_compute_ms. The same cos_query_* dimensions then apply to on-demand Analysis and to slot cost. Group by cos_query_user (or statement, destination table, workload) and you get a single view of all your BigQuery compute: who ran it, what they ran, and whether it was paid per TiB or from the reservation. That is the point of connecting jobs even if you already buy Editions slots. The invoice stays lumped. Explorer shows the people and pipelines that consumed the slots.

Compare on-demand with Editions

If you are still on demand and want a slots estimate per workload:
Use 25 slots of overhead per job as the central fluid-autoscaling estimate, or 50 as a worst case. price_per_slot_hour is the list pay-as-you-go Editions price for your region. Edit it per customer. It is not a Costory default. Subtract that estimate from on-demand Analysis cost to see whether a workload would be cheaper on slots.
Always filter cos_query_user != null before you compare on-demand with slots. Unlabelled cost has no slot time, so the estimate looks like 100% savings.

Job drill-down and Costory Agent

Open a job by id (project:location.job_id) to see its SQL text, the tables it referenced, and the stages that used the most slots. That is what lets Costory Agent suggest performance work. Ask Costory in the app, or any assistant on Costory MCP, to inspect a heavy job. The agent reads the SQL and the slot-heavy stages, then explains why the query used too many slots (full table scans, exploding joins, missing filters, script children) and can suggest a rewrite.
Try: “This job my-project:EU.bquxjob_xxx used too many slots. Show the SQL, the stages with the most slot-ms, and suggest how to reduce slot time.”

What you can build

  • One Explorer view of on-demand and slot cost, grouped by the user who ran the query.
  • Cost per user, service account, statement type, or destination table on the cos_query_* fields.
  • Unit metrics in Explorer formulas: cost per query (cost / query_count), cost per TiB billed, and slot-hours per TiB (compute intensity).
  • Spend on failed or stopped queries by filtering cos_query_error.
  • A coverage KPI: cost where cos_query_user is set, divided by total BigQuery compute. Connected orgs often sit in the mid-90s.
  • A on cos_query_target (or other job fields) to group jobs into workloads, for example by destination-table name patterns.
A BigQuery Enriched Support dashboard template will package these views. Until it is in the template library, start from Explorer and save the widgets you need.

Pitfalls

Troubleshooting

GCP Billing Setup

Connect Detailed Usage Cost export before you attach jobs.

BigQuery (tables)

Query any BigQuery table live. Different connector.

BigQuery and dbt visibility

Label dbt models, then use jobs for per-query cost.

Costory MCP

Ask Costory Agent why a job used too many slots.

Virtual dimensions

Group jobs into workloads from destination tables.

Unit Economics

Cost per query, cost per TiB, slot-hours per TiB.
Last modified on October 21, 2026