LoginSignup
0
0

More than 5 years have passed since last update.

mysqldumpslowでslowログの集計と、slowログの手動ローテート

Posted at

MySQL5.6にて。

mysqldumpslowは、MySQL付属のスロークエリログ集計ツール

$ mysqldumpslow -s ORDER slow.log

ORDERには

  • c: 出現回数
  • l: ロックタイム
  • r: 送信行数
  • t: クエリ時間

やそれぞれの平均など色々選べる。
詳しくはヘルプ参照

ちなみにslowログは下記のような感じで手動ローテートできる。

$ mv slow.log{,.`date '+%Y%m%d%H%M%S'`}
$ mysql -uroot -e 'FLUSH SLOW LOGS'
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0