MySQL Stored Procedure – no of times executed

execution-planMySQLstored-procedures

My question is simple, is there any way to calculate, number of times a stored procedure is called on applications or executed on MySQL server.

For example:

Procedure name: sptest

Executing procedure: call sptest(1);

Is there any way to identify number of time the statement CALL sptest(1) executed on server.

Thanks in advance.

Best Answer

Look I do it this way in an audit table, each time this function is executed I put it at the foot of the procedure and called each time the query is run.enter image description here

enter image description here

and consultation is : update audit set calls = calls + 1 where func = 'sptest' ;

In this way you can already know how many times was called and the date