Trigger Efficiency
Executing actions using a trigger is usually more effective than explicit execution of the same actions by a client. However, there are differences in trigger effects:
- AFTER INSERT and BEFORE DELETE triggers are most efficient. Execution of these triggers will save server resources.
- AFTER DELETE and AFTER UPDATE triggers are efficient too. Execution requires only copying certain rows from the database into transient variables.
- BEFORE INSERT a BEFORE UPDATE triggers will somewhat slow down operation execution, because they force the server to execute the INSERT or UPDATE operation in a less effective way in order to correctly create transient variables.
It does not matter if you use BEFORE or AFTER triggers in many situations. You can use the description above to make server operation more efficient.