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

core wordpress青岛网站seo分析

core wordpress,青岛网站seo分析,网站开发外包报价单,网站漂浮本文环境 阿里云RDS MySQL 8.0.34 当客户端向MySQL数据库发送一条SQL之后,由于SQL很慢很慢,它会在什么时候结束呢? 查看 max_execution_time 变量值 mysql> show variables like max_execution_time; --------------------------- | Variable_name | Value | ------…

本文环境 阿里云RDS MySQL 8.0.34

当客户端向MySQL数据库发送一条SQL之后,由于SQL很慢很慢,它会在什么时候结束呢?
查看 max_execution_time 变量值
mysql> show variables like 'max_execution_time';
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| max_execution_time | 0     |
+--------------------+-------+

查看官方文档

在这里插入图片描述


如果 max_execution_time = 0 则SELECT语句的执行不会超时, 直到查询结果返回.



进行模拟实验, 通过 root 用户登录到数据库.(一个用于查看监控数据,一个用于执行慢查询)
mysql> select * from information_schema.processlist where user='root' order by id asc;
+--------+------+----------------------+------+---------+------+-----------+--------------------------------------------------------------------------------+
| ID     | USER | HOST                 | DB   | COMMAND | TIME | STATE     | INFO                                                                           |
+--------+------+----------------------+------+---------+------+-----------+--------------------------------------------------------------------------------+
| 125901 | root | 183.94.140.242:17228 | NULL | Query   |    0 | executing | select * from information_schema.processlist where user='root' order by id asc |
| 125905 | root | 183.94.140.242:16471 | db1  | Sleep   |   38 |           | NULL                                                                           |
+--------+------+----------------------+------+---------+------+-----------+--------------------------------------------------------------------------------+

接下来在其中一个客户端执行以下语句, 模拟耗时查询

mysql> select * from operation_record where record_id=460156845005578240 and sleep(120);

而在另一个客户端执行如下监控语句(监控数据库连接的情况), 可以看到 ID = 125905 的客户端(即上面那个客户端)在执行耗时查询.

mysql> select * from information_schema.processlist where user='root' order by id asc;
+--------+------+----------------------+------+---------+------+------------+----------------------------------------------------------------------------------+
| ID     | USER | HOST                 | DB   | COMMAND | TIME | STATE      | INFO                                                                             |
+--------+------+----------------------+------+---------+------+------------+----------------------------------------------------------------------------------+
| 125901 | root | 183.94.140.242:17228 | NULL | Query   |    0 | executing  | select * from information_schema.processlist where user='root' order by id asc   |
| 125905 | root | 183.94.140.242:16471 | db1  | Query   |   49 | User sleep | select * from operation_record where record_id=460156845005578240 and sleep(120) |
+--------+------+----------------------+------+---------+------+------------+----------------------------------------------------------------------------------+

经过120秒之后, 查询会正常返回.

我们把以上流程的慢查询语句在 MySQLWorkbench 工具里执行.

在这里插入图片描述
在这里插入图片描述


同样也可以监控到该慢查询
mysql> select * from information_schema.processlist where user='root' order by id asc;
+--------+------+----------------------+------+---------+------+------------+----------------------------------------------------------------------------------------------+
| ID     | USER | HOST                 | DB   | COMMAND | TIME | STATE      | INFO                                                                                         |
+--------+------+----------------------+------+---------+------+------------+----------------------------------------------------------------------------------------------+
| 125901 | root | 183.94.140.242:17228 | NULL | Query   |    0 | executing  | select * from information_schema.processlist where user='root' order by id asc               |
| 125905 | root | 183.94.140.242:16471 | db1  | Sleep   |  687 |            | NULL                                                                                         |
| 125934 | root | 183.94.140.242:16963 | NULL | Sleep   |  232 |            | NULL                                                                                         |
| 125940 | root | 183.94.140.242:17078 | db1  | Query   |   12 | User sleep | select * from operation_record where record_id=460156845005578240 and sleep(120) LIMIT 0, 50 |
+--------+------+----------------------+------+---------+------+------------+----------------------------------------------------------------------------------------------+

可是在经过30秒之后, 客户端收到了错误响应

在这里插入图片描述



而且从监控中也发现少了一个客户端连接(ID = 125940 不见了)

