VACUUM TEMPORARY FILES
Introduced or updated: v1.2.953
VACUUM TEMPORARY FILES is an Enterprise Edition feature. Contact Databend Support for a license.
Removes temporary spill files created during query execution and cleans up inactive temporary-table sessions for the tenant.
See also: system.temp_files, VACUUM ALL.
Syntax
VACUUM TEMPORARY FILES [RETAIN <number> {SECONDS | DAYS}] [LIMIT <limit>]
| Parameter | Description |
|---|---|
RETAIN | Retention period for temporary spill files. Defaults to 3 days. This is independent of data_retention_time_in_days and does not set the lifetime of temporary-table sessions. |
LIMIT | A soft cleanup budget for spill paths first. The remaining allowance limits the number of inactive temporary-table sessions to clean, rather than individual files within those sessions. Concurrent spill tasks can exceed this budget. If omitted, no explicit limit is applied. |
Requires global SUPER privilege. The command does not return a result set.
LIMIT is not an exact deletion cap
Concurrent cleanup tasks can finish after the budget is exhausted. The number of removed spill paths can exceed LIMIT. Check server logs for failed deletions. Run the command again if eligible files remain.
Examples
Inspect temporary files:
SELECT * FROM system.temp_files;
Clean up using the default retention:
VACUUM TEMPORARY FILES;
Retain spill files for 2 days and limit cleanup:
VACUUM TEMPORARY FILES RETAIN 2 DAYS LIMIT 1000;