Chinaunix首页 | 论坛 | 博客
  • 博客访问: 874736
  • 博文数量: 354
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 3730
  • 用 户 组: 普通用户
  • 注册时间: 2017-08-21 18:43
文章分类

全部博文(354)

文章存档

2019年(126)

2018年(223)

2017年(5)

我的朋友

分类: Mysql/postgreSQL

2018-06-21 16:09:05

  1) 现场抓出慢查询语句 show full processlist;

  2) 配置参数:

  slow_query_log_file = ON 慢查询开启开关

  long_query_time =2 记录大于2秒的sql语句

  log_queries_not_using_indexes = ON 没有使用索引的sql语句

  slow_query_log_file = /application/mysql-5.6.34/data/db01-slow.log 慢log文件

  min_examined_row_limit = 800 记录结果集大于800行的sql语句

  3) 按天轮询:slow_log.log

  4) 慢查询日志分析工具--mysqlsla或pt-query-digest(推荐)

  5) 每天晚上0点定时分析慢查询 发到核心开发 DBA分析 及高级运维 cto的邮箱

  DBA分析给出优化建议--核心开发确认更改--DBA线上操作处理

  6 )定期使用pt-duplicate-key-checker检查并删除++

  定期使用pt-index-usage 工具检查并删除

  7 )使用explain及set profile优化sql语句

阅读(1181) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~