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 |
+----------+-----+------------+----------------------+----------+----------+------------+--------------+---------------+-------+
information_schema.profiling学习的更多相关文章
- INFORMATION_SCHEMA.PROFILING
24.18 The INFORMATION_SCHEMA PROFILING Table PROFILING表提供了语句分析信息. 其内容对应于SHOW PROFILES和SHOW PROFILE语句 ...
- mysql执行update报错 Err] 1055 - 'information_schema.PROFILING.SEQ' isn't in GROUP BY
mysql执行update报错 Err] 1055 - 'information_schema.PROFILING.SEQ' isn't in GROUP BY 今天开发的同事发来如下错误信息,最最简 ...
- mysql遇见contains nonaggregated column 'information_schema.PROFILING.SEQ'异常
报错如下:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggrega ...
- 解决mysql报错:- Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ'
mysql执行报错: - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c ...
- mysql [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GRO
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c ...
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ'
在Navicat Premium中执行Mysql的一条删除语句,虽然执行成功了,却提示已下错误: 受影响的行: 时间: .005s of ORDER BY clause is not in GROUP ...
- MySQL- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GR
新建的mysql,在查询时报异常信息,虽然有正常执行结果. [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY claus ...
- information_schema.referential_constraints 学习
information_schema.referential_constraints 表用于查看外键约束 1.information_schema.referential_constraints表的常 ...
- information_schema.optimizer_trace学习
information_schema.optimizer_trace 用于追踪优化器的优化过程:通常来说这张表中是没有数据的,要想开户追踪要把 @@session.optimizer_trace='e ...
随机推荐
- Virtual Box 工具栏(菜单栏)消失的解决方法
异常处理汇总-开发工具 http://www.cnblogs.com/dunitian/p/4522988.html 现在Virtual Box非常牛逼(不排除Oracle又准备像Java SE那样 ...
- linux虚拟机网络连接模式 bridged, host-only, NAT
最近安装了fedora9.0,却一直不能连接到外网,我用的是3G无线网卡上网的,起初以为是linux不支持3G无线方式的,可后来装了虚拟机ubuntu却可以上网,在后来用有ADSL网络连接的电脑安装f ...
- LeetCode_Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. /* ...
- [置顶] Responder一点也不神秘————iOS用户响应者链完全剖析
这篇文章想跟大家分享的主旨是iOS捕获用户事件的各种情况,以及内部封装的一些特殊事件. 我们先从UIButton谈起,UIButton大家使用的太多了,他特殊的地方就在于其内置的普通Default/高 ...
- 低效的SQL引发的cache buffers chains latch
1.低效的SQL 低效的SQL语句时发生cache buffers chains 锁存器争用的最重要原因.多个进程同时扫描大范围的索引或表时,可能广泛 地发生cache buffers chains ...
- What’s the difference between an interface and an abstract class in Java?
原文 What’s the difference between an interface and an abstract class in Java? It’s best to start answ ...
- OpenStack Mixture HypervisorsDriver configure and implementation theory
通过本文,您将可以了解在 OpenStack 中如何进行混合 Hypervisor 的配置及其实现原理的基本分析.本文主要结合作者在 Nova 中的实际开发经验对 OpenStack 中混合 Hype ...
- Java中ThreadLocal无锁化线程封闭实现原理
虽然现在可以说很多程序员会用ThreadLocal,但是我相信大多数程序员还不知道ThreadLocal,而使用ThreadLocal的程序员大多只是知道其然而不知其所以然,因此,使用ThreadLo ...
- ssh登录失败处理步骤
如果登录失败而又找不到显示的原因,优先使用ssh -vT name@ip -p port 进行调试,查看所使用的key文件.ip.端口是否正确.然后再检查下面步骤:1.检查在对应用户名下是否有iden ...
- JQuery 补充
筛选: expr String 字符串值,包含供匹配当前元素集合的选择器表达式. jQuery objectobject 现有的jQuery对象,以匹配当前的元素. elem ...