Purpose
This statement is used to delete tables, indexes, or all contents from the recycle bin.
Syntax
PURGE { {TABLE object_name | INDEX object_name }
| RECYCLEBIN
}
Parameters
| Parameter | Description |
|---|---|
| object_name | The name of the table or index in the recycle bin to be deleted. Directly specifying the table or index name is not supported. Note
|
| RECYCLEBIN | Clears the recycle bin. Notice PURGE RECYCLEBIN will delete all contents in the recycle bin. Proceed with caution. |
Examples
The following example table and data are defined as follows:
obclient> CREATE TABLE tbl1(col1 INT,col2 INT);
obclient> CREATE TABLE tbl2(col1 INT,col2 INT);
obclient> CREATE INDEX tbl1_idx1 ON tbl1(col1);
obclient> CREATE INDEX tbl2_idx2 ON tbl2(col1);
obclient> DROP TABLE tbl1;
obclient> DROP TABLE tbl2;
obclient> SHOW RECYCLEBIN;
Execution result
+-----------------------------------+----------------------------------+-------+------------------------------+
| OBJECT_NAME | ORIGINAL_NAME | TYPE | CREATETIME |
+-----------------------------------+----------------------------------+-------+------------------------------+
| RECYCLE_$_100004_1634626847891416 | __idx_1101710651081601_TBL1_IDX1 | INDEX | 19-OCT-21 03.00.47.891270 PM |
| RECYCLE_$_100004_1634626847895656 | TBL1 | TABLE | 19-OCT-21 03.00.47.895431 PM |
| RECYCLE_$_100004_1634626853379432 | __idx_1101710651081602_TBL2_IDX2 | INDEX | 19-OCT-21 03.00.53.378871 PM |
| RECYCLE_$_100004_1634626853383304 | TBL2 | TABLE | 19-OCT-21 03.00.53.383100 PM |
+-----------------------------------+----------------------------------+-------+------------------------------+
4 rows in set
Delete the index of the
tbl1table in the recycle bin.obclient> PURGE INDEX RECYCLE_$_100004_1634626847891416; obclient> SHOW RECYCLEBIN;Execution result
+-----------------------------------+----------------------------------+-------+------------------------------+ | OBJECT_NAME | ORIGINAL_NAME | TYPE | CREATETIME | +-----------------------------------+----------------------------------+-------+------------------------------+ | RECYCLE_$_100004_1634626847895656 | TBL1 | TABLE | 19-OCT-21 03.00.47.895431 PM | | RECYCLE_$_100004_1634626853379432 | __idx_1101710651081602_TBL2_IDX2 | INDEX | 19-OCT-21 03.00.53.378871 PM | | RECYCLE_$_100004_1634626853383304 | TBL2 | TABLE | 19-OCT-21 03.00.53.383100 PM | +-----------------------------------+----------------------------------+-------+------------------------------+ 3 rows in setDelete the
tbl2table in the recycle bin.obclient> PURGE TABLE RECYCLE_$_100004_1634626853383304; obclient> SHOW RECYCLEBIN;Execution result
+-----------------------------------+---------------+-------+------------------------------+ | OBJECT_NAME | ORIGINAL_NAME | TYPE | CREATETIME | +-----------------------------------+---------------+-------+------------------------------+ | RECYCLE_$_100004_1634626847895656 | TBL1 | TABLE | 19-OCT-21 03.00.47.895431 PM | +-----------------------------------+---------------+-------+------------------------------+ 1 row in setClear the recycle bin.
obclient> PURGE RECYCLEBIN; obclient> SHOW RECYCLEBIN;Execution result
Empty set