Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2021 10:43 AM
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.
it is from https://docs.databricks.com/spark/latest/spark-sql/language-manual/delta-optimize.html
So for delta files once partition disappear it is really important to have Z-order as it will handle effectively your query, so you need:
OPTIMIZE data ZORDER BY (userid, date)
My blog: https://databrickster.medium.com/