A Different Dialect

The archive meter: you pay for bytes read

10 min

The morning bill

Your morning starts with a summons: the station commander has sent you a statement. Yesterday's queries to the Far Archive drained a noticeable amount of energy from the donor station, and every query has a number beside it.

You scan the list and notice something odd: the most “expensive” query returned five rows. The cheapest returned fifty. The price clearly has nothing to do with the number of rows in the result.

QUERY: I went through the archive's rate sheet while you were asleep. Bad news: you don't pay for the answer here. You pay for what gets read. Good news: that means you can control the cost.

The station meter: two full columns of data flow into a measuring tube, while only a few drops of the result fall into a cup below. A cadet stands in front of the meter holding an energy statement, while the robot cat watches the level fall.
You pay for the full columns that are read, not for the rows returned: LIMIT reduces the output, but not the bill.

The on-demand model: bytes, not rows

In its basic on-demand mode, BigQuery charges you for one thing: how many bytes of table data the query reads. In real-world money, that's about $6.25 per TiB read (the first TiB each month is free). A TiB is a tebibyte, a binary terabyte: 1024 GiB ≈ 1.1 “regular” TB. Google prices BigQuery in TiB, so this course does too. The station's meter works the same way; only the currency is different.

Think back to the previous lesson: data is stored by column. That makes the amount read easy to calculate:

scan = total size of all columns read in full

  • SELECT name FROM fa_users — reads one column, name, across every row in the table;
  • SELECT * FROM fa_users — reads ALL columns;
  • the number of rows in the result doesn't affect the bill at all.

In Postgres, you didn't have to think about the monetary “cost” of a SELECT: the server was yours, the disk was yours, and the difference between a fast query and a slow one was measured in waiting time. In BigQuery, every query has a price — and you can know it BEFORE you run the query.

Why LIMIT doesn't save money

A familiar habit from the row-based world is to think, “I'll add LIMIT 10, so the database has less work to do.” In a row-based database, that sounds reasonable: read ten rows from the beginning, then stop.

A columnar engine works differently. To return even one row, it has already read the required columns in full, distributed across large blocks. LIMIT is applied at the very end, to the completed result. By then, the bill has already been calculated.

The same applies to WHERE (as long as the table isn't partitioned — we'll cover that in the “Money and Scale” chapter): the filter reduces the number of rows returned, but the columns referenced by WHERE and SELECT are still read across the entire table.

Let's estimate the cost. Imagine the colony's event log has grown to scale: ten columns of roughly equal size, 5 TiB total — about 500 GiB per column. Then:

-- reads ~1 TiB (two full columns): ~$6.25
SELECT user_id, event_name FROM journal;

-- reads EXACTLY the same amount: ~$6.25
SELECT user_id, event_name FROM journal LIMIT 100;

-- reads all 5 TiB: ~$31.25
SELECT * FROM journal LIMIT 100;

One SELECT * “just to take a look” is like leaving a faucet running: the water is already gone, no matter how few glasses you fill.

The bill is counted before LIMIT, not afterSELECT * … LIMIT 10read5 TiB10 rowsSELECT user_id, tsread1 TiB10 rowsyou pay for columns read, not for rows returned
Both queries return ten rows — but you pay for the columns they read

Dry run: see the price before running. Cache: repeat for free

Your main survival tool is a dry run: BigQuery analyzes a query without executing it. It parses the query, checks the table , and returns the exact amount of data the query would scan — instantly and for free. In the BigQuery console, you can see the estimate as you type (“This query will process 1.2 TB when run”); in the CLI, use bq query --dry_run; in the API, use the dryRun flag.

The Postgres habit of using EXPLAIN becomes a dry-run habit here: in Postgres, you inspected the plan to save time; here, you check the bytes to save money.

Your second ally is the results cache. Run exactly the same query again without changing the data, and BigQuery returns the stored result for free (the cache lasts about a day). So running the same query again to check the result is harmless; changing it slightly and scanning the whole table again is what costs you. We'll cover exactly what breaks the cache — for example, nondeterministic functions such as CURRENT_TIMESTAMP() — in the “Money and Scale” chapter.

Dry run: the bill before you runquery text1.4 TiB will be readno data is read, no money is spent✓ a narrow column list drops the bill at once✗ EXPLAIN here is about bytes, not about time
A dry run shows how much data will be read before you pay for it

Slots: when counting bytes gets old

The “pay by the byte” model has its limits. Once a company runs a very large number of queries, it may switch to a capacity model and buy slots, units of compute capacity, for a fixed price regardless of how many bytes its queries read. Companies make this switch when the workload becomes steady or when knowing the maximum cost in advance matters more than calculating the price of each query. This is an administrator's decision, not an analyst's: the billing model changes, but the SQL syntax doesn't.

For you, the rule is simple: while billing is based on bytes, every unnecessary column costs money. If your company uses slots, an inefficient query still consumes shared compute capacity that your coworkers could be using. Cost-conscious habits pay off under both models.

The course sandbox is free — so here's a warning: the emulator doesn't count bytes and doesn't support dry runs. The numbers in this lesson are calculations based on real BigQuery pricing. In , make this a habit: dry run first, then run the query.

Check yourself
The colony's production event log has 10 columns of roughly equal size, and the whole table is 5 TiB. How much data will SELECT user_id, event_name FROM journal LIMIT 100 read, and what will it cost at $6.25/TiB?
Check yourself
A query against a large unpartitioned table turned out to be too expensive. Which change will ACTUALLY reduce the cost of the next query?
Practice: solve the tasks
Solved 0 of 3 · any 2 is enough to pass
Key takeaways
  • on-demand: you pay for the bytes read from columns, about $6.25 per TiB; the number of rows returned doesn't matter
  • LIMIT and WHERE (without partitions) don't lower the bill: the columns are read in full before those operations apply
  • a dry run shows the exact scan size before execution; an exact repeat of a query can be served from the cache for free
  • slots are a capacity model for larger teams; cost-conscious habits matter under both models

Postgres habit → BigQuery idiom (part 1):

Postgres habitBigQuery approach
SELECT * “to take a look at the data”list the columns or use SELECT * EXCEPT(...)
LIMIT 10 “to keep it cheap”LIMIT only controls output size; it doesn't change the cost
EXPLAIN before a heavy querydry run: exact bytes before execution
CREATE INDEXno indexes: use partitioning and clustering (chapter 5)
“the database will cache it automatically”results cache: an exact repeat is free

Documentation: BigQuery pricing, cost optimization best practices.

You understand the meter now. But the archive holds data recorded in haste by dying colonies — it's messy, and your query must not die with it. Next lesson: SAFE mode.