My task is to collect performance data about a single query,
using PERFORMANCE_SCHEMA
(P_S for short) in MySQL,
to ship it elsewhere for integration with other data.
In a grander scheme of things, I will need to define what performance data from a query I am actually interested in. I will also need to find a way to attribute the query (as seen on the server) to a point in the codebase of the client, which is not always easy when an ORM or other SQL generator is being used. And finally I will need to find a way to view the query execution in the context of the client code execution, because the data access is only a part of the system performance.
This is about marking a query so that it can be identified in source and attributed to its origin in the codebase.
In my scenario, I have control over the ORM or DAO. I can look at
the stack frame, identify the caller of the execute
function and put …