Skip to content

Commit

Permalink
[Enhancement] Support move truncated old data to recycle bin
Browse files Browse the repository at this point in the history
  • Loading branch information
Vallishp committed Nov 10, 2024
1 parent 1294580 commit 170b3b8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docs/data-operate/delete/truncate-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ This statement is used to clear the data of a specified table or partition in Do
## Syntax

```SQL
TRUNCATE TABLE [db.]tbl[ PARTITION(p1, p2, ...)];
TRUNCATE TABLE [db.]tbl[ PARTITION(p1, p2, ...)] FORCE?;
```

- This statement only clears the data within a table or partition but preserves the table or partition itself.
- Unlike DELETE, this statement can only clear the specified table or partition as a whole and cannot be added with filter conditions.
- Unlike DELETE, truncating data will not affect query performance.
- The data deleted by this operation is not recoverable.
- The data deleted by this operation can be recovered through the RECOVER statement(for a period of time). See [RECOVER](../../../../sql-manual/sql-statements/Database-Administration-Statements/RECOVER) statement for details. If you execute command with FORCE, the data will be deleted directly and cannot be recovered, this operation is generally not recommended.
- When using this command, the table status must be NORMAL, which means that tables undergoing SCHEMA CHANGE can not be truncated.
- This command may cause ongoing imports to fail.

Expand All @@ -55,3 +55,8 @@ TRUNCATE TABLE example_db.tbl;
TRUNCATE TABLE tbl PARTITION(p1, p2);
```

3. Truncate the table `tbl` under `example_db` FORCE.

```SQL
TRUNCATE TABLE example_db.tbl FORCE;
```

0 comments on commit 170b3b8

Please sign in to comment.