0

I want to "swtich" on the sql query profiler for my php/mysql site and leave it ru nnig for a while.

The idea is to capture usage details over a day and then analayze the queries and work out which ones need tweaking...

I did this from the command prompt (mysql):

mysql> show profiles;
Empty set (0.00 sec)

mysql> set profiling=1;
Query OK, 0 rows affected (0.00 sec)

// loaded the website

mysql> show profiles;
Empty set (0.00 sec)

But no results. How do i turn it on for the website?

1
  • @kedare - this is a problem for me - there has to be a better way - i've got sql queries all across my system, - how can i centralize those!!
    – siliconpi
    May 28, 2011 at 1:07

2 Answers 2

0

The profiling is only enabled for the current session, you have to execute the queries by hand on the same session.

4
  • @all - how can i turn it "on" for the entire website? different users will have different sessions and i want to profile ALL of that naturally!
    – siliconpi
    May 8, 2011 at 1:27
  • @Frank I don't think that is possible. You need to log your queries, come up with some you want to tweak (e.g. the slowest and the most common), then run them manually in a session with profiling enabled.
    – sciurus
    May 8, 2011 at 1:39
  • @sciurus - any thoughts on how i can setup my php applicaito n whichis running fine to now log these queries?
    – siliconpi
    May 9, 2011 at 15:30
  • Make you php application run the SET PROFILING=1; before any query, and SET PROFILING=0; after, then dumping your queries profiles with SHOW PROFILES then SHOW PROFILE ALL FOR QUERY X for each query.
    – Kedare
    May 10, 2011 at 5:04
0

The command SHOW PROFILES added in MySQL Community Server since 5.0.37 version. Check your version of the MySQL Server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .