You can use the TRUNCATE TABLE syntax to clear the data in a table with the schema and indexes of the table unchanged. The TRUNCATE TABLE syntax can be used to quickly delete the data in a table while ensuring the integrity of the table.
Applicable engines
The TRUNCATE TABLE syntax is applicable only to LindormTable.
Syntax
truncate_table_statement ::= TRUNCATE TABLE table_identifier
Usage notes
When you use the TRUNCATE TABLE syntax, take note of the following items:
If you use this syntax in LindormTable 2.2.16 and later versions, you must use the
OFFLINE TABLE
syntax to set the table status to offline in advance.For more information about how to view the Lindorm version, see Release notes of LindormTable.
The TRUNCATE TABLE syntax does not delete the schema and indexes of the specified table.
Examples
Clear the data in the sensor table.
Execute the following statement to set the status of the sensor table to offline in advance.
OFFLINE TABLE sensor;
Clear the data in the sensor table.
TRUNCATE TABLE sensor;