Find Queries with huge Result-Set

Hello,
we are using MySQL as DB for our CMS. Lately I noticed a massive growth in Traffic between our HTTP <–> DB Server.
Normally we got about 10MBit/s but since a few Days it’s over 100MBit/s … My first guess would be a Query which delivers a really huge Result-Set back to the HTTP Server - but I’m unable to find out which Query this could be (hundreds of Queries / Second)
Already searched hours for an Answer - but no luck so far … so I hope someone here can help me finding the Bogus Query … :wink:
Thank you, bye from sunny Austria
Andreas Schnederle-Wagner

Andreas, thanks for posting. I’d like to direct you firstly to the slow log facility inside MySQL. With this enabled at the right rate, you can capture large or long running queries. Once you’re confident that the log has the right sized sample to provide some insight, it’s time to work with the Percona Toolkit script called pt-query-digest. This tool will analyse your slow file and produce a report to show you a break down of what’s contained in the file. This will reveal queries that may need some tuning. There’s plenty of scope for researching options and variable of pt-query-digest, however it’s quite likely that even the defaults will provide you with some low hanging fruit.

Whilst this blog post is a little old, it still holds truth.

[url]https://www.percona.com/blog/2011/12/29/identifying-the-load-with-the-help-of-pt-query-digest-and-percona-server/[/url]

I would recommend reviewing this and translating to tasks for you to identify what’s occurring on the server.

BR

Andrew

Hey Andrew,

thank you for your really fast Answer! :wink:
Unfortunately on this Server MariaDB is in use (as it’s delivered with RHEL) - so no “log_slow_verbosity=full:” which outputs the “Bytes_Sent” is available! :frowning:
Will propose swap to Percona Server the next Meeting because of the extended debug abilities … (but this won’t be possible in the short term)

Any other ideas on how to find out which Query is going bogus here?

Thank you, bye from Austria
Andreas

Hey mirfan,
using Version 10.1.21 on this Server. Unfortunately (if it didn’t overlook something) it only supports “innodb,query_plan,explain” for Slow Log Verbosity! :-/
Already analyzing Slow Log Output with pt-query-digest - but it seems the traffic generating Query isn’t within the Top XX Queries of that Server … :-/
Andreas

Yes, for MariaDB it only supports “query_plan, innodb, explain”.
However, you can filter output from Rows_sent column to get an hint which query generates huge result set.

Hi mirfan,
thx for the Tip with rows_sent … this did the trick! :wink:
bye from Austria
Andreas