I receive many questions about errors being reported about pt-kill… and often those errors are not real. The main problem I have found is that pt-kill is hard to understand and the documentation doesn’t have many examples (I’ll add them), so, I decided to write a post about the most common usage of pt-kill: to kill the queries that match a regexp (usually a SELECT) and have been running for more than n seconds.
Let’s assume that we are running a tool like sysbench that executes queries like:
select distinct c from sbtest1 where id between 1 and 20 order by c select distinct c from sbtest2 where id between 5 and 25 order by c select distinct c from sbtest3 where id between 3 and 7 order by c select distinct c from sbtest1 where id between 2 and 8 order by c select distinct c from sbtest3 where id between 15 and 30 order by c
and at the same time, in a different process, we are running:
SELECT SLEEP …[Read more]