PostgreSQL 7.4.11 Documentation
Prev | Fast Backward |  | Fast Forward | Next

# TRUNCATE

## Name

TRUNCATE -- empty a table

## Synopsis

    TRUNCATE [ TABLE ] name

## Description

`TRUNCATE` quickly removes all rows from a table. It has the same effect as an unqualified `DELETE` but since it does not actually scan the table it is faster. This is most useful on large tables.

## Parameters

`name`

  The name (optionally schema-qualified) of the table to be truncated.

## Notes

Only the owner of a table may `TRUNCATE` it.

`TRUNCATE` cannot be used if there are foreign-key references to the table from other tables. Checking validity in such cases would require table scans, and the whole point is not to do one.

`TRUNCATE` will not run any user-defined ON DELETE triggers that might exist for the table.

## Examples

Truncate the table `bigtable`:

    TRUNCATE TABLE bigtable;

## Compatibility

There is no `TRUNCATE` command in the SQL standard.

Prev | Home | Next
START TRANSACTION | Up | UNLISTEN