๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

Databases Intermediate

What is Trigger?

A database object that automatically executes a specified function when certain events (INSERT, UPDATE, DELETE) occur on a table.

Triggers run automatically in response to data changes. They can execute BEFORE or AFTER the triggering event, and operate on each row or once per statement. Common uses include audit logging, data validation, maintaining derived data, and enforcing complex business rules.

In PostgreSQL, triggers call trigger functions written in PL/pgSQL. While powerful, overuse of triggers can make database behavior hard to debug and predict. Consider application-level logic for complex business rules.

Related Terms

Graph Database
A database that uses graph structures with nodes, edges, and properties to store and query highly connected data.
Normalization
The process of organizing database tables to reduce data redundancy and improve data integrity.
PostgreSQL
An advanced open-source relational database known for its reliability, feature richness, and standards compliance.
Replication
The process of copying and maintaining database data across multiple servers for redundancy, failover, and read scaling.
MVCC (Multi-Version Concurrency Control)
A technique where the database maintains multiple versions of data to allow concurrent reads and writes without locking.
SQL
Structured Query Language โ€” the standard language for managing and querying data in relational databases.
View All Databases Terms โ†’