Skip to main content

VACUUM TEMPORARY FILES

Introduced or updated: v1.2.348
ENTERPRISE EDITION FEATURE
VACUUM TEMPORARY FILES is an Enterprise Edition feature. Contact Databend Support for a license.

Removes temporary files created by Databend, such as spill files.

See also: system.temp_files

Syntax

VACUUM TEMPORARY FILES [ RETAIN <n> SECONDS | DAYS ] [ LIMIT <limit> ]
  • RETAIN n SECONDS | DAYS: This option determines the retention period for temporary files. When this option is specified, Databend will compare the values of n and the setting retention_period, and it will use the larger value as the retention period. For example, if the specified value of n is greater than the default retention_period, then Databend will retain temporary files for n days, so temporary files that are older than n days will be removed.

  • LIMIT: The maximum number of temporary files to be removed.

Output

VACUUM TEMPORARY FILES returns a list of deleted temporary files.

Example

SELECT
*
FROM
system.temp_files;

┌───────────────────────────────────────────────────────────────────────────────────────┐
│ file_type │ file_name │ file_content_length │ file_last_modified_time │
├───────────┼────────────────────────┼─────────────────────┼────────────────────────────┤
│ Spill │ 84H8qt3UKN9Axsj4IzrJw7 │ 7849602024-02-26 02:14:46.037784
│ Spill │ y5W2CGXzYtDeBqZuvW0cW │ 7754242024-02-26 02:14:46.037784
└───────────────────────────────────────────────────────────────────────────────────────┘

VACUUM TEMPORARY FILES;

┌────────────────────────┐
│ Files │
├────────────────────────┤
84H8qt3UKN9Axsj4IzrJw7 │
│ y5W2CGXzYtDeBqZuvW0cW │
└────────────────────────┘
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today