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

Should I use Z Ordering on my Delta table every time I run Optimize?

User16826992666
Valued Contributor

Wondering if it always makes sense or if there are some situations where you might only want to run optimize

1 ACCEPTED SOLUTION

Accepted Solutions

Srikanth_Gupta_
Valued Contributor

Its good idea to optimize at end of each batch job to avoid any small files situation, Z order is optional and can be applied on few non partition columns which are used frequently in read operations

ZORDER BY ->

Colocate column information in the same set of files. Co-locality is used by Delta Lake data-skipping algorithms to dramatically reduce the amount of data that needs to be read. 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 is not idempotent but aims to be an incremental operation. 

View solution in original post

1 REPLY 1

Srikanth_Gupta_
Valued Contributor

Its good idea to optimize at end of each batch job to avoid any small files situation, Z order is optional and can be applied on few non partition columns which are used frequently in read operations

ZORDER BY ->

Colocate column information in the same set of files. Co-locality is used by Delta Lake data-skipping algorithms to dramatically reduce the amount of data that needs to be read. 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 is not idempotent but aims to be an incremental operation. 

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