Z-order sorting interleaves the bits of multiple columns to achieve multi-dimensional data locality. This dramatically improves query performance when filters span multiple columns.
Z-order is ideal when your queries frequently filter on 2 or more columns simultaneously:
-- Queries that benefit from z-order on (region, date):SELECT * FROM events WHERE region = 'US' AND date > '2026-01-01';SELECT * FROM orders WHERE customer_id = 123 AND status = 'pending';
Without z-order, data is sorted by one column, forcing full scans on the other. With z-order, data locality exists across all chosen dimensions.