If you expect a column to be commonly used in query predicates and if that column has high cardinality (that is, a large number of distinct values), then use
ZORDER BY
.
You can specify multiple columns for
ZORDER BY
as a comma-separated list. However, the effectiveness of the locality drops with each additional column. Z-Ordering on columns that do not have statistics collected on them would be ineffective and a waste of resources as data skipping requires column-local stats such as min, max, and count. You can configure statistics collection on certain columns by re-ordering columns in the schema or increasing the number of columns to collect statistics on. See the section Data skipping for more details.