Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Is possible to obtain used memory in a running query?

Something like:

mysql> SELECT MEMORY_PEAK as memory; #return memory usage by mysql before run query
mysql> SELECT id FROM table WHERE id>2; #run query
mysql> SELECT MEMORY_PEAK as memory; #return memory usage by mysql after run query

and return something like (return 17kb):

+----------+
|  memory  |
+----------+
|  20100   |
+----------+

+------+
|  id  |
+------+
|  3   |
+------+

+----------+
|  memory  |
+----------+
|  2026767 |
+----------+

or

mysql> USAGE SELECT id FROM table WHERE id>2;

and return something like (return 17kb):

+---------+
|  USAGE  |
+---------+
|  16767  |
+---------+

Is this possible?

I need it to do various tests and see which engines queries and performs better (personal experience).

share|improve this question
1  
@tombom I disagree. The question is quite straightforward: "is there a way to directly ask MySQL about memory usage by a specific query?" –  Michael - sqlbot Jan 11 at 15:42
add comment

1 Answer

The answer appears to be "not yet."

It looks like this is being added to MySQL Server 5.7.

http://dev.mysql.com/doc/refman/5.7/en/memory-summary-tables.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.