pt-query-digest common usage scenarios

by nivas on April 10, 2015

 

1) To find slow queries

pt-query-digest /var/lib/mysql/cloud-server-01-slow.log > slowqueroutput.log

2) Between a particular time range

pt-query-digest –since ’2015-04-10 00:00:00′ –until ’2015-04-10 23:59:59′ /var/lib/mysql/cloud-server-01-slow.log > slowqueryrange.log

3) For a particular database

pt-query-digest –filter ‘$event->{db} && $event->{db} =~ /employee/’ /var/lib/mysql/cloud-server-01-slow.log > slowqueroutputemp.log

pt-query-digest –filter ‘$event->{db} && $event->{db} =~ /market/’ /var/lib/mysql/cloud-server-01-slow.log > slowqueroutputmkt.log

4) For a particular user

pt-query-digest –filter ‘$event->{user} && $event->{user} =~ /root/’ /var/lib/mysql/cloud-server-01-slow.log > slowqueryoutputuser.log

Comments on this entry are closed.

Previous post:

Next post: