Advertisement
bytecoded

Top Queries by Average Duration

Mar 20th, 2019
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.48 KB | None | 0 0
  1. cat */rphost*/*.log | perl -pe 's/,DBMSSQL,.,Usr=.*,Sql=/,DBMSSQL,Sql=/g' | sed -r '/^p_[0-9]+: /d' | perl -pe 's/\xef\xbb\xbf//g; s/\n/@/g; s/\s/ /g; s/#tt[0-9]+/#tt/g; s/,DBMSSQL,Sql=/<SEPARATOR>/g; s/^[0-9]+:[0-9]+.[0-9]+-/<NL>/g;' | gawk -F'<SEPARATOR>' -vRS='<NL>' '{if ($2 !~ /^$/) {Durations[$2]+=$1; Executions[$2]+=1}} END {for (i in Durations) printf "%.3f %s\n", Durations[i] / Executions[i], i}' | sort -rnb | head -n 5 | perl -pe 's/@/\n/g' > top-queries-by-average-duration.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement