Skip to content

Instantly share code, notes, and snippets.

@d34dh0r53
Created August 13, 2012 10:38
Show Gist options
  • Save d34dh0r53/3339258 to your computer and use it in GitHub Desktop.
Save d34dh0r53/3339258 to your computer and use it in GitHub Desktop.
One Liner for DML Ops on MySQL binary logs
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment