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: 

Optimize and Vacuum - which is the best order of operations?

Hubert-Dudek
Esteemed Contributor III

Optimize -> Vacuum

or

Vacuum -> Optimize

1 ACCEPTED SOLUTION

Accepted Solutions

I agree with you @Werner Stinckens​ . I will always do optimize to try to compact the files more (default size is 1 gb) and then run vacuum. Vacuum will remove the old files that are no longer needed or have been marked as obsoleted by the optimize command.

View solution in original post

5 REPLIES 5

Hubert-Dudek
Esteemed Contributor III

I am asking some questions as nobody is writing today 🙂

Thank you!

Hubert-Dudek
Esteemed Contributor III

In my opinion as Vacuum remove old files so is better to do Vacuum first so there will be less files to optimize but maybe in some cases it will be faster to delete optimized already files (so optimize first)

-werners-
Esteemed Contributor III

I optimize first as delta lake knows which files are relevant for the optimize. Like that I have my optimized data available faster. Then a vacuum. Seemed logical to me, but I might be wrong. Never actually thought about it

I agree with you @Werner Stinckens​ . I will always do optimize to try to compact the files more (default size is 1 gb) and then run vacuum. Vacuum will remove the old files that are no longer needed or have been marked as obsoleted by the optimize command.

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!