Request a demo

Glossary · Cost and FinOps

What is unit cost?

Unit cost is data platform spend divided by a unit of output or value, such as cost per data product, per pipeline run, per query or per TiB processed. It shows whether each unit gets cheaper as the platform grows, which a monthly total cannot.

Also called: unit cost of data, cost per data product, cost per query, cost per TiB, unit economics, cost per pipeline run

Why unit cost beats the monthly total

A growing business should expect a growing data bill. What matters is whether each unit of work or value costs less or more than last quarter. A bill that grows slower than order volume is a success; a flat bill while usage shrinks is not. Totals hide both cases, unit costs show them, and they give teams a target they can influence.

Common units

Unit Numerator Denominator Useful for
Cost per TiB processed Compute spend TiB processed Comparing on-demand with editions
Cost per query or job Cost of the job 1 Finding the expensive queries
Cost per pipeline run Cost of a DAG run or dbt invocation Runs Deciding refresh frequency
Cost per data product Build, storage and serving cost Month Prioritizing and pricing products
Cost per read Data product cost Read queries or readers Finding products nobody uses
Cost per business unit Platform spend Orders, customers, transactions Reporting to finance

On on-demand pricing, cost per TiB is the list price ($6.25 per TiB in the US multi-region, see BigQuery pricing). On editions it is slot spend divided by TiB processed, and it varies by workload: scan-heavy queries that need little compute can cost less per TiB on slots, while compute-heavy queries over small tables can cost less on-demand. The pricing calculator compares both for a workload.

Example: monthly unit cost of a data product

This query prices the sales_mart data product for an on-demand project, using US list prices for on-demand compute and logical storage:

WITH build AS (
  SELECT SUM(total_bytes_billed) / POW(1024, 4) * 6.25 AS build_usd
  FROM `region-us`.INFORMATION_SCHEMA.JOBS
  WHERE creation_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
    AND destination_table.dataset_id = 'sales_mart'
    AND statement_type != 'SCRIPT'
),
storage AS (
  SELECT SUM(active_logical_bytes / POW(1024, 3) * 0.02
    + long_term_logical_bytes / POW(1024, 3) * 0.01) AS storage_usd
  FROM `region-us`.INFORMATION_SCHEMA.TABLE_STORAGE
  WHERE table_schema = 'sales_mart'
),
reads AS (
  SELECT
    COUNT(DISTINCT j.job_id) AS read_queries,
    COUNT(DISTINCT j.user_email) AS readers
  FROM `region-us`.INFORMATION_SCHEMA.JOBS AS j, UNNEST(j.referenced_tables) AS t
  WHERE j.creation_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
    AND t.dataset_id = 'sales_mart'
    AND j.destination_table.dataset_id IS DISTINCT FROM 'sales_mart'
)
SELECT
  ROUND(build_usd, 2) AS build_usd,
  ROUND(storage_usd, 2) AS storage_usd,
  read_queries,
  readers,
  ROUND(SAFE_DIVIDE(build_usd + storage_usd, read_queries), 2) AS usd_per_read_query
FROM build, storage, reads;

Build cost comes from jobs that write into the dataset, storage from a snapshot of its tables priced per month, and reads from queries that reference its tables but don't write back into it, so a model rebuilding itself is not counted as a consumer. Replace the prices with your own rates, and swap the build CTE for slot-hours if the project runs in a reservation.

Pitfalls

  • Consumed versus billed capacity. On editions you pay for allocated slots: baseline slots whether busy or idle, and autoscaled slots added in steps of 50, billed per second with a one-minute minimum unless fluid scaling is on. Unit costs built from total_slot_ms add up to less than the invoice; scale them by billed over consumed slot-hours from the billing export.
  • Undercounted reads. referenced_tables is empty for cache hits, and reads through the Storage Read API are not query jobs at all.
  • Shared upstream tables. A staging table used by several products needs an allocation rule: split by reads, or keep it as platform cost.
  • List prices. Negotiated discounts, commitments and the free tier change the real rate; calibrate against the billing export.

Masthead lets teams define data products and shows each one's unit cost and usage over time (data products).

FAQ

How do I calculate the cost of a BigQuery query?

For on-demand pricing, divide total_bytes_billed from INFORMATION_SCHEMA.JOBS by 1024^4 to get TiB and multiply by your price per TiB. For editions, total_slot_ms / 3,600,000 times your slot-hour price gives the consumed cost, which understates the bill because idle baseline and autoscaler overhead are charged too.

Which unit should a data team track?

Track one engineering unit and one business unit. Cost per TiB processed or per pipeline run shows technical efficiency; cost per data product, per active dashboard or per thousand orders shows whether the spend is worth it.

Read next

Browse the full glossary

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.