TRUNCATE TABLE

Removes all storage associated with a table, while leaving the table definition intact. TRUNCATE TABLE auto-commits the current transaction after statement execution and cannot be rolled back.

TRUNCATE TABLE also performs the following actions:

  • Removes all table history preceding the current epoch, regardless of where that data resides (WOS or ROS) or how it is segmented. After TRUNCATE TABLE returns, AT EPOCH queries on the truncated table return nothing.
  • Drops all table- and partition-level statistics.

Syntax

TRUNCATE TABLE [[database.]schema.]table‑name 

Parameters

[database.]schema

Specifies a schema, by default public. If schema is any schema other than public, you must supply the schema name. For example:

myschema.thisDbObject

If you specify a database, it must be the current database.

table‑name

The name of the anchor table or temporary table to truncate. You cannot truncate an external table.

Privileges

Non-superuser:

  • Table owner
  • USAGE privileges on table schema

Examples

See Truncating Tables in the Administrator's Guide.

See Also