Field note · July 16, 2026
Reading 3 columns instead of 12
Column pruning times partition pruning on a real schema, and the function call that quietly defeats both.
retail-orders has 12 columns and 7,000 rows across 727 days. A query that needs three of those columns for one day is doing a lot less work than one that does not say so.
Naming 3 of 12 columns cuts the scan to roughly 25.0%. Filtering to one of 727 days cuts it to 0.1%. Together — and they multiply — the query reads about 0.03% of what select * would.
-- reads every column, every day
select * from retail_orders;
-- reads 3 columns, one day
select order_id, line_no, ordered_at
from retail_orders
where ordered_at >= date '2023-06-01'
and ordered_at < date '2023-06-02';The second version is not a micro-optimisation. On a real warehouse those two queries differ by three orders of magnitude in cost, and the expensive one is the one that is easier to type.
The trap worth knowing: wrapping the partition column in a function — date(ordered_at) = '2023-06-01' — usually defeats pruning, because the engine can no longer reason about the raw column. Same result, full scan, no warning. Compare against a range on the bare column instead.
Read the bytes-scanned line in the plan before optimising anything else. It is usually the entire answer. Why your query costs what it costs has the rest.