Request a demo

GA4 in BigQuery · Cost and performance

Make GA4 BigQuery queries cheaper: _TABLE_SUFFIX, columns, maximum bytes billed

On-demand BigQuery bills the columns a query reads in every table it touches. For the GA4 export, filter _TABLE_SUFFIX with a constant range, select only the columns you need, keep event_params and items out unless required, and set maximum_bytes_billed. On the sample, that cuts one query from 3.34 GiB to 18.5 MiB.

Runs on Google's public sample bigquery-public-data.ga4_obfuscated_sample_ecommerce · Scans 18.5 MiB, under $0.01 on-demand · Checked in November 2026

The query

-- Daily users and page views for one week: three columns, seven tables
SELECT
  event_date,
  COUNT(DISTINCT user_pseudo_id)    AS users,
  COUNTIF(event_name = 'page_view') AS page_views
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20201201' AND '20201207'
GROUP BY event_date
ORDER BY event_date;

How it works

Under on-demand pricing, a query costs the bytes of every column it references, in every table it reads, regardless of how many rows come back. Two things decide the bill for the GA4 export: which daily tables the wildcard events_* matches, and which columns you name. The query above reads three small columns from seven tables: 19,414,713 bytes (18.5 MiB). SELECT * FROM events_* WHERE event_date BETWEEN '20201201' AND '20201207' LIMIT 1000 returns a similar week and reads 3,583,657,854 bytes (3.34 GiB), about 185 times more.

Tables: filter _TABLE_SUFFIX, not event_date. The export is date-sharded, so BigQuery skips tables only when _TABLE_SUFFIX is compared with a constant expression. On the sample, SELECT * for one day costs 61.9 MiB with _TABLE_SUFFIX = '20201201' and the full 3.34 GiB with event_date = '20201201': the event_date filter is applied after every table has been read. Expressions that BigQuery can evaluate before reading data still prune: PARSE_DATE('%Y%m%d', _TABLE_SUFFIX) BETWEEN ... and a range built from a script variable measured exactly the same as a literal range, and a rolling range built with FORMAT_DATE on CURRENT_DATE() scanned 0 bytes on the sample, which ends in 2021. A subquery does not: _TABLE_SUFFIX IN (SELECT ...) scanned every table.

Columns: name them. Columnar storage means each column, and each field inside a STRUCT or repeated record, is billed separately. In the sample, event_params is 39% of all bytes and items 28%. user_pseudo_id for the whole sample is 84.7 MiB, device.category 35.2 MiB. A single string event parameter pulls in event_params.key and value.string_value (1.17 GiB across the sample), so the most effective habit is to ask whether a report needs event_params at all.

What does not reduce bytes. LIMIT, WHERE event_name = ..., ORDER BY and the number of rows returned. They change the result, not the scan. SELECT * EXCEPT(event_params, items) still reads 1.10 GiB across the sample, because it keeps dozens of other columns.

Guardrails. Check the cost before running with a dry run (bq query --dry_run, or the estimate in the console). Cap each query with maximum bytes billed: bq query --maximum_bytes_billed=1000000000, or the same setting in the console's query settings or the API's maximumBytesBilled. A query over the cap fails before it reads anything and is not billed (error reference). For a project-wide or per-user ceiling, set custom quotas on query usage per day.

ColumnMeaning
usersDistinct users per day.
page_viewspage_view events per day.

Notes and cost

  • Measured with dry runs on the sample: SELECT * over all 92 tables, 3,583,657,854 bytes; the same with LIMIT 10, 3,583,657,854 bytes; with WHERE event_date = '20201201', 3,583,657,854 bytes; with WHERE _TABLE_SUFFIX = '20201201', 64,880,131 bytes.
  • Measured for user_pseudo_id only: all tables, 88,805,473 bytes; one week via _TABLE_SUFFIX BETWEEN, 9,174,716 bytes; one week via PARSE_DATE(_TABLE_SUFFIX), 9,174,716 bytes; one week via event_date BETWEEN, 131,761,313 bytes (more than no filter at all, because it adds the event_date column); _TABLE_SUFFIX IN (SELECT '20201201'), 88,805,473 bytes.
  • event_params by part, whole sample: key alone 690,556,977 bytes; key and int_value 850,433,505 bytes; key and string_value 1,251,252,585 bytes; the whole record 1,411,194,689 bytes.
  • On-demand prices and the free tier are on BigQuery pricing. Under editions (slot-based) pricing, bytes do not set the price, but scanning less still uses fewer slots.
  • BI tools re-run their queries on every refresh and filter change. A Looker Studio dashboard on the raw export can cost more than all hand-written queries together; see Looker Studio cost and point dashboards at a daily summary table instead.
  • To find the GA4 queries that already cost the most in your projects, rank jobs by bytes billed in INFORMATION_SCHEMA.JOBS (most expensive queries, SELECT * queries).

Variations

The expensive version: SELECT *, event_date filter, LIMIT

Returns 1,000 rows and reads all 92 tables and every column: 3,583,657,854 bytes. None of the three clauses reduces the scan.

SELECT *
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
WHERE event_date BETWEEN '20201201' AND '20201207'
LIMIT 1000;

Date range from a script variable

Variables are constants by the time the query runs, so the range still prunes tables: 9,174,716 bytes, the same as a literal range.

DECLARE start_day DATE DEFAULT '2020-12-01';

SELECT
  user_pseudo_id
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
WHERE _TABLE_SUFFIX BETWEEN FORMAT_DATE('%Y%m%d', start_day)
                        AND FORMAT_DATE('%Y%m%d', DATE_ADD(start_day, INTERVAL 6 DAY));

What does not prune: a subquery on _TABLE_SUFFIX

The filter depends on query results, so BigQuery reads every table: 88,805,473 bytes for one column, against 9,174,716 bytes for a week with a literal range.

SELECT
  user_pseudo_id
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
WHERE _TABLE_SUFFIX IN (SELECT '20201201');

Explore with TABLESAMPLE

Reads a random subset of storage blocks, about 10% here: 8,687,491 bytes instead of 88,805,473 bytes. Good for checking a query's logic, not for exact counts.

SELECT
  user_pseudo_id
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*` TABLESAMPLE SYSTEM (10 PERCENT);

FAQ

Why is SELECT on GA4 events_ expensive?

It reads every column of every daily table the wildcard matches, including event_params and items, which make up about two thirds of the bytes in the sample. On the three-month sample that is 3.34 GiB; on a busy property with years of history it is far more.

Does filtering on event_date reduce GA4 query cost?

No. The export is sharded by table, and only a _TABLE_SUFFIX filter with a constant expression skips tables. An event_date filter reads every table and then filters rows.

Does LIMIT reduce bytes billed in BigQuery?

No. LIMIT stops output, not the scan. The query reads the same columns from the same tables with or without it.

How do I stop a GA4 query from scanning too much?

Dry run it first, then set maximum bytes billed on the query (--maximum_bytes_billed in the bq CLI, or the console query settings). A query over the limit fails without charge.

All GA4 export queries · BigQuery cost queries · The GA4 sample dataset

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.