Skip to content

Instantly share code, notes, and snippets.

@hidemifukamachi
Last active December 3, 2019 01:38
Show Gist options
  • Save hidemifukamachi/9e9cd5d91d1278ec4bc774eb0b7eacef to your computer and use it in GitHub Desktop.
Save hidemifukamachi/9e9cd5d91d1278ec4bc774eb0b7eacef to your computer and use it in GitHub Desktop.
performance_schemaを使って何がメモリをつかっているか見たときのクエリ。
mysql> SELECT a.*, alloc - free FROM (SELECT EVENT_NAME, sum(SUM_NUMBER_OF_BYTES_ALLOC) as alloc, sum(SUM_NUMBER_OF_BYTES_FREE) as free FROM memory_summary_global_by_event_name group by EVENT_NAME) as a order by 4 desc limit 10;
+--------------------------------------------------------------------+----------------+----------------+--------------+
| EVENT_NAME | alloc | free | alloc - free |
+--------------------------------------------------------------------+----------------+----------------+--------------+
| memory/innodb/buf_buf_pool | 51673300992 | 0 | 51673300992 |
| memory/innodb/hash0hash | 1373380928 | 0 | 1373380928 |
| memory/innodb/memory | 98861879433816 | 98861643428808 | 236005008 |
| memory/temptable/physical_ram | 7233077248 | 7098859520 | 134217728 |
| memory/temptable/physical_disk | 2239818104832 | 2239687032832 | 131072000 |
| memory/performance_schema/events_errors_summary_by_thread_by_error | 69892000 | 0 | 69892000 |
| memory/mysys/KEY_CACHE | 67110592 | 0 | 67110592 |
| memory/performance_schema/events_statements_summary_by_digest | 41600000 | 0 | 41600000 |
| memory/sql/TABLE | 652729477318 | 652691144739 | 38332579 |
| memory/performance_schema/table_handles | 28508160 | 0 | 28508160 |
+--------------------------------------------------------------------+----------------+----------------+--------------+
10 rows in set (0.01 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment