Is there a way to tell how much total memory MySQL used to construct a result set from a single query? What I'm looking for is something similar to php's memory_get_peak_usage().
I have a complex query that produces a few rows of summed data. The actual result set is tiny -- 6 or 8 rows of a floating decimal value. But the query I use to generate those values is rather complex -- it uses sums, grouping, subqueries, etc. over a large data set.
People have suggested using EXPLAIN and then estimating rows size from there. That sounds error-prone to me; I'm not sure I could figure it out anyway.
Is there a way to do this?