Skip to main content

Google BigQuery: A Practical Guide to Paying Per Query

How the serverless warehouse bills you, and the partitioning, dry-run and access habits that make it fast and cheap

Updated 10 min readMarkdown
Google BigQuery: A Practical Guide to Paying Per Query

You want a quick look at a large events table, so you type the query everyone types:

SELECT * FROM analytics.events LIMIT 10;

Ten rows come back in two seconds. What you may not notice is the small line saying how much data the query processed: the whole table, every column, all of it. On BigQuery's default pricing you were just billed for reading the entire table to look at ten rows.

That one surprise explains how to use BigQuery well. There are no servers to size and nothing to switch off at night. Instead, each query has a price, and the price depends on how much data it touches. Learn to see that number before you run a query and BigQuery becomes one of the easiest warehouses to live with.

What BigQuery is

BigQuery is Google Cloud's serverless data warehouse. Serverless here means there is no cluster that belongs to you. You send SQL, Google runs it across a large shared pool of machines, and you get the answer.

The names you will meet:

Term Meaning
Project The billing and permission boundary in Google Cloud
Dataset A container for tables, like a schema. It has a fixed location (for example US or EU)
Table Columnar storage. You refer to it as project.dataset.table
Job One unit of work: a query, a load, an export
Slot A unit of compute that BigQuery uses to run jobs

The SQL dialect is called GoogleSQL. It is standard SQL with good support for arrays and nested records.

Why teams choose it

  • Nothing to run. No warehouse to start, resize or suspend. An idle project costs only its storage.
  • It scales without you. A query over a few megabytes and one over many terabytes are written the same way.
  • Nested data is natural. A row can hold an array of records, so an order and its line items can live in one table without a join.
  • It sits inside Google's world. Google Analytics 4, Google Ads and Firebase can export straight into BigQuery, and Looker Studio and Sheets read from it.
  • Machine learning in SQL. BigQuery ML lets you train and use common models with CREATE MODEL statements.

Where BigQuery fits, and where it does not

A strong choice for:

  • Product and marketing analytics, especially with Google Analytics data
  • Occasional heavy questions over large data, with long quiet periods in between
  • Small teams with no one to operate a warehouse
  • Log and event analysis
  • Companies already on Google Cloud

Look elsewhere when:

  • You need an application database. Each query has a noticeable start-up time, and frequent single-row updates are not what it is built for. Use PostgreSQL or MySQL, and copy data across for analysis.
  • Many dashboards refresh all day over unpartitioned data. Per-query billing punishes that pattern. Fix the tables first, or look at capacity pricing.
  • Your data and applications live in AWS or Azure. Moving data between clouds costs money and time. Redshift, Athena or Snowflake in your own cloud may be simpler.
  • You want one predictable monthly figure from day one. A warehouse you size yourself (Snowflake, Redshift) or BigQuery's capacity model is easier to forecast than on-demand queries.

How the pricing shapes your habits

BigQuery charges separately for storage and for queries.

Queries have two models:

  • On-demand, the default. You pay for the bytes each query processes. Compute time does not matter; data read does.
  • Capacity (BigQuery editions). You pay for slots over time, with autoscaling, and queries no longer have a per-byte price. This suits steady, heavy use.

Storage is charged by the amount stored. A table or partition that has not been modified for 90 days moves to a cheaper long-term rate on its own, with no change in speed.

Several things cost nothing: loading data with batch load jobs, queries answered from the 24-hour result cache, queries that fail, and previewing a table. Streaming rows in one at a time is billed.

Under on-demand pricing, three facts decide your bill:

  1. BigQuery is a column store. You are charged for every column you name, in full, unless something lets it skip rows.
  2. LIMIT does not reduce the data read on an ordinary table.
  3. Partitioning and clustering are what let BigQuery skip data.

Using it the right way

Ask the price before you run

A dry run validates the query and reports how many bytes it would process, without running it or charging you:

bq query --use_legacy_sql=false --dry_run \
  'SELECT customer_id, total FROM shop.orders WHERE created_at >= "2026-03-01"'

The BigQuery console shows the same estimate in the corner of the editor as you type. Read it every time.

Set a hard limit

bq query --use_legacy_sql=false --maximum_bytes_billed=1000000000 \
  'SELECT customer_id, total FROM shop.orders WHERE created_at >= "2026-03-01"'

If the query would process more than that many bytes (here about 1 GB), it fails before doing any work and you are not charged. For a whole team, an administrator can set custom quotas for query usage per day, per project and per user.

Partition and cluster your big tables

CREATE TABLE shop.orders (
  order_id    INT64 NOT NULL,
  customer_id INT64 NOT NULL,
  status      STRING,
  total       NUMERIC,
  created_at  TIMESTAMP NOT NULL
)
PARTITION BY DATE(created_at)
CLUSTER BY customer_id
OPTIONS (
  require_partition_filter = TRUE,
  partition_expiration_days = 730
);

What each part buys you:

  • PARTITION BY splits the table by day. A query for March reads only March.
  • CLUSTER BY sorts the data inside each partition by customer_id, so filters on that column skip blocks.
  • require_partition_filter rejects any query that forgets to filter on the date. It turns the most expensive mistake into an error message.
  • partition_expiration_days deletes old partitions for you.

Filter on the partition column directly so pruning works:

SELECT customer_id, SUM(total) AS revenue
FROM shop.orders
WHERE created_at >= TIMESTAMP('2026-03-01')
  AND created_at <  TIMESTAMP('2026-04-01')
