With on-demand pricing, BigQuery charges for the bytes a query reads, and the line next to RUN tells you that number before you spend it. Three things decide it:
- Columns. BigQuery stores each column separately and reads only those you name.
SELECT * reads them all; SELECT * EXCEPT (items) skips one.
- Partitions.
shop.orders is partitioned by order_date, one partition per day. A filter on order_date skips the other days entirely.
- Clustering. Within each partition, rows are sorted by
customer_id, so a filter on it can skip blocks. The estimate can't see that saving in advance, so for clustered tables it's an upper bound.
What doesn't help: LIMIT, which trims the rows returned, not the bytes read. Repeating an identical query within a day is free: the result comes from the cache. And every query is billed at least 10 MB per table it reads, however small.