Commit | Line | Data |
---|---|---|
60d739e2 P |
1 | #!/bin/sh |
2 | for f in mysql-bin.[0-9]* | |
3 | do | |
4 | mysqlbinlog $f | awk ' | |
5 | /^use / { | |
6 | db=substr($2,1,index($2,"/")-1) | |
7 | } | |
8 | /^(INSERT|DELETE)/ { | |
9 | if ($2=="IGNORE") { table=$4 } else { table=$3 } | |
10 | if (index(table,".")<=0) table=db"."table | |
11 | printf("%s %s\n",$1,table) | |
12 | } | |
13 | /^(UPDATE|REPLACE)/ { | |
14 | table=$2 | |
15 | if (index(table,".")<=0) table=db"."table | |
16 | printf("%s %s\n",$1,table) | |
17 | } | |
18 | ' | |
19 | done | sort | uniq -c | sort -n | tail -10 |