Mysql – How many times trigger in MySQL is called

mysqlsqltriggers

I have a trigger on INSERT in MySQL 5.1. I want to know, how many times per second is it called. How can I do this?

Best Solution

Your best bet is to keep inserting into a table.

INSERT INTO trigger_log(query) VALUES(?)

This table has a datetime column that will automatically be updated, then you can do various queries to determine how many times/minute or hour, what period had the highest number of calls, etc.

Otherwise just update a table that has a column for day, hour, min, counter and just increment the counter for the current day/hour/min.

I don't like the second one as much as there is so much potential information being lost, but it would do what you want also.