Track deleted files from VACUUM in Delta table history

Use DESCRIBE HISTORY to find VACUUM operations and check operationMetrics for deleted file count and size.

Written by joel.robin

Last published at: June 4th, 2025

Introduction

After executing a VACUUM operation on a Delta table, you want to verify how many files were deleted and the total size of the removed data for auditing or optimization validation.

 

Instructions

To obtain the number of deleted files and the size of deleted data, query the operationMetrics field corresponding to the VACUUM START and VACUUM END entries in the table’s history.

 

Sample query 

```sql
SELECT operation, operationParameters, operationMetrics
FROM (DESC HISTORY `<catalog>`.`<schema>`.`<table>`)
WHERE operation IN ('VACUUM START', 'VACUUM END');
```

 

This query returns the start and end events for the VACUUM operation, along with key metrics such as: 

  • numFilesToDelete: Number of files to be deleted. 
  • sizeOfDataToDelete: Total size of data to be deleted. 
  • numDeletedFiles: Number of files deleted.

 

Best practices

  • Always check both VACUUM START and VACUUM END entries to ensure the operation is completed successfully. 
  • Automate logging of operationMetrics after VACUUM to maintain a cleanup audit trail. For instructions, review the Automate VACUUM metrics logging for Delta table cleanup audits KB article.
  • Combine DESCRIBE HISTORY with partition or timestamp filters to narrow down recent maintenance activity.