» Documentation » SQL Reference

Truncate

Syntax

TRUNCATE [WITH SHRINK] TABLE table_path 

Description

The TRUNCATE command will remove all rows in the table at table_path, where table_path is either database_name.table_name or table_name if it is in the currently USEd database.

If WITH SHRINK is specified, all allocated disk space for the table data will be freed. Otherwise, the table data files will stay the same size. The reason that this doesn't happen by default is for speed. If you will not be re-populating the table with the same order of quantity of data at any time soon and want to save space, it might be a good idea to include this option.

As this statement creates an exclusive lock on the table, it will abort any other transactions that have shared locks on the table.