Skip to main content

VACUUM TEMPORARY FILES

Introduced or updated: v1.2.940
ENTERPRISE EDITION FEATURE
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>]
ParameterDescription
RETAINRetention 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.
LIMITLimits 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;
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today