Playbooks
What do I do, and what does each option cost?
- 1
Check operators for cost and correctness
Reviewing a query plan: find where the row count peaks, which operators block, what each holds in memory and which orderings it needs; then a separate pass for seven silent wrong answers.
Diagnose - 2
Choose a join algorithm
Two inputs must be joined: a non-equality join, an index lookup, a merge, a local join on existing partitions, a broadcast or a shuffle, and then which hash variant fits memory? Then check key frequency and NULLs, which override it all.
Choose - 3
Choose an aggregation strategy
A query groups and aggregates: does the function allow partial results, is an exact answer needed, and does pre-aggregating before the shuffle pay? Three questions, then sizing, sort reuse and determinism checks.
Choose - 4
Plan a sort
A query needs data in order: check that order (not just grouping) is needed, take it for free if the data already has it, then size the sort: passes, fan-in, key normalization, and sampling for a distributed sort.
Design - 5
Choose a dedup strategy
Duplicates must be removed or counted: a sketch for counting, streaming dedup over sorted input, hash dedup in memory, or sort-based dedup when it will not fit? Plus wide keys and why approximate dedup can lose rows.
Choose