ITPub博客

首页 > 数据库 > MySQL > MySQL如何通过分析binlog日志找出操作频繁的表

MySQL如何通过分析binlog日志找出操作频繁的表

原创 MySQL 作者:chenfeng 时间:2018-07-11 08:50:42 0 删除 编辑
一个例子:
#mysqlbinlog --no-defaults --base64-output=decode-rows -v -v mysql-bin.000008 |awk '/###/{if($0~/UPDATE|INSERT|DELETE/)count[$2" "$NF]++}END{for(i in count)print i,"\t",count[i]}'|column -t|sort -k3nr|more
UPDATE  `test`.`test_new`  50000
DELETE  `test`.`test`      49990
INSERT  `test`.`mytab`     600000
....................................................................
....................................................................
....................................................................

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15498/viewspace-2157636/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
交流MySQL,PolarDB/PolarDB-X,PostgreSQL,MongoDB和Redis技术。

注册时间:2015-12-07

  • 博文量
    784
  • 访问量
    2690510