Q: Let MySQL AFTER INSERT trigger fire after transaction finishes I have a mysql database, where entries are added in two related tables within an explicit transaction block. When the transaction finishes successfully (and only then), another process should be notified, about the new data.
To achieve this, I wrote a UDF, that notifies the other process via IPC. I also set up an AFTER INSERT trigger on one of the tables and the trigger calls the UDF.
I assumed, that the trigger will fire after the transaction finishes and the rows are actually inserted. However, it seems, it is executed immediately, after the INSERT statement was executed.
Is there some way to delay the execution of the trigger function until the rows are really actually globally inserted in the db (i.e. after the COMMIT)?
I guess, a workaround would be, to explicitly call the UDF after the COMMIT, but an automated approach would be much nicer.

A: Looking at the MySQL docs, it doesn't seem to be possible to define a trigger which runs after a transaction has been committed.
I think the rationale is that triggers are often used to make additional changes to the DB, so you'd almost always want them to run inside the transaction to avoid data integrity problems. 
It looks like this behavior is supported in other database systems, like Oracle, but if you're stuck with using MySQL, you'll have to call your UDF manually.
