content_image/791115.jpg content_image/791124.jpg
<img src='content_image/791115.jpg'>

3. Query memory instrument data. In this example, memory instrument data is queried in the Performance Schema memory_summary_global_by_event_name  table, which summarizes data by EVENT_NAME . The EVENT_NAME  is the name of the instrument. 

The following query returns memory data for the InnoDB  buffer pool. For column descriptions, see Section 27.12.20.10, “Memory Summary Tables” . 

mysql> SELECT * FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE ’memory/innodb/buf_buf_pool’\G EVENT_NAME: memory/innodb/buf_buf_pool COUNT_ALLOC: 1 COUNT_FREE: 0 SUM_NUMBER_OF_BYTES_ALLOC: 137428992 SUM_NUMBER_OF_BYTES_FREE: 0 LOW_COUNT_USED: 0 CURRENT_COUNT_USED: 1 HIGH_COUNT_USED: 1 LOW_NUMBER_OF_BYTES_USED: 0 CURRENT_NUMBER_OF_BYTES_USED: 137428992 HIGH_NUMBER_OF_BYTES_USED: 137428992 

The same underlying data can be queried using the sys  schema memory_global_by_current_bytes  table, which shows current memory usage within the server globally, broken down by allocation type. 

mysql> SELECT * FROM sys.memory_global_by_current_bytes WHERE event_name LIKE ’memory/innodb/buf_buf_pool’\G *************************** 1. row *************************** event_name: memory/innodb/buf_buf_pool current_count: 1 current_alloc: 131.06 MiB current_avg_alloc: 131.06 MiB high_count: 1 high_alloc: 131.06 MiB high_avg_alloc: 131.06 MiB 

This sys  schema query aggregates currently allocated memory ( current_alloc ) by code area: 

mysql> SELECT SUBSTRING_INDEX(event_name,’/’,2) AS code_area, FORMAT_BYTES(SUM(current_alloc)) AS current_alloc FROM sys.x$memory_global_by_current_bytes GROUP BY SUBSTRING_INDEX(event_name,’/’,2) ORDER BY SUM(current_alloc) DESC; 

<img src='content_image/791124.jpg'>

