如何定位RDS MySQL内存使用率高?

打开performance_schema
控制台可开
在这里插入图片描述

打开内存监控
update performance_schema.setup_instruments set enabled = ‘yes’ where name like ‘memory%’;
查看监控
select * from sys.x m e m o r y b y h o s t b y c u r r e n t b y t e s ; s e l e c t f r o m s y s . x memory_by_host_by_current_bytes ; select * from sys.x memory_by_thread_by_current_bytes ;
select * from sys.x m e m o r y b y u s e r b y c u r r e n t b y t e s ; s e l e c t f r o m s y s . x memory_by_user_by_current_bytes ; select * from sys.x memory_global_by_current_bytes ;
select * from sys.x$memory_global_total ;
event_name
内存事件名称。

current_count
事件发生的总次数。

current_alloc
事件尚未释放的已分配字节的当前数目。

current_avg_alloc
为事件的每个内存块分配的当前字节数。

high_count
分配给事件的内存块数量的最高标记。

high_alloc
为事件分配的字节数的高水位标记。

high_avg_alloc 为事件分配的每个内存块的平均字节数的最高标记。