Reviewed by Aditya Kumar Β· Last reviewed 2026-03-24
**Z-ordering** (Z-order curve): Colocates related data in same files. Multi-column filter (e.g., region + date) can skip more files vs. single-column partitioning. **Delta**: OPTIMIZE table ZORDER BY (col1, col2). **Why**: Improves file pruning; columnar still scans selected...
Z-ordering (Z-order curve): Colocates related data in same files. Multi-column filter (e.g., region + date) can skip more files vs. single-column partitioning. Delta: OPTIMIZE table ZORDER BY (col1, col2). Why: Improves file pruning; columnar still scans selected files. Order: High-filter columns first. Combine: Partition by date + Z-order by (region, user_id). Cost: OPTIMIZE rewrites files; run periodically.
Red Flag: Z-order on low-cardinality column first. Pro-Move: 'We Z-ordered by (user_id, event_date)βpoint lookups went from 50 files to 2; query P99 dropped 80%.'
According to DataEngPrep.tech, this is one of the most frequently asked SQL interview questions, reported at 1 company. DataEngPrep.tech maintains an editor-reviewed database of 1,863 data engineering interview questions across 7 categories.