Search This Blog

Thursday, May 2, 2013

Tip of the day: %TruncateTable

One of my colleague was asking the other day why we have to use %TruncateTable instead of DELETE. The below pb line has the answer.
  • On all databases, the use of %TruncateTable causes an implicit commit.
  • The rows deleted by this command, and any other pending database updates, are all committed.
  • Execution is faster than either of the SQL statements.
To postpone the commit until subsequent database updates have been successfully completed, use the SQL statement DELETE FROM table_name or the statement IMPORT REPLACE WITH NULL instead of %TruncateTable(table_name).

No comments:

Post a Comment