GROUP BY customer_id;

Name your columns

SELECT * is the costly habit. Name what you need, or drop the wide columns:

SELECT * EXCEPT (raw_payload, user_agent)
FROM analytics.events
WHERE event_date = '2026-03-01';

To look at a few rows, use the Preview tab in the console or bq head -n 10 shop.orders. Both are free.

Use arrays and structs

CREATE TABLE shop.orders_nested (
  order_id   INT64,
  created_at TIMESTAMP,
  items      ARRAY<STRUCT<sku STRING, qty INT64, price NUMERIC>>
);

SELECT o.order_id, item.sku, item.qty * item.price AS line_total
FROM shop.orders_nested AS o, UNNEST(o.items) AS item;

UNNEST turns the array into rows. Keeping related records together often replaces a large join, which makes queries both faster and cheaper.

Load in batches

bq load --source_format=PARQUET shop.orders "gs://my-bucket/orders/*.parquet"

Batch loads from Cloud Storage are free and are the right default. Reach for streaming only when you truly need rows visible within seconds.

Go back in time

BigQuery keeps a history of each table, seven days by default:

SELECT *
FROM shop.orders
  FOR SYSTEM_TIME AS OF TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR)
WHERE created_at >= TIMESTAMP('2026-03-01');

That is your first resort after a bad UPDATE or DELETE.

See who spent what

SELECT user_email,
       COUNT(*) AS queries,
       ROUND(SUM(total_bytes_billed) / POW(1024, 4), 2) AS tib_billed
FROM `region-us`.INFORMATION_SCHEMA.JOBS
WHERE creation_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 7 DAY)
  AND job_type = 'QUERY'
GROUP BY user_email
ORDER BY tib_billed DESC;

Change region-us to match your data's location. You need permission to list all jobs in the project.

Give tools a narrow service account

A service account is a non-human identity for a program. For a reporting tool, give it the right to run queries and the right to read one dataset, and nothing more:

gcloud iam service-accounts create bq-reader --display-name="BigQuery read only"

gcloud projects add-iam-policy-binding my-project \
  --member="serviceAccount:bq-reader@my-project.iam.gserviceaccount.com" \
  --role="roles/bigquery.jobUser"

gcloud iam service-accounts keys create bq-reader.json \
  --iam-account=bq-reader@my-project.iam.gserviceaccount.com

Then grant read access on the dataset from SQL:

GRANT `roles/bigquery.dataViewer`
ON SCHEMA shop
TO "serviceAccount:bq-reader@my-project.iam.gserviceaccount.com";

The key file is a password. Store it like one, and delete keys you no longer use.

Common mistakes

  • SELECT * to explore. Use the free preview.
  • Believing LIMIT saves money. It limits the rows returned, not the data read.
  • Big tables without partitions. Every query then reads all history.
  • Wrapping the partition column in a function. It can stop pruning. Compare the raw column to constants.
  • Datasets in different locations. A query cannot join a US dataset with an EU one. Pick a location once and keep to it.
  • Thousands of single-row DML statements. Batch changes, or load into a staging table and MERGE.
  • Trusting keys. Primary and foreign keys can be declared but are not enforced. Check for duplicates yourself.
  • Sharing one powerful service account everywhere. One leaked key then opens the whole project.
  • Staying on on-demand out of habit. Once usage is steady and heavy, compare it with capacity pricing.

Quick reference

Task Command
Estimate a query bq query --use_legacy_sql=false --dry_run '...'
Cap a query --maximum_bytes_billed=1000000000
Preview rows for free bq head -n 10 shop.orders
List datasets bq ls
List tables bq ls shop
Show a table's schema bq show --schema --format=prettyjson shop.orders
Table sizes SELECT table_id, row_count, size_bytes FROM `shop.__TABLES__`;
Columns of a table SELECT column_name, data_type FROM shop.INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'orders';
Load a file bq load --source_format=PARQUET shop.orders "gs://bucket/path/*.parquet"

In BigQuery the query is the unit of cost. Partition the big tables, name your columns, look at the estimate, and the bill follows the value you get.

Exploring BigQuery with CreamDB

The BigQuery console is the best place for cost estimates. When you want BigQuery next to your other databases, or want to ask questions in plain English, CreamDB connects to it from a browser tab with nothing to install.

  • Connect with a project ID, an optional default dataset and the pasted contents of a service-account JSON key. The key is stored encrypted. A read-only account like the one above is the right choice.
  • Browse datasets, tables (with row counts), views and columns in a tree.
  • Write SQL in an editor with autocomplete, formatting and history, and export results to CSV, JSON or Excel.
  • Ask a question such as "sessions per day by country last month" and get the SQL, a result table and a chart.

The assistant only reads on its own, and any change waits as an approval card that you answer.

Two honest limits. CreamDB does not show a cost estimate before a query runs, so keep partition filters required on large tables. And queries are currently sent to the US multi-region, so datasets stored elsewhere may not answer. It is free to start.

About the author

  • CreamDB is a web-based database explorer with an AI assistant. Connect your databases, ask questions in plain English and get answers, tables and charts from any browser. Product news and tips here.

Running SELECT * ... LIMIT 10 and still getting billed for scanning every column across the whole table is the classic BigQuery wake-up call. Pairing dry-run byte checks with strict partitioning and narrow service accounts saves teams from nasty end-of-month surprises.