Extended Parallel Server supports a different implementation of TRUNCATE, as the 4section TRUNCATE (XPS) describes.
44 .-TABLE-. 4>>-TRUNCATE--+-------+--+----------+--+-table---+---------------> 4 '-'owner.'-' '-synonym-' 4 4 .-DROP STORAGE--. 4>--+---------------+------------------------------------------->< 4 '-REUSE STORAGE-' 44 4 4 4
Element | 4Description | 4Restrictions | 4Syntax | 4
---|---|---|---|
owner | 4Owner of table or synonym | 4See Usage notes. | 4Owner Name, p. Owner Name | 4
synonym | 4Synonym for the table from which to remove all data | 4Must exist, and USETABLENAME must 4not be set | 4Identifier, p. Identifier | 4
table | 4Name of table from which to remove all data and all B-tree 4structures of its indexes | 4Must exist in the database | 4Identifier, p. Identifier | 4
The TRUNCATE statement rapidly deletes from a local table all active data 4rows and the B-tree structures of indexes on the table. You have the 4option of releasing the storage space that was occupied by the rows and index 4extents, or of reusing the same space when the table is subsequently repopulated 4with new rows.
4To execute the TRUNCATE statement, you must be the owner of the table, 4or else hold DBA access privilege on the database. You must also hold Delete 4privilege on the table. If an enabled Delete trigger is defined on the table, 4the Alter privilege is also required, even though TRUNCATE does not activate 4triggers.
4Although it requires the Delete privilege, TRUNCATE is a data definition 4language (DDL) statement. Like other DDL statements, TRUNCATE cannot operate 4on any table outside the database to which you are connected, nor on a table 4that a concurrent session is reading in Dirty Read isolation mode.
4Dynamic Server always logs the TRUNCATE operation, even for a non-logging 4table. In databases that support transaction logging, only the COMMIT WORK 4or ROLLBACK WORK statement of SQL is valid after the TRUNCATE statement within 4the same transaction.
4When you rollback a TRUNCATE statement, no rows are removed from the table, 4and the storage extents that hold the rows and index partitions continue to 4be allocated to the table. Only databases with transaction logging can support 4the ROLLBACK WORK statement.
4After the TRUNCATE statement successfully executes, Dynamic Server automatically 4updates the statistics and distributions for the table and for its indexes 4in the system catalog to show no rows in the table nor in its dbspace partitions. 4It is not necessary to run the UPDATE STATISTICS statement immediately after 4you commit the TRUNCATE statement.
4If the table that the TRUNCATE statement specifies is a typed table, a 4successful TRUNCATE operation removes all the rows and B-tree structures 4from that table and from all its subtables within the table hierarchy.
4The TRUNCATE statement does not reset the serial value of SERIAL or SERIAL8 4columns. To reset the counter of a serial column, you must do so explicitly 4by using the MODIFY clause of the ALTER TABLE statement, either before or 4after you execute the TRUNCATE statement.
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]