查看主机和会话信息

查看主机和会话信息

一、主机连接信息(host_summary)
mysql> select * from sys.host_summary \G;
*************************** 1. row ***************************
                  host: ip131
            statements: 255
     statement_latency: 1.23 m
 statement_avg_latency: 289.51 ms
           table_scans: 69
              file_ios: 106581
       file_io_latency: 37.22 s
   current_connections: 2
     total_connections: 4
          unique_users: 3
        current_memory: 0 bytes
total_memory_allocated: 0 bytes

输出项说明

# host :连接到 MySQL 实例的主机的 IP
# statements :主机 IP 执行总的 SQL 语句数量
# statement_latency :主机 IP 执行 SQL 语句消耗的总时间
# statement_avg_latency :主机的每个语句的平均等待时间。
# table_scans :主机的表扫描总数。
# file_ios :主机的文件I / O事件总数。
# file_io_latency :主机文件I / O事件的总等待时间。
# current_connections :主机的当前连接数。
# total_connections :主机的连接总数。
# unique_users :主机的独立用户数。
# current_memory :当前为主机分配的内存量。
# total_memory_allocated :主机分配的内存总量。
二、查看连接和会话相关信息(sys.session)

​ 查询 sys.session可以得到会话的 ID 、连接用户信息、连接时间、查询影响行数、返回行数、最后执行 SQL 等信息。

mysql> select * from sys.session where conn_id=11 \G;
*************************** 1. row ***************************
                thd_id: 36
               conn_id: 11
                  user: root@localhost
                    db: test
               command: Sleep
                 state: NULL
                  time: 1586
     current_statement: update a1 set b=2222222222 where id=10001
     statement_latency: NULL
              progress: NULL
          lock_latency: 124.00 us
         rows_examined: 0
             rows_sent: 0
         rows_affected: 0
            tmp_tables: 0
       tmp_disk_tables: 0
             full_scan: NO
        last_statement: update a1 set b=2222222222 where id=10001
last_statement_latency: 16.69 m
        current_memory: 0 bytes
             last_wait: NULL
     last_wait_latency: NULL
                source: NULL
           trx_latency: NULL
             trx_state: NULL
        trx_autocommit: NULL
                   pid: 7741
          program_name: mysql
1 row in set (0.05 sec)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值