views:

15

answers:

0

Around the time of a release I saw in Munin that the number of queries increased dramatically, on a regular frequency. These aren't slow queries. Rather than doing the brute force method of going over my code to see what is causing the excessive number of queries, I'd like to know if there's an open source solution that can monitor a running database and report on query frequency.

I've seen scripts (typically Perl) that listen on port 3306 and output the traffic stream. It seems easy enough to write a script to monitor constantly or in bursts and then either log the queries to determine query frequency later, or more ideally process the queries and store the frequency in another database like sqlite. I suppose this could be achieved by turning on MySql query logging but I'd prefer a solution that a) doesn't require restarting MySql, and b) can be configurable so that I could run it only at night (again, my queries occurring frequently) or in bursts.