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:ย 

Question regarding ZORDER option of OPTIMIZE

leos1
New Contributor II

Is the order of the columns in ZORDER important? For example, does ZORDER BY (product, site) and ZORDER BY (site, product) produce the same results?

1 ACCEPTED SOLUTION

Accepted Solutions

-werners-
Esteemed Contributor III

It is not important, or at least way less important than with a linear order by.

I cannot guarantee that the resulting files will be exactly the same, but z-ordering is not the same as a classic order by where we first order by col1 and then col2 etc. It will interleave the order columns and aim for locality on this 'combined' column.

View solution in original post

2 REPLIES 2

-werners-
Esteemed Contributor III

It is not important, or at least way less important than with a linear order by.

I cannot guarantee that the resulting files will be exactly the same, but z-ordering is not the same as a classic order by where we first order by col1 and then col2 etc. It will interleave the order columns and aim for locality on this 'combined' column.

leos1
New Contributor II

thanks for the quick reply

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