zoukankan      html  css  js  c++  java
  • MySql性能相关

    查询线程及相关信息
      show full processlist

    修改慢查询的设置时间为6秒

    set long_query_time=6

     显示当前慢查询设置的时间

    show variables like 'long_query_time'

     

    查看查询时间超过long_query_time秒的查询的个数

     show global status like "slow_queries" 

    查看general_log相关信息

     show variables like '%general_log%';

    查看服务器状态

      show status  like '%lock%';   

     

    查看有没有执行时间特别长的线程
     select * from information_schema.processlist where Command != 'Sleep' order by Time desc;

    找出所有执行时间超过 6分钟的线程,拼凑出 kill 语句,方便后面查杀 (此处 6分钟 可根据自己的需要调整SQL标红处)
    可复制查询结果到控制台,直接执行,杀死堵塞进程
     select concat('kill ', id, ';') from information_schema.processlist where Command != 'Sleep' and Time > 360 order by Time desc;

    按客户端 IP 分组,查看哪个客户端的链接数最多
     select client_ip,count(client_ip) as client_num from (select substring_index(host,':' ,1) as client_ip from information_schema.processlist ) as connect_info group by client_ip order by client_num desc;

  • 相关阅读:
    指定时间的月初和月末一天的写法
    EF写distinct
    服务的调试和安装
    EF写INNER JOIN 链接
    BZOJ 1825: [JSOI2010]蔬菜庆典
    P4171 [JSOI2010]满汉全席
    Educational Codeforces Round 71 (Rated for Div. 2) Solution
    P4292 [WC2010]重建计划
    P3724 [AH2017/HNOI2017]大佬
    P5504 [JSOI2011]柠檬
  • 原文地址:https://www.cnblogs.com/furenjian/p/13827481.html
Copyright © 2011-2022 走看看