MySQL: How to figure out how many queries do you have that might affect I/O
From MyWiki
(Difference between revisions)
Admin (Talk | contribs)
(Created page with 'We needed to figure out what are the most common queries are run on our MySQL server throughout the day that may affect I/O <pre> mysqlbinlog /path/to/mysql-bin.000999 | \ grep …')
Newer edit →
(Created page with 'We needed to figure out what are the most common queries are run on our MySQL server throughout the day that may affect I/O <pre> mysqlbinlog /path/to/mysql-bin.000999 | \ grep …')
Newer edit →
Revision as of 18:03, 28 February 2015
We needed to figure out what are the most common queries are run on our MySQL server throughout the day that may affect I/O
mysqlbinlog /path/to/mysql-bin.000999 | \ grep -i -e "^update" -e "^insert" -e "^delete" -e "^replace" -e "^alter" | \ cut -c1-100 | tr '[A-Z]' '[a-z]' | \ sed -e "s/\t/ /g;s/\`//g;s/(.*$//;s/ set .*$//;s/ as .*$//" | sed -e "s/ where .*$//" | \ sort | uniq -c | sort -nr