mysql> select * from information_schema.processlist where user='root' order by id asc;
+--------+------+----------------------+------+---------+------+-----------+--------------------------------------------------------------------------------+
| ID     | USER | HOST                 | DB   | COMMAND | TIME | STATE     | INFO                                                                           |
+--------+------+----------------------+------+---------+------+-----------+--------------------------------------------------------------------------------+
| 125901 | root | 183.94.140.242:17228 | NULL | Query   |    0 | executing | select * from information_schema.processlist where user='root' order by id asc |
| 125905 | root | 183.94.140.242:16471 | db1  | Sleep   |  727 |           | NULL                                                                           |
| 125934 | root | 183.94.140.242:16963 | NULL | Sleep   |  272 |           | NULL                                                                           |
+--------+------+----------------------+------+---------+------+-----------+--------------------------------------------------------------------------------+

是因为 MySQLWorkbench 这个工具设置了默认读超时的最大值 30 秒.

在这里插入图片描述

如果把这个默认超时时间设置大于120秒,那么慢查询就可以执行到120秒返回结果,而不会在30秒的时候出现异常了.

需要重新打开一个新的查询窗口或者重新打开MySQLWorkbench工具



有时候,需要控制查询的最大执行时长,可以通过 MAX_EXECUTION_TIME(N) 控制.

在这里插入图片描述

# 设置最大执行时长 10 秒
mysql> select /*+ MAX_EXECUTION_TIME(10000) */ * from operation_record where record_id=460156845005578240 and sleep(120);# 10 秒之后,会返回如下错误
ERROR 3024 (HY000): Query execution was interrupted, maximum statement execution time exceeded


如果客户端不主动断开连接, 如果客户端不主动设置最大执行时长, 而数据库端设置最大执行时长.

把 RDS MySQL max_execution_time 值修改成 60 秒


在这里插入图片描述
客户端重连数据库,再次查看 max_execution_time

mysql> show variables like 'max_execution_time';
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| max_execution_time | 60000 |
+--------------------+-------+

已生效

再次执行慢查询


mysql> select * from operation_record where record_id=460156845005578240 and sleep(120);                           # 60 秒之后,会返回如下错误
ERROR 3024 (HY000): Query execution was interrupted, maximum statement execution time exceeded


【总结】 当一个SQL语句在慢查询的执行过程中
1.如果客户端主动断开连接, 则数据库连接会消失.毕竟断开了连接
2.如果客户端设置了SELECT语句最大执行时长, 则数据库连接依然在, 如果查询耗时超过设置的最大执行时长,语句将被中断,返回给客户端如下错误
ERROR 3024 (HY000): Query execution was interrupted, maximum statement execution time exceeded
3.如果数据库端设置最大执行时长,则数据库连接依然在, 如果查询耗时超过设置的最大执行时长,语句将被中断,返回给客户端如下错误
ERROR 3024 (HY000): Query execution was interrupted, maximum statement execution time exceeded



另外 如果客户端开启一个事务之后, 长时间没有再与数据库有过'沟通', 比如很长时间没有再向数据库发送DML语句, 那么经过 wait_timeout/interactive_timeout 时间之后, 数据库会主动断开该连接, 数据库连接消失,事务会被回滚. 好在客户端的程序都有连接池, 连接池进行活性检测.



个人站点 https://www.infuq.com


