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
Databricks Employee
Databricks Employee

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
Databricks Employee
Databricks Employee

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
Databricks Employee
Databricks Employee

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

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group