VACUUM TEMPORARY FILES
Introduced or updated: v1.2.940
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 | Limits spill-file deletion first. The remaining allowance limits the number of inactive temporary-table sessions to clean, rather than individual files within those sessions. If omitted, no explicit limit is applied. |
Requires global SUPER privilege. The command does not return a result set.
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;