Q32: What are Database Triggers, and what are their drawbacks?
A Trigger is a procedural routine that executes automatically when specific schema events (INSERT, UPDATE, DELETE) occur on a target table.
Common Use Cases
- Audit logging and tracking record modifications over time.
- Enforcing complex domain validation rules across relational boundaries.
Operational Drawbacks
- Hidden side effects that complicate debugging and codebase maintenance.
- Row-level triggers execute iteratively, increasing latency during bulk batch operations.
Key Takeaways
- Triggers enforce cross-table validation and maintain audit trails automatically.
- Overusing triggers adds hidden performance overhead to write operations.