当前位置: 首页 > news >正文

石家庄专业商城网站制作百度账号安全中心官网

石家庄专业商城网站制作,百度账号安全中心官网,dw做的网站有什么缺陷,软文推广特点MySQL语句执行耗时分析 MySQL Profile查看SQL执行各阶段耗时Performance Schema查看SQL执行各阶段耗时配置收集哪些用户的SQL执行信息开启SQL执行信息收集的相关特性执行目标SQL获取SQL执行的EVENT_ID获取SQL执行各阶段耗时 MySQL Profile查看SQL执行各阶段耗时 --开启SQL Pro…

MySQL语句执行耗时分析

  • MySQL Profile查看SQL执行各阶段耗时
  • Performance Schema查看SQL执行各阶段耗时
    • 配置收集哪些用户的SQL执行信息
    • 开启SQL执行信息收集的相关特性
    • 执行目标SQL
    • 获取SQL执行的EVENT_ID
    • 获取SQL执行各阶段耗时

MySQL Profile查看SQL执行各阶段耗时

--开启SQL Profiling
SQL> set profiling=1; --执行目标SQL
SQL> SELECT * FROM db.tabname;--获取Query ID和SQL执行总时长(秒)
SQL> show profiles; --获取SQL执行各阶段时间和资源消耗 
SQL> show profile all for query 2; 
--获取SQL执行各阶段IO次数
SQL> show profile block for query 2; 
--获取SQL执行各阶段CPU耗时(秒)
SQL> show profile cpu for query 2; 
--获取SQL执行各阶段通信次数 
SQL> show profile ipc for query 2; 
--获取SQL执行各阶段swap交换次数
SQL> show profile swaps for query 2; --关闭SQL Profiling
SQL> set profiling=0;

🦈See more in https://dev.mysql.com/doc/refman/8.0/en/show-profile.html

Performance Schema查看SQL执行各阶段耗时

MySQL Profile目前已被列为Deprecated,官方推荐使用Performance Schema替代。不过目前Performance Schema好像还不是很完善,只能查看SQL执行各阶段的耗时,而看不到CPU和IO等资源消耗(截止8.0.32)。

配置收集哪些用户的SQL执行信息

查看搜集哪些用户的SQL执行历史信息:

select * from performance_schema.setup_actors;

限制搜集SQL执行历史信息的用户为本地root用户连接(根据实际需求设置):

update performance_schema.setup_actors 
set enabled='NO', history='NO' 
where host='%' and user='%';insert into performance_schema.setup_actors (host,user,role,enabled,history) 
values('localhost','root','%','YES','YES');select * from performance_schema.setup_actors;

开启SQL执行信息收集的相关特性

确保setup_instruments中的相关特性已开启:

update performance_schema.setup_instruments 
set enabled='YES', TIMED='YES' 
where name like '%statement/%';update performance_schema.setup_instruments 
set enabled='YES', TIMED='YES' 
where name like '%stage/%';

确保setup_consumers中的相关特性已开启:

update performance_schema.setup_consumers 
set enabled='YES' where name like '%events_statements_%';update performance_schema.setup_consumers 
set enabled='YES' where name like '%events_stages_%';

执行目标SQL

SELECT * FROM employees.employees WHERE emp_no = 10001;

获取SQL执行的EVENT_ID

events_statements_history_long中获取执行SQL的EVENT_ID:

select event_id, truncate(timer_wait/1000000000000,6) as duration, sql_text 
from performance_schema.events_statements_history_long 
where sql_text like 'SELECT%';

获取SQL执行各阶段耗时

events_stages_history_long中获取SQL执行各阶段的耗时:

--以nesting_event_id匹配上面得到的event_id
select event_name as stage, truncate(timer_wait/1000000000000,6) as duration 
from performance_schema.events_stages_history_long 
where nesting_event_id=299;

🐬See more in https://dev.mysql.com/doc/refman/8.0/en/performance-schema-query-profiling.html

http://www.hkea.cn/news/844074/

相关文章:

  • 太原网站的公司友情链接的英文
  • 网站是用什么做的吗百度q3财报2022
  • 深圳福田网站建设公司如何做谷歌seo推广
  • 西安有做网站的吗北京网站设计公司
  • 哪家专门做特卖网站平台连接
  • 衢州网站推广最近发生的重大新闻
  • 网页设计的网站配色方案seo基础培训机构
  • 维护网站是什么工作淄博网站制作
  • 做电影下载网站成本淘宝关键词排名
  • 企业h5网站建设百度推广电话是多少
  • 中国保密在线网站培训系统软文怎么做
  • 山西住房城乡建设部网站整合网络营销是什么
  • 做美图网站有哪些东西吗个人博客seo
  • 南昌专业做网站公司竞价托管怎么做
  • 网站产品展示怎么做微信小程序建站
  • dw做网站的流程客户引流的最快方法是什么
  • 做网站app优惠活动的交换链接营销成功案例
  • 企业公示信息查询系统山西上海百度推广优化公司
  • 上海网站排名优化价格武汉百度快照优化排名
  • 做网站小程序如何做广告宣传与推广
  • 网站建设背景朝阳百度新闻网页
  • 专门做拼团的网站西安网站开发
  • 怎么看网站开发语言太原seo推广
  • 什么网站做宣传好新乡网站seo
  • 济南网站制作服务价格信息流优化师前景
  • 新手制作网站工具bt磁力猪
  • 怎么做网站系统深圳头条新闻
  • 北京网站设计公司新鸿儒seo公司的选上海百首网络
  • 百姓网二手拖拉机百度seo优化排名客服电话
  • 北京南站是丰台站吗seo优化什么意思