Skip to content

Instantly share code, notes, and snippets.

@boris
Created August 26, 2013 15:15
Show Gist options
  • Select an option

  • Save boris/6342565 to your computer and use it in GitHub Desktop.

Select an option

Save boris/6342565 to your computer and use it in GitHub Desktop.
This script will print all the queries executed by mysqld process. It should be run passing the PID of mysqld: dtrace -s watch_query.d -p `pgrep -x mysqld`
#!/usr/sbin/dtrace -q
pid$target::*mysql_parse*:entry
{
printf("Query: %s\n", copyinstr(arg1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment