Skip to content

Commit 5e9e6aa

Browse files
authored
Update 04-data-recycle.md
1 parent a394584 commit 5e9e6aa

File tree

1 file changed

+13
-25
lines changed

1 file changed

+13
-25
lines changed

docs/en/guides/57-data-management/04-data-recycle.md

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,25 @@ Before DELETE: After DELETE: After VACUUM:
1919
Storage not freed Storage freed
2020
```
2121

22-
## Types of Data to Clean
22+
## VACUUM Commands and Cleanup Scope
2323

24-
Databend provides specific commands to clean different types of data. The following table summarizes the data types and their corresponding cleanup commands:
24+
Databend provides three VACUUM commands to clean different types of data. **Understanding what each command cleans is crucial** - some commands only clean storage data, while others clean both storage and metadata.
2525

26-
| Data Type | Description | Cleanup Command |
27-
|-----------|-------------|-----------------|
28-
| **Dropped Table Data** | Data files from tables that have been dropped using the DROP TABLE command | `VACUUM DROP TABLE` |
29-
| **Table History Data** | Historical versions of tables, including snapshots created through UPDATE, DELETE, and other operations | `VACUUM TABLE` |
30-
| **Orphan Files** | Snapshots, segments, and blocks that are no longer associated with any table | `VACUUM TABLE` |
31-
| **Spill Temporary Files** | Temporary files created when memory usage exceeds available limits during query execution (for joins, aggregates, sorts, etc.) | `VACUUM TEMPORARY FILES` |
32-
33-
> **Note**: Spill temporary files are typically cleaned automatically by Databend. Manual cleanup is only needed when Databend crashes or shuts down unexpectedly during query execution.
26+
| Command | Target Data | S3 Storage | Meta Service | Details |
27+
|---------|-------------|------------|--------------|---------|
28+
| **VACUUM DROP TABLE** | Dropped tables after `DROP TABLE` |**Removes**: All data files, segments, blocks, indexes, statistics |**Removes**: Table schema, permissions, metadata records | **Complete purge** - table cannot be recovered |
29+
| **VACUUM TABLE** | Table history & orphan files |**Removes**: Historical snapshots, orphan segments/blocks, old indexes/stats |**Preserves**: Table structure and current metadata | **Storage-only** - table remains active |
30+
| **VACUUM TEMPORARY FILES** | Spill files from queries (joins, aggregates, sorts) |**Removes**: Temporary spill files from crashed/interrupted queries |**No metadata**: Temp files have no associated metadata | **Storage-only** - rarely needed, auto-cleaned normally |
3431

32+
> **Critical**: Only `VACUUM DROP TABLE` removes metadata from the meta service. The other commands only clean storage files.
3533
3634
## Using VACUUM Commands
3735

38-
The VACUUM command family is the primary method for cleaning data in Databend ([Enterprise Edition Feature](/guides/products/dee/enterprise-features)). Different VACUUM subcommands are used depending on the type of data you need to clean.
39-
40-
```
41-
VACUUM Commands:
42-
+------------------------+ +------------------------+ +------------------------+
43-
| VACUUM DROP TABLE | | VACUUM TABLE | | VACUUM TEMPORARY FILES |
44-
+------------------------+ +------------------------+ +------------------------+
45-
| Cleans dropped tables | | Cleans table history | | Cleans spill files |
46-
| and their data files | | and orphan files | | (rarely needed) |
47-
+------------------------+ +------------------------+ +------------------------+
48-
```
36+
The VACUUM command family is the primary method for cleaning data in Databend ([Enterprise Edition Feature](/guides/products/dee/enterprise-features)).
4937

5038
### VACUUM DROP TABLE
5139

52-
This command permanently deletes data files of dropped tables, freeing up storage space.
40+
Permanently removes dropped tables from both storage and metadata.
5341

5442
```sql
5543
VACUUM DROP TABLE [FROM <database_name>] [DRY RUN [SUMMARY]] [LIMIT <file_count>];
@@ -78,7 +66,7 @@ VACUUM DROP TABLE LIMIT 1000;
7866

7967
### VACUUM TABLE
8068

81-
This command removes historical data for a specified table, clearing old versions and freeing storage.
69+
Removes historical data and orphan files for active tables (storage-only cleanup).
8270

8371
```sql
8472
VACUUM TABLE <table_name> [DRY RUN [SUMMARY]];
@@ -102,13 +90,13 @@ VACUUM TABLE my_table;
10290

10391
### VACUUM TEMPORARY FILES
10492

105-
This command clears temporary spilled files used for joins, aggregates, and sorts, freeing up storage space.
93+
Removes temporary spill files created during query execution.
10694

10795
```sql
10896
VACUUM TEMPORARY FILES;
10997
```
11098

111-
**Note:** While this command is provided as a manual method for cleaning up temporary files, it's rarely needed during normal operation since Databend automatically handles cleanup in most cases.
99+
> **Note**: Rarely needed during normal operation since Databend automatically handles cleanup. Manual cleanup is typically only required when Databend crashes during query execution.
112100
113101
## Adjusting Data Retention Time
114102

0 commit comments

Comments
 (0)