Progress
Database Design
Guide
Triggers versus Constraints
Triggers are ideal for enforcing referential integrity because they are automatic. In this regard, they are similar to constraints since both triggers and constraints can help ensure that a value stored in the foreign key of a table must either be null or be equal to some value in the matching unique or primary key of another table.
Triggers differ from constraints in the following ways:
- Triggers are active.
Constraints are passive. While constraints prevent updates that violate referential integrity, triggers perform explicit actions in addition to the update operation.
- Triggers do more than enforce referential integrity.
Because they are passive, constraints are limited to preventing updates within a narrow set of conditions. Triggers are more flexible. However, performance may suffer.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |