TRUNCATE TABLE

Documentation

VoltDB Home » Documentation » Using VoltDB

TRUNCATE TABLE

TRUNCATE TABLE — Deletes all records from the specified table.

Synopsis

TRUNCATE TABLE table-name

Description

The TRUNCATE TABLE statement deletes all of the records from the specified table. TRUNCATE TABLE is the same as the statement DELETE FROM {table-name} with no selection clause. These statements contain optimizations to increase performance and reduce memory usage over an equivalent DELETE statement containing a WHERE selection clause.

The goal of the TRUNCATE TABLE statement is to remove all records from a table. Since this is not possible in a partitioned stored procedure, VoltDB does not allow TRUNCATE TABLE statements within partitioned stored procedures. You can perform TRUNCATE TABLE statements in ad hoc or multi-partition procedures only.

Examples

The following example removes all data from the CURRENT_STANDINGS table:

TRUNCATE TABLE Current_standings;