How To Exclude Queries Returned From mysqldumpslow Command I would like to ignore queries in the mysql-slow log that originate from running the command mysqldumpslow by using SQL_NO_CACHE as the trigger word.
My experience using regex are limited at best and I'm unable to find any examples in the docs.
I've tried a few variations of the following:
mysqlslowdump -g '!(SQL_NO_CACHE)' /path/to/my/log
mysqlslowdump -g '^!(SQL_NO_CACHE)$' /path/to/my/log

... but always get back:

Died at /usr/bin/mysqldumpslow line 162


What is wrong in my regex?
OK - you should check out the page here, 

    (Due to a limitation in the parser, a space character must precede 
and follow the SQL_NO_CACHE keyword; a nonspace such as a newline 
causes the server to check the query cache to see whether 
the result is already cached.)


Now, it is possible that the syntax that you are using doesn't correspond to the bit about "newlines" above - I'm not sure. Maybe you could try running your queries directly from the command line?

[EDIT] in response to OP's comment.

mysqlslowdump -g '!(SQL_NO_CACHE)' /path/to/my/log
mysqlslowdump -g '^!(SQL_NO_CACHE)$' /path/to/my/log


I've never come across this problem, but is it possible that rewriting your code with spaces surrounding "SQL_NO_CACHE" could have some effect?