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: 

What is the best practice of deleting the complete data from Delta table

brickster_2018
Esteemed Contributor
Esteemed Contributor

I have a use case where I need to delete the data completely and load new data to the existing Delta table. 

1 ACCEPTED SOLUTION

Accepted Solutions

brickster_2018
Esteemed Contributor
Esteemed Contributor

It's recommended to use the overwrite option. Overwrite the table data and run a VACUUM command. 

  • To Delete the data from a Managed Delta table, the DROP TABLE command can be used. 
  • If it's an external table, then run a DELETE query on the table and then execute VACUUM with RETAIN HOURS 0
  • CREATE or REPLACE table can also be used
  • We do not recommend deleting the files from the underlying storage directly. That can cause issues with the transaction logs

View solution in original post

1 REPLY 1

brickster_2018
Esteemed Contributor
Esteemed Contributor

It's recommended to use the overwrite option. Overwrite the table data and run a VACUUM command. 

  • To Delete the data from a Managed Delta table, the DROP TABLE command can be used. 
  • If it's an external table, then run a DELETE query on the table and then execute VACUUM with RETAIN HOURS 0
  • CREATE or REPLACE table can also be used
  • We do not recommend deleting the files from the underlying storage directly. That can cause issues with the transaction logs
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!