Search code examples
mysqlprofilingphpmyadminprofiler

MySQL Profiler - No entries in show profile


I am using MySQL profiler to help with diagnosis of some MySQL issues I am investigating. However when I issue the show profiles command I do not get any results.

This is how I am using it:

set profiling=1 --Enable profiling

-- Run some selects / inserts etc
select count(*) from mytable
insert into mytable (mydata) values ('wibble')

show profiles

I was expecting the show profiles command to give me the profile data for the selects etc that I performed after enabling profiling (Per the information from this MySQL dev page), however all I get back is an empty resultset. I do not see any errors when enabling/disabling profiling nor do I see any errors when attempting to view profiles.

The following may or may not be relevant:

  1. The commands were issued via phpMyAdmin
  2. I am running MySQL 5.0.77
  3. select * from information_schema.profiling returns no results

Solution

  • In an answer to my own question...

    It seems that the inbuilt MySQL profiling utilities described above operate on a MySQL session basis. phpMyAdmin seems to create a new connection everytime a command is issued. As such the command to switch on profiling and then the subsquent selects are disconnected from each other.

    This is confirmed by connecting to the MySQL server via SSH and running the same commands. In this configuration profiling works.

    However, it only profiles the commands issued within that session. This means that any other queries being performed against the DB from another source (i.e. a web application) are not included in the profile result.

    I have not found any way of profiling all queries to the DB regardless of source (i.e. the way MSSQL profiler works). So at the moment I have to rely on setting the log configuration value, in my.cnf, and then execute the logged queries manually in an SSH session:

    log=/var/log/mysqldquery.log
    

    Not a perfect solution as it is somewhat laborious, but it works.