Introduction to Triggers

Robert Haas

PostgreSQL supports trigger functions, which allow you to execute arbitrary user-defined code before or after each INSERT, UPDATE, or DELETE. In this talk, I'll review some common uses for triggers, including (1) maintaining counts and sums, (2) improving performance using denormalization, and (3) logging and auditing. All examples will be written in PL/pgsql.

Introduction to Triggers.odp280.86 KB