Strengths and Weaknesses of Triggers / Advantages and Disadvantages of using Triggers / Merits and Demerits of Trigger mechanisms
Strengths and Weaknesses of Triggers / Trigger mechanisms
- Used for enforcing referential integrity.
- Easy to implement business rules through triggers.
- Event logging is easier.
- It can control transactions hence lead to safer transactions.
- Consistency is maintained.
- Efficiency in performing transactions.
- Cascading referential integrity.
- Implicitly called for actions during database changes. Very much helpful in a case where many changes need to be done on different tables for a single action.
- Triggers should be written with extra care. Trigger error may lead to failure of insert, delete, or update operations at runtime.
- Excessive use of triggers can result in complex interdependencies. For example, cascading triggers can induce chain of actions.
- Increased complexity.
- May decrease the performance of the database.
- Every time a trigger is fired, its code must be recompiled.
- Database triggers can be accidentally disabled or dropped by a person with sufficient privilege.
- The hidden nature of triggers is another important weakness.