cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
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.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.