MySQL: How to figure out how many queries do you have that might affect I/O
From MyWiki
(Difference between revisions)
(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 …') |
m (Protected "MySQL: How to figure out how many queries do you have that might affect I/O" ([edit=sysop] (indefinite) [move=sysop] (indefinite))) |
Current revision as of 18:04, 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