Skip to content

Instantly share code, notes, and snippets.

@jonathanvx
Last active July 2, 2021 15:28
Show Gist options
  • Save jonathanvx/ed691b04b44a86cc0ed63b64ddfbb0c6 to your computer and use it in GitHub Desktop.
Save jonathanvx/ed691b04b44a86cc0ed63b64ddfbb0c6 to your computer and use it in GitHub Desktop.
pt-query-digest mysql-slowquery.log --limit=25 > slow.txt
pt-query-digest mysql-slowquery.log --limit=8 --order-by=Lock_time:sum > locked.txt 2>/dev/null
pt-query-digest mysql-slowquery.log --filter '($event->{Rows_examined} > 0) && ($event->{Row_ratio} = $event->{Rows_sent} / ($event->{Rows_examined})) && 1' --limit=8 > select_ratio.txt
pt-query-digest mysql-slowquery.log --filter '($event->{fingerprint} =~ m/^(!?select)/) && ($event->{Rows_examined} > 0) && ($event->{fingerprint} !~ m/(information_schema|performance_schema|mysql)/)' --no-report --output=slowlog >select.log
pt-query-digest mysql-slowquery.log --filter '$event->{fingerprint} =~ m/table/' --no-report --output=slowlog >table.log
pt-query-digest table.log --limit=100% > table.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment