Allow listening to query execution and execution times
Description
Activity
Show:
Christian Beikov April 5, 2024 at 3:47 PM
ORM 6.4 introduced a JFR module which reports exactly that information
Out of Date
Details
Details
Assignee
Unassigned
UnassignedReporter
Philippe Marschall
Philippe MarschallComponents
Priority
Created April 5, 2020 at 11:51 AM
Updated April 5, 2024 at 3:47 PM
Resolved April 5, 2024 at 3:47 PM
When analyzing performance issues it is helpful to know which SQL queries have been executed and how log they took. The current mechanisms offered by Hibernate are inadequate for building custom tools.
Slow query logging is not extensible, if you want to have access to the information you need to write a custom log appender and parse the log message, see https://discourse.hibernate.org/t/custom-sqlstatementlogger/3881.
`StatementInspector` does not have access to the execution time .
In our specific case we would like the generate a JFR event recording the query and its execution time. This can then be combined with other JFR events to find you which queries for executed for processing a single request, how often they were executed and how long their execution took.