TRUNCATE
Empties a table of all rows.
Synopsis
TRUNCATE [TABLE] <name> [, ...] [CASCADE | RESTRICT]
Description
TRUNCATE
quickly removes all rows from a table or set of tables.This is most useful on large tables.
Parameters
Required. The name (optionally schema-qualified) of a table to be truncated.
CASCADE
Since this key word applies to foreign key references (which are not supported in HAWQ) it has no effect.
RESTRICT
Since this key word applies to foreign key references (which are not supported in HAWQ) it has no effect.
Notes
Only the owner of a table may TRUNCATE
it. TRUNCATE
will not perform the following:
Run any user-defined
ON DELETE
triggers that might exist for the tables.Note: HAWQ does not support user-defined triggers.
Truncate any tables that inherit from the named table. Only the named table is truncated, not its child tables.
Examples
Empty the table films
:
TRUNCATE films;
Compatibility
There is no TRUNCATE
command in the SQL standard.