blob: 0f7d52e17a244fbec104fff845c79cce796d6c4c [file] [log] [blame]
---
title: TRUNCATE
---
Empties a table of all rows.
## Synopsis<a id="topic1__section2"></a>
``` pre
TRUNCATE [TABLE] name [, ...] [CASCADE | RESTRICT]
```
## Description<a id="topic1__section3"></a>
`TRUNCATE` quickly removes all rows from a table or set of tables.This is most useful on large tables.
## Parameters<a id="topic1__section4"></a>
*name*
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<a id="topic1__section5"></a>
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<a id="topic1__section6"></a>
Empty the table `films`:
``` pre
TRUNCATE films;
```
## Compatibility<a id="topic1__section7"></a>
There is no `TRUNCATE` command in the SQL standard.
## See Also<a id="topic1__section8"></a>
[DROP TABLE](DROP-TABLE.html)