cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

What fields should I Zorder by? Does the order of Zorder matter?

Anonymous
Not applicable
 
1 ACCEPTED SOLUTION

Accepted Solutions

User16826994223
Honored Contributor III

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.

View solution in original post

1 REPLY 1

User16826994223
Honored Contributor III

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.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group