DELETE Removed the Customer Record—but Did It Remove the Data?
A successful Delta Lake DELETE makes a record disappear from the current table version. However, it may not immediately remove that record from the underlying storage files.
Imagine a fictional retailer receives a verified data-erasure request:
DELETE FROM main.sales.customer_transactions
WHERE customer_id = 'C-7782';
If deletion vectors are enabled, Databricks can record this as a soft delete. The affected Parquet file is not immediately rewritten; metadata tells queries to ignore the deleted row.
This improves the performance of DELETE, UPDATE, and MERGE, but physical removal requires additional steps.
-- Rewrite files containing soft-deleted records
REORG TABLE main.sales.customer_transactions
APPLY (PURGE);
-- Preview eligible obsolete files
VACUUM main.sales.customer_transactions DRY RUN;
-- Remove eligible files after the retention requirement is satisfied
VACUUM main.sales.customer_transactions;
These operations have different responsibilities:
DELETE removes the record from the current logical table state.
REORG TABLE ... APPLY (PURGE) rewrites current files containing soft-deleted data.
Older files can still support time travel.
VACUUM physically removes eligible obsolete files after the retention threshold.
The default VACUUM retention period is seven days. Reducing it without evaluating concurrent workloads and recovery requirements can create data-loss risk.
For sensitive-data deletion, a reliable runbook should validate:
The record is absent from the current table.
Soft-deleted data has been purged from current files.
Older files have passed the required retention period.
VACUUM completed successfully.
Downstream tables, extracts, caches, and shared copies are handled separately.
The operations are recorded for audit and compliance evidence.
The key distinction is:
Logical deletion controls what queries return.
File rewriting and retention-aware cleanup control when old data is physically removed.
Deletion vectors documentation | REORG TABLE documentation | VACUUM documentation
Does your data-deletion process distinguish logical removal, file rewriting, and physical deletion?
#Databricks #DeltaLake #DeletionVectors #DataPrivacy #DataGovernance #REORG #VACUUM #DataEngineering
Amit Sharma