When to Use Statement Triggers - Analytics Database - Teradata Vantage

SQL Data Definition Language Detailed Topics

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
vuk1628111288877.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1184
lifecycle
latest
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.