information_schema.profiling学习
information_schema.profiling可以用来分析每一条SQL在它执行的各个阶段的用时,注意这个表是session 级的,也就是说如果session1 开启了它;session2没有开启
这个情况下session2 去查询只会返回一个空表
1、set @@ssesion.profiling=1 可以开启information_schema.profiling相关监测
2、information_schema.profiling 表的常用列
1、query_id :查询id 用于标记不同的查询
2、seq :一个查询内部执行的步骤
3、state :各个步骤的状态
4、duration :各个步骤持续的时间
5、cpu_user :用户空间的cpu 使用量
6、cpu_system :内核空间的cpu 使用量
7、swaps :swap 发生的次数
3、例子:
1、开启监测
set @@ssesion.profiling=1;
2、执行查询
select * from tempdb.t;
3、关闭监测
set @@ssesion.profiling=0;
4、查询监测到的数据
select-> query_id, -- 查询id 它用于标识一个查询-> seq, -- 显示序号-> (select sum(duration) from information_schema.profiling as innert where innert.query_id = outert.query_id) as total_cost , -- 总用时in seconds-> state,-- 状态-> duration, -- 持续时间-> cpu_user, -- 用户空间的cpu 使用量-> cpu_system, -- 内核空间的cpu 使用量-> -- context_voluntary, -- 自愿上下文切换-> -- context_involuntary, -- 非自愿上下文切换-> block_ops_in, -- 块调入次数-> block_ops_out, -- 块调出次数-> swaps -- 发生swap 的次数-> from-> information_schema.profiling as outert-> -> order by-> seq; +----------+-----+------------+----------------------+----------+----------+------------+--------------+---------------+-------+ | query_id | seq | total_cost | state | duration | cpu_user | cpu_system | block_ops_in | block_ops_out | swaps | +----------+-----+------------+----------------------+----------+----------+------------+--------------+---------------+-------+ | 1 | 2 | 0.001984 | starting | 0.000058 | 0.000000 | 0.000000 | 0 | 0 | 0 | | 1 | 3 | 0.001984 | checking permissions | 0.000010 | 0.000000 | 0.000000 | 0 | 0 | 0 | | 1 | 4 | 0.001984 | Opening tables | 0.000033 | 0.000000 | 0.000000 | 0 | 0 | 0 | | 1 | 5 | 0.001984 | init | 0.000018 | 0.000000 | 0.000000 | 0 | 0 | 0 | | 1 | 6 | 0.001984 | System lock | 0.000012 | 0.000000 | 0.000000 | 0 | 0 | 0 | | 1 | 7 | 0.001984 | optimizing | 0.000006 | 0.000000 | 0.000000 | 0 | 0 | 0 | | 1 | 8 | 0.001984 | statistics | 0.000014 | 0.000000 | 0.000000 | 0 | 0 | 0 | | 1 | 9 | 0.001984 | preparing | 0.000013 | 0.000000 | 0.000000 | 0 | 0 | 0 | | 1 | 10 | 0.001984 | executing | 0.000003 | 0.000000 | 0.000000 | 0 | 0 | 0 | | 1 | 11 | 0.001984 | Sending data | 0.000130 | 0.000000 | 0.000000 | 0 | 0 | 0 | | 1 | 12 | 0.001984 | end | 0.000009 | 0.000000 | 0.000000 | 0 | 0 | 0 | | 1 | 13 | 0.001984 | query end | 0.000008 | 0.000000 | 0.000000 | 0 | 0 | 0 | | 1 | 14 | 0.001984 | closing tables | 0.001613 | 0.002000 | 0.000000 | 0 | 0 | 0 | | 1 | 15 | 0.001984 | freeing items | 0.000037 | 0.000000 | 0.000000 | 0 | 0 | 0 | | 1 | 16 | 0.001984 | cleaning up | 0.000020 | 0.000000 | 0.000000 | 0 | 0 | 0 | +----------+-----+------------+----------------------+----------+----------+------------+--------------+---------------+-------+
转载于:https://www.cnblogs.com/JiangLe/p/5837038.html
information_schema.profiling学习相关推荐
- mysql profiling表_mysql8 参考手册-INFORMATION_SCHEMA PROFILING表
PROFILING表提供语句分析信息.其内容对应于SHOW PROFILE和SHOW PROFILES 语句产生的信息(请参见第13.7.7.30节" SHOW PROFILE语句" ...
- information_schema.columns 学习
information_schema.columns 学习 每一个表中的每一列都会在information_schema.columns表中对应一行 1.informaiton_schema.colu ...
- information_schema.triggers 学习
mysql实例中的每一个trigger 对应到information_schema.triggers 中有一行 1.information_schema.triggers 表的常用列: 1.trigg ...
- information_schema.routines 学习
information_schema.routines 用户查看mysql中的routine信息 1.information_schema.routines 表中的常用列: 1. 转载于:https: ...
- information_schema.character_sets 学习
information_schema.character_sets 表用于查看字符集的详细信息 1.character_sets 常用列说明: 1.character_set_name: 字符集名 2 ...
- information_schema.engines学习
当前mysql实例的存储引擎信息可以从information_schema.engines 中查询到 例子: mysql> select * from information_schema.en ...
- 学习SQL:INFORMATION_SCHEMA数据库
The best way how to explain what the INFORMATION_SCHEMA database is would be – "This is the dat ...
- mysql性能分析工具profiling_Mysql系列(十)—— 性能分析工具profiling
explain是从mysql怎样解析执行sql的角度分析sql优劣.profiling是从sql执行时资源使用情况的角度来分析sql. 分析SQL执行带来的开销是优化SQL的重要手段.在MySQL数据 ...
- mysql 5.7 引擎_MySQL 5.7 学习:功能性能的提升
1.9:多线程脏页刷写 innodb_page_cleaners,表示刷写BP脏页的线程数,5.6.2开始从master线程中独立出来,5.7.4之后开始支持多线程flush,默认是4.这个值必须小于 ...
- mysql语句性能开销检测profiling详解
转载自 mysql语句性能开销检测profiling详解 之前我介绍过msyql查询优化explain检查命令的使用,explain主要是检查sql语句的基本性能,sql是否优秀,但不能查看具体的涉及 ...
最新文章
- c语言用法 我说火罐火车 刘华火车,五塘村社区建“火车头广场”
- windos中加入redis
- 游标卡尺尺身的刻度间距为_【物业】游标卡尺使用及读数方法
- 使用BigDecimal进行精确运算
- java8-新特性default
- 复制(主从复制、读写分离)
- js (jQuery)分组数据
- matlab矩阵的低秩分解,低秩分解的matlab代码看不懂,分解的两个矩阵在哪呀??...
- VBA代码执行过程中,显示程序的运行状态
- javascript焦点图自动播放
- 电子设计大赛音频信号分析仪
- 在linux中重启网络服务的命令,linux重启网络命令
- Mac自带Safari浏览器如何清除缓存
- TCP/IP网络编程:计算器服务器端/客户端
- 将Maven仓库地址修改为阿里云的仓库地址
- 首批!工信部下达2021年国家工业专项节能监察任务,涉及270 个数据中心(附名单)...
- Elasticsearch 使用同义词 一
- 计算机考研专硕好考还是学硕好考,考研是学硕难考还是专硕难考?很多人都猜错了...
- 图解AUTOSAR(六)——服务层(Service Layer)、复杂驱动(Complex Drivers)
- 云计算进入深水区, MSP才是政企用好云的生力军
热门文章
- JavaScript数组的某些操作(二)
- 数据库sql语句杂谈
- C# HttpClient Multipart 上传文件
- 链表常见算法题总结(Java)
- 测度定义_测度论浅谈
- FISCO BCOS(三)——— 部署及调用HelloWorld合约
- 乔安监控电脑客户端_公司上网监控使用安装电脑监控软件?
- linux装go环境脚本,linux中用shell快速安装配置Go语言的开发环境
- php定量,javascript - js 无序数组 任意个数 相加之和为定量m?
- php 导入excal,php导入excel php使用phpexcel导入excel文件