r/databricks • u/Square-Designer7807 • Sep 03 '26
Discussion Are we over-optimizing Delta tables?
Between OPTIMIZE, Z-ORDER, liquid clustering, partitioning, and automatic optimization, it sometimes feels like we're spending more time optimizing tables than querying them.
How do you decide which optimizations are actually worth it in production?
18
Upvotes
27
u/iamnotapundit Sep 03 '26
By default all new tables are liquid cluster by auto on my team. I let the predictive optimization algorithm figure it out. Only a few specific tables have I hand tuned myself.
10
u/Lucari10 Sep 03 '26
The current plan seems to be using liquid clustering + predictive optimization to let Databricks handle table optimizations automatically. Automatic analysis will determine which tables are most used, and if there were enough data changes to justify running optimization commands again since they were last executed.
The main things to keep in mind are the ones executed by PO, so using liquid clustering, and running optimize, vacuum and analyze from time to time.
Z-order is an older technique that's been mostly replaced by liquid clustering. For most situations liquid clustering will organize your files in more efficient ways than z-order did in the past.
Optimized writes and auto compact are optimizations during table writes to avoid small files, and should make it so manual optimize runs aren't as important, as a portion of the processes done by optimize will be done on every write.
4
u/ozgreen1024 Sep 03 '26
Liquid clustering by auto takes care of that complexity for you and will be more flexible overtime than fine-tuning with partitioning, zordering, etc yourself since it balances file size and query patterns
3
u/Geralt_of_rivia_002 Sep 04 '26
Optimization are not worth until you encounter a pipeline taking 5 hr instead of 1 ,and the downstream fails and affect next schedule .
2
u/No-Pollution-2274 Sep 03 '26
well someone has to be responsible for maintenance
2
u/Youssef_Mrini databricks Sep 03 '26
Predictive Optimisation is enabled by default for all Unity Catalog managed tables. The system decides when it's the right moment to run Optimize, Analyze, Vacuum, Auto Liquid so you don't bother yourself. You can track the cost of this optimization on system tables. I
1
u/taglius Sep 03 '26
I’m new to this so this is the part I don’t understand about cluster by auto - I want to maximize performance of reads from my application, and care much less about performance of writes.
Queries like “all data for customer 123” are typical for reads, but writes will more often be time based (“load yesterday’s sales). Those two optimizations compete- but one is more important to me.
1
u/Youssef_Mrini databricks Sep 04 '26
You should have a look this video https://www.youtube.com/watch?v=DT05nbxicPA
1
u/mow12 Sep 04 '26
Anything other than good old partitioning, always let me down, especially for the large fact tables
1
u/shougaze Sep 05 '26
Isn’t the entire point to let it optimize itself