Reading — step 1 of 5
Read
~1 min readVectorized Execution
Predicate Pushdown
Old style: read all rows, filter in memory.
Predicate pushdown: push WHERE clauses down to the storage layer.
SELECT name FROM users WHERE age > 50 AND country = 'USA'
- Stripe pruning: skip stripes where max(age) <= 50 OR country dict doesn't contain 'USA'.
- Page pruning: within stripe, skip pages with max(age) <= 50.
- Run-level skip: in RLE-encoded country column, skip runs of value != 'USA'.
- Bit-mask: produce a survivor mask per page.
Each level cuts I/O exponentially.
python
Late materialization: only fetch projection columns for survivors.
Order of predicates matters: cheapest + most-selective first.
- Indexed equality (cheap, very selective): first.
- Range scan (cheap-ish): middle.
- Substring match (expensive): last.
Pushdown across systems:
- SQL → query plan → pushed to Parquet reader → pushed to S3 (range requests).
- Iceberg, Delta Lake table formats track per-file stats for cross-file pushdown.
Modern push-down can also include:
- Aggregate pushdown: storage computes COUNT, MIN, MAX.
- Projection pushdown: read only required columns.
- Partition pruning: skip partitions by directory naming (
year=2024/month=01/...).
Effect: a 100GB table query might read 100MB.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…