Skip to content

Instantly share code, notes, and snippets.

@marcus
Created October 17, 2008 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcus/17521 to your computer and use it in GitHub Desktop.
Save marcus/17521 to your computer and use it in GitHub Desktop.
## Create a file called trace_sqllog with the following
#!/usr/sbin/dtrace -qs
pid$1::*dispatch_command*:entry
{
printf("%d::%s\n",tid,copyinstr(arg2));
}
## Taken from http://blogs.sun.com/angelo/entry/observing_mysql_sql_statements_in
## Add the following to your ~/.bash_profile
pidof () { ps -Ac | egrep $@ | awk '{print $1}'; }
alias sqllog='sudo ~/trace_sqllog `pidof mysqld`'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment