Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
Please add the ability to track "slow" stored procedures in slow query log.
Perhaps this could be backported from Percona Server.
They currently have the option:
log_slow_sp_statements
If TRUE, statements executed by stored procedures are logged to the slow if it is open.
There are quite a few more details listed there which may help shed light on the implementation, such as:
Prior to 5.5.41-37.0 implementation of logging stored procedures was logging the stored procedure CALLs themselves along with the queries inside the procedures. This meant that some queries were counted more than once which could make tracking the bad-performing queries harder and it would cause noise in the slow query log. Percona Server 5.5.41-37.0 implemented improvements for logging of stored procedures to the slow query log:
- Each query from a stored procedure is now logged to the slow query log individually
- CALL itself isn’t logged to the slow query log anymore as this would be counting twice for the same query which would lead to incorrect results
- Queries that were called inside of stored procedures are annotated in the slow query log with the stored procedure name in which they run.