patternsqlModerate
What is a “transition table" in Postgres?
Viewed 0 times
tabletransitionwhatpostgres
Problem
The page describing what's new in Postgres 10 mentions “Transition Tables for Triggers”.
Transition Tables for Triggers
This feature makes
What is a transition table?
Transition Tables for Triggers
This feature makes
AFTER STATEMENT triggers both useful and performant by exposing, as appropriate, the old and new rows to queries. Before this feature, AFTER STATEMENT triggers had no direct access to these, and the workarounds were byzantine and had poor performance. Much trigger logic can now be written as AFTER STATEMENT, avoiding the need to do the expensive context switches at each row that FOR EACH ROW triggers require.What is a transition table?
Solution
You know how there are
Transition tables are the
OLD and NEW record-variables for FOR EACH ROW triggers?Transition tables are the
FOR EACH STATEMENT equivalents. They're tables with the old and new tuples, so your triggers can see what changed.Context
StackExchange Database Administrators Q#177463, answer score: 16
Revisions (0)
No revisions yet.