Bug #65173 Provide per-thread memory usage statistics
Submitted: 2 May 2012 5:52 Modified: 26 Aug 2013 8:32
Reporter: Lixun Peng (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S4 (Feature request)
Version:5.6.6 OS:Any
Assigned to: Marc ALFF CPU Architecture:Any
Tags: Contribution, PROCESSLIST

[2 May 2012 5:52] Lixun Peng
Description:
I always found my MySQL use many memory, even though Buffer Pool is small. So I think Server used many memory.
I developed a patch that can display how many memory used of threads.
Expect this, I think how many sort_buffer/join_buffer/net_buffer memory used of threads are also need display, it will let DBAs know the memory cost detail.

This is my patch effect:

root@localhost : information_schema 01:48:45> select id,info,mem_usage from information_schema.processlist;
+----+--------------------------------------------------------------+-----------+
| id | info                                                         | mem_usage |
+----+--------------------------------------------------------------+-----------+
|  3 | select id,info,mem_usage from information_schema.processlist |     55248 |
|  1 | NULL                                                         |     13536 |
+----+--------------------------------------------------------------+-----------+
2 rows in set (0.00 sec)

How to repeat:
When you run many query that must use sort_buffer/join_buffer/tmp_table, you will found memory usage grow up very fast.
[2 May 2012 5:53] Lixun Peng
5.6_thread_mem_usage_ver2.patch

Attachment: 5.6_thread_mem_usage_ver2.patch (application/octet-stream, text), 5.00 KiB.

[9 May 2012 16:09] Valeriy Kravchuk
Thank you for the feature request and patch contributed.
[26 Aug 2013 8:31] Marc ALFF
The performance schema now also instrument memory, see

http://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-2.html