views:

86

answers:

2

In MySQL (particularly InnoDB) is there any way to know which tables were affected (updated / deleted rows) by CASCADE UPDATES / DELETES or regular triggers?

A: 

Show the cascades and constraints:

mysql> SHOW CREATE TABLE tablename;

Show triggers:

mysql> USE dbname;
mysql> show triggers;
randy melder
A: 

As far as I know, there's no built-in solution for that. If you want to know which triggers have been fired you'll have to call your own logging functions from the triggers themselves. As for cascaded UPDATE/DELETE, they don't fire triggers so short of digging through the binlog I don't see how you can know which rows have been UPDATEd or DELETEd.

Josh Davis
I don't care about knowing which rows were affected, **affected tables** is what I'm looking for.
Alix Axel