Skip to content

Commit 24ca832

Browse files
authored
Update 04-data-recycle.md
1 parent 58422f4 commit 24ca832

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ sidebar_label: Data Recycle
77

88
In Databend, data is not immediately deleted when you run `DROP`, `TRUNCATE`, or `DELETE` commands. This enables Databend's time travel feature, allowing you to access previous states of your data. However, this approach means that storage space is not automatically freed up after these operations.
99

10+
```
11+
Before DELETE: After DELETE: After VACUUM:
12+
+----------------+ +----------------+ +----------------+
13+
| Current Data | | New Version | | Current Data |
14+
| | | (After DELETE) | | (After DELETE) |
15+
+----------------+ +----------------+ +----------------+
16+
| Historical Data| | Historical Data| | |
17+
| (Time Travel) | | (Original Data)| | |
18+
+----------------+ +----------------+ +----------------+
19+
Storage not freed Storage freed
20+
```
21+
1022
## Types of Data to Clean
1123

1224
In Databend, there are four main types of data that may need cleaning:
@@ -16,10 +28,21 @@ In Databend, there are four main types of data that may need cleaning:
1628
3. **Orphan Files**: Snapshots, segments, and blocks that are no longer associated with any table
1729
4. **Spill Temporary Files**: Temporary files created when memory usage exceeds available limits during query execution (for joins, aggregates, sorts, etc.). Databend automatically cleans up these files when queries complete normally. Manual cleanup is only needed in rare cases when Databend crashes or shuts down unexpectedly during query execution.
1830

31+
1932
## Using VACUUM Commands
2033

2134
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.
2235

36+
```
37+
VACUUM Commands:
38+
+------------------------+ +------------------------+ +------------------------+
39+
| VACUUM DROP TABLE | | VACUUM TABLE | | VACUUM TEMPORARY FILES |
40+
+------------------------+ +------------------------+ +------------------------+
41+
| Cleans dropped tables | | Cleans table history | | Cleans spill files |
42+
| and their data files | | and orphan files | | (rarely needed) |
43+
+------------------------+ +------------------------+ +------------------------+
44+
```
45+
2346
### VACUUM DROP TABLE
2447

2548
This command permanently deletes data files of dropped tables, freeing up storage space.

0 commit comments

Comments
 (0)