Reputation: 1788
We have a web application (Tomcat/Spring/Hibernate) running against a MySQL database. Every once in a while, the application runs a data-driven query that takes a huge amount of time to complete. Right now, we have no way to track them without logging ALL the queries, which would be a huge number (very busy app.) The only way we can identify a query is if it actually times out, then we get a org.apache.tomcat.jdbc.pool.ConnectionPool abandon
warning.
Is there some way in Tomcat, Spring or Hibernate to track only queries that take over a certain time to execute?
Upvotes: 1
Views: 565
Reputation: 6566
Session factory has getStatistics() method to know all kinds of statistics. Find about it here. You may be interested in stats.getQueryExecutionMaxTime()
method.
Upvotes: 1
Reputation: 16953
MySQL has a slow query log. Enable that if it isn't already.
http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html
Upvotes: 1