blob: c91ae842337cc0ebe34a95bc3f8fc565489ffcb4 [file] [log] [blame]
---
title: TRUNCATE
---
Empties a table of all rows.
## <a id="topic1__section2"></a>Synopsis
``` pre
TRUNCATE [TABLE] <name> [, ...] [CASCADE | RESTRICT]
```
## <a id="topic1__section3"></a>Description
`TRUNCATE` quickly removes all rows from a table or set of tables.This is most useful on large tables.
## <a id="topic1__section4"></a>Parameters
<dt> \<name\> </dt>
<dd>Required. The name (optionally schema-qualified) of a table to be truncated.</dd>
<dt>CASCADE </dt>
<dd>Since this key word applies to foreign key references (which are not supported in HAWQ) it has no effect.</dd>
<dt>RESTRICT </dt>
<dd>Since this key word applies to foreign key references (which are not supported in HAWQ) it has no effect.</dd>
## <a id="topic1__section5"></a>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.
## <a id="topic1__section6"></a>Examples
Empty the table `films`:
``` sql
TRUNCATE films;
```
## <a id="topic1__section7"></a>Compatibility
There is no `TRUNCATE` command in the SQL standard.
## <a id="topic1__section8"></a>See Also
[DROP TABLE](DROP-TABLE.html)