TRUNCATE

Name

TRUNCATE  --  Empties the contents of a table.

Synopsis

TRUNCATE [ TABLE ] name
  

Inputs

name

Use this parameter to specify the name of the table you wish to truncate (empty).

Results

TRUNCATE

This message is displayed if the specified table is successfully truncated.

Description

Use this command to remove all rows of a specified table. It does not scan through the table before removing data, making it rather helpful when emptying large tables of data. Essentially, it is a quicker form of the DELETE command.

Examples

This example will empty all of the rows in the temp employees table.

booktown=# TRUNCATE TABLE temp_emp;
TRUNCATE