memory_global_total,x$memory_global_total - xiaoboluo768/mysql-system-schema GitHub Wiki

  • 当前总内存使用量统计(注意:只包含自memory类型的instruments启用以来被监控到的内存事件,在启用之前的无法监控,so..如果你不是在server启动之前就在配置文件中配置启动memory类型的instruments,那么此值可能并不可靠,当然如果你的server运行时间足够长,那么该值也具有一定参考价值),数据来源:memory_summary_global_by_event_name

  • memory_global_total和x$memory_global_total视图字段含义如下:

    • total_allocated:在server中分配的内存总字节数
  • 视图定义语句

# memory_global_total
CREATE OR REPLACE
  ALGORITHM = TEMPTABLE
  DEFINER = 'root'@'localhost'
  SQL SECURITY INVOKER
VIEW memory_global_total (
  total_allocated
) AS
SELECT sys.format_bytes(SUM(CURRENT_NUMBER_OF_BYTES_USED)) total_allocated
  FROM performance_schema.memory_summary_global_by_event_name;

# x$memory_global_total
CREATE OR REPLACE
  ALGORITHM = TEMPTABLE
  DEFINER = 'root'@'localhost'
  SQL SECURITY INVOKER
VIEW x$memory_global_total (
  total_allocated
) AS
SELECT SUM(CURRENT_NUMBER_OF_BYTES_USED) total_allocated
  FROM performance_schema.memory_summary_global_by_event_name;
  • 视图查询信息示例
admin@localhost : sys 10:07:22> select * from memory_global_total limit 3;
+-----------------+
| total_allocated |
+-----------------+
| 168.91 MiB      |
+-----------------+
1 row in set (0.01 sec)

admin@localhost : sys 10:08:24> select * from x$memory_global_total limit 3;
+-----------------+
| total_allocated |
+-----------------+
|      177099388 |
+-----------------+
1 row in set (0.00 sec)

上一篇: memory_global_by_current_bytes,x$memory_global_by_current_bytes视图 |

下一篇: metrics视图