TRUNCATE TABLE
Removes all storage associated with a table, while leaving the table definition intact.
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. After TRUNCATE TABLE returns, AT EPOCH queries on the truncated table return nothing.
Syntax
TRUNCATE TABLE [[{namespace. | database. }]schema.]table-name
Parameters
{
namespace.
|
database.
}
- Name of the database or namespace that contains
table
:- Database name: If specified, it must be the current database. In Eon Mode databases, the database name is valid only if the object is in the default namespace.
- Namespace name (Eon Mode only): You must specify the namespace of objects in non-default namespaces. If no namespace is provided, Vertica assumes the object is in the default namespace.
You cannot specify both a database and namespace name.
schema
- Name of the schema, by default
public
. If you specify the namespace or database name, you must provide the schema name, even if the schema ispublic
.
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.