When to Use Statement Triggers - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
imq1591724555718.ditamap
dita:ditavalPath
imq1591724555718.ditaval
dita:id
B035-1184
lifecycle
previous
Product Category
Teradata Vantage™

Statement triggers are often a better choice than row triggers for multirow operations like an INSERT ... SELECT statement because their triggered action is executed only once, while the triggered action for a row trigger is executed once per each qualifying row of the transition table, which can impact performance negatively.

The WHEN condition is tested only once in statement triggers, and it might access information from OLD TABLE or NEW TABLE columns as well as columns from the triggering table.

Because the WHEN condition must provide a single result, aggregation is a typical use for OLD TABLE and NEW TABLE column references.

Although statement triggers fire only once, the join conditions created by WHEN conditions can have a performance impact. Note that specifying an OLD_NEW_TABLE reference, which is valid only for UPDATE AFTER statement triggers, eliminates a join operation and often eliminates the need for WHERE clause filtering conditions.