How to check a specific table for it's VACUUM retention period

WWoman
Databricks Partner

I'm looking for a way to query for the VACUUM retention period for a specific table. This does not show up with DESSCRIBE DETAIL <table_name>;

filipniziol
Esteemed Contributor

Hi @WWoman ,

the default retention period is 7 days and as  per documentation it is regulated by 'delta.deletedFileRetentionDuration' table property:

filipniziol_0-1738092227320.png

If there is no delta.deletedFileRetentionDuration table property it means it uses the default, so 7 days.
If you set the delta.deletedFileRetentionDuration like this:

ALTER TABLE dev.bronze.source_table SET TBLPROPERTIES ('delta.deletedFileRetentionDuration' = '30 days');

you will be able to check the property by running SHOW TBLPROPERTIES:

SHOW TBLPROPERTIES dev.bronze.source_table;

The result:

filipniziol_1-1738092443138.png

However, one can always run the VACUUM overwriting the defaults, so if you have any process that explicitly states the number of retained hours, you won't be able to check this at table properties level:

filipniziol_2-1738092686127.png

 










View solution in original post

WWoman
Databricks Partner

Thank you!

filipniziol
Esteemed Contributor

No problem, glad it was helpful!