MySQL SQL语句性能分析_MySQL
程序员文章站
2022-05-10 08:52:11
...
bitsCN.com
MySQL SQL语句性能分析 set profiling = 1;select * from g_staff; show profiles SHOW profile CPU,BLOCK IO FOR query 88; select * from NFORMATION_SCHEMA.PROFILING 将 MySQL’s SHOW PROFILES 命令的结果转成适合阅读的格式 SET @query_id := 5;SELECT STATE, SUM(DURATION) AS Total_R, ROUND( 100 * SUM(DURATION) / ( SELECT SUM(DURATION) FROM INFORMATION_SCHEMA.PROFILING WHERE QUERY_ID = @query_id ), 2 ) AS Pct_R, COUNT(*) AS Calls, SUM(DURATION) / COUNT(*) AS "R/Call"FROM INFORMATION_SCHEMA.PROFILINGWHERE QUERY_ID = @query_idGROUP BY STATEORDER BY Total_R DESC; 作者 bengda bitsCN.com
MySQL SQL语句性能分析 set profiling = 1;select * from g_staff; show profiles SHOW profile CPU,BLOCK IO FOR query 88; select * from NFORMATION_SCHEMA.PROFILING 将 MySQL’s SHOW PROFILES 命令的结果转成适合阅读的格式 SET @query_id := 5;SELECT STATE, SUM(DURATION) AS Total_R, ROUND( 100 * SUM(DURATION) / ( SELECT SUM(DURATION) FROM INFORMATION_SCHEMA.PROFILING WHERE QUERY_ID = @query_id ), 2 ) AS Pct_R, COUNT(*) AS Calls, SUM(DURATION) / COUNT(*) AS "R/Call"FROM INFORMATION_SCHEMA.PROFILINGWHERE QUERY_ID = @query_idGROUP BY STATEORDER BY Total_R DESC; 作者 bengda bitsCN.com
上一篇: Gentoo 中配置以 FastCGI 方式运行 php
下一篇: 一些编写css的建议
推荐阅读
-
oracle导出sql语句的结果集和保存执行的sql语句(深入分析)
-
强制SQL Server执行计划使用并行提升在复杂查询语句下的性能
-
MySQL的数据类型和建库策略分析详解
-
MySQL利用profile分析慢sql详解(group left join效率高于子查询)
-
【SQL】Oracle和Mysql的分页、重复数据查询(limit、rownum、rowid)
-
MySQL查询本周、上周、本月、上个月份数据的sql代码介绍
-
MySQL5.7: sql script demo
-
Sql语句与存储过程查询数据的性能测试实现代码
-
mysql联合查询语句(关联两个不同数据库查询)
-
mysql 显示SQL语句执行时间的代码