You are viewing an older version of this section. View current production version.
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.
TRUNCATE [TABLE] tbl_name
- 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
TRUNCATEoperation is run the
TRUNCATEwill block and wait for it to finish. This is the same locking that an
ALTERoperation does before running.
mysql> TRUNCATE TABLE mytbl; Query OK, 1 row affected (6.32 sec)