This article explains how to avoid performance issues when using MySQL triggers. Triggers are used to log changes into audit tables.
For Adobe Commerce on cloud projects, always test configuration changes in the Staging environment before changing the configuration for the Production environment.
Triggers are interpreted as code meaning that MySQL does not precompile them.
Hooking into the query’s transaction space, triggers add overhead to a parser and interpreter for each query performed with the table. The triggers share the same transaction space as the original queries, and while those queries compete for locks on the table, the triggers independently compete for locks on another table.
This additional overhead can negatively impact site performance on the site if many triggers are used.
Adobe Commerce does not support any custom triggers in the Adobe Commerce database because custom triggers can introduce incompatibilities with future Adobe Commerce versions. For best practices, see General MySQL Guidelines in the Adobe Commerce documentation.
To prevent performance issues when using triggers, follow these guidelines:
SHOW TRIGGERS
SQL Statement.