Xdebug/CacheGrind but for MySQL?
Is there some way of checking which queries in an application are slow and could be optimized using some sort of tool that would, as unobtrusively as possible, allow you to click through a web application and track the performance of the queries within it?
I'm using PHP PDO with prepared statem开发者_StackOverflowents to run the queries and the application is currently running on a test server on Ubuntu 9.10.
Try firePhp as the DB profiler tool http://www.firephp.org/
Not really unobtrusive is the way to configure mysql to create a slowquery-log and set the long_query_time to 0 (or something very low).
Afterwards you can analyse this file with pt-query-digest which is part of the percona-toolkit.
I don’t know, if this slows down your query at all, but I recommend the usage of this configuration only in development-environments anyway.
Links:
- http://dev.mysql.com/doc/refman/5.7/en/slow-query-log.html
- https://www.percona.com/doc/percona-toolkit/2.2/pt-query-digest.html
- http://packages.ubuntu.com/search?keywords=percona-toolkit&searchon=names&suite=all§ion=all
- http://packages.debian.org/search?keywords=percona-toolkit&searchon=names&suite=all§ion=all
- https://rtcamp.com/tutorials/mysql/slow-query-log/
精彩评论