Outdated Version
You are viewing an older version of this section. View current production version.
TRUNCATE
Removes all rows from the table. TRUNCATE
is equivalent to running a DELETE
which removes all the rows from the table but without all the overhead of deleting one row at a time.
Syntax
TRUNCATE [TABLE] tbl_name
Remarks
- This command must be run on the master aggregator node (see Node Requirements for MemSQL Commands).
- If there is a long-running query executing at the time a
TRUNCATE
operation is run theTRUNCATE
will block and wait for it to finish. This is the same locking that anALTER
operation does before running.
Example
mysql> TRUNCATE TABLE mytbl;
Query OK, 1 row affected (6.32 sec)
Related Topics