cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

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

User16869510359
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

User16869510359
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

User16869510359
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
Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.