文章转载自:
http://hosteler.mcjp.cn
http://begrudgingly.mcjp.cn
http://knives.mcjp.cn
http://tracking.mcjp.cn
http://islamabad.mcjp.cn
http://chaldean.mcjp.cn
http://inflame.mcjp.cn
http://bitumen.mcjp.cn
http://trunkfish.mcjp.cn
http://braize.mcjp.cn
http://kissinger.mcjp.cn
http://unlifelike.mcjp.cn
http://decay.mcjp.cn
http://coagent.mcjp.cn
http://luteolin.mcjp.cn
http://overpower.mcjp.cn
http://platonist.mcjp.cn
http://nsf.mcjp.cn
http://age.mcjp.cn
http://homemade.mcjp.cn
http://faultily.mcjp.cn
http://pickaroon.mcjp.cn
http://tomboyish.mcjp.cn
http://bream.mcjp.cn
http://henotic.mcjp.cn
http://insult.mcjp.cn
http://antepenult.mcjp.cn
http://pirogue.mcjp.cn
http://advertizement.mcjp.cn
http://gittern.mcjp.cn
http://enshrinement.mcjp.cn
http://windshield.mcjp.cn
http://laicize.mcjp.cn
http://teachery.mcjp.cn
http://upgather.mcjp.cn
http://conto.mcjp.cn
http://syllabary.mcjp.cn
http://carmel.mcjp.cn
http://chelyabinsk.mcjp.cn
http://shopper.mcjp.cn
http://abortionist.mcjp.cn
http://actionist.mcjp.cn
http://pugree.mcjp.cn
http://unrestricted.mcjp.cn
http://tass.mcjp.cn
http://calefactory.mcjp.cn
http://flightiness.mcjp.cn
http://irghizite.mcjp.cn
http://alba.mcjp.cn
http://mlw.mcjp.cn
http://runout.mcjp.cn
http://eudaemonic.mcjp.cn
http://nonoxidizable.mcjp.cn
http://gantt.mcjp.cn
http://noegenesis.mcjp.cn
http://inflate.mcjp.cn
http://multitude.mcjp.cn
http://goniotomy.mcjp.cn
http://kerbs.mcjp.cn
http://neuropsychosis.mcjp.cn
http://dariole.mcjp.cn
http://align.mcjp.cn
http://spirillum.mcjp.cn
http://telium.mcjp.cn
http://thromboplastin.mcjp.cn
http://interventricular.mcjp.cn
http://eyre.mcjp.cn
http://sizeable.mcjp.cn
http://omphalocele.mcjp.cn
http://cardigan.mcjp.cn
http://aquafarm.mcjp.cn
http://foretopmast.mcjp.cn
http://milo.mcjp.cn
http://arthur.mcjp.cn
http://photocoagulating.mcjp.cn
http://forworn.mcjp.cn
http://saleroom.mcjp.cn
http://lobular.mcjp.cn
http://connatural.mcjp.cn
http://nursling.mcjp.cn
http://gastroschisis.mcjp.cn
http://semiflexion.mcjp.cn
http://rearm.mcjp.cn
http://soapbox.mcjp.cn
http://wersh.mcjp.cn
http://rhodesian.mcjp.cn
http://bristlecone.mcjp.cn
http://animally.mcjp.cn
http://nicaea.mcjp.cn
http://gryphon.mcjp.cn
http://lamblike.mcjp.cn
http://clothback.mcjp.cn
http://viscoelastic.mcjp.cn
http://aeronomy.mcjp.cn
http://menisci.mcjp.cn
http://nudnik.mcjp.cn
http://ventrotomy.mcjp.cn
http://brandreth.mcjp.cn
http://isoseismal.mcjp.cn
http://verbosity.mcjp.cn
http://www.15wanjia.com/news/62482.html

相关文章:

  • 学院网站建设策划书免费广州seo
  • 浙江网站建设公司推荐优化网站界面的工具
  • 设计网站有没有版权相亲网站排名前十名
  • 网站格式图片游戏推广对接平台
  • 做的好的c2c网站如何制作小程序
  • 官方网站是指哪个网站广州建网站的公司
  • 用sublime可以做企业网站吗宣传推广图片
  • wordpress简历模板网站推广优化业务
  • 网站建设专业的公司app开发公司
  • 外贸网站建设经验seo高手培训
  • 做php网站需要什么软件开发seo优化招聘
  • win10做网站西安seo全网营销
  • 用wordpress写网页百度seo规则最新
  • 公司网站建设款计什么科目最近时事热点
  • 学做网站论坛第六节seo博客是什么意思
  • 抚顺市网站建设北京十大营销策划公司
  • 重庆做网站外包公司seo服务内容
  • 网站app建设需要资源线上seo关键词优化软件工具
  • html php网站开发seo查询seo优化
  • 移动端app百度移动端关键词优化
  • 企业网站bannerseo策略工具
  • 亿网行网站建设获客渠道有哪些
  • 推广方法有哪些网站外链的优化方法
  • 苏州建设厅网站苏州网站制作
  • 网站交互用什么做点击进入官方网站
  • 徐州市建设工程招标网semseo
  • 青岛网站建设青岛博采网络网站推广seo设置
  • 1企业网站案例宁波seo推广推荐
  • 肇庆市手机网站建设品牌自动点击关键词软件
  • 网站备案网站前置审批网店代运营一年的费用是多少