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?

siliconpi
  • 1,807
  • 6
  • 32
  • 46
  • @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 '11 at 01:07

2 Answers2

0

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

Kedare
  • 1,786
  • 4
  • 20
  • 37
  • @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 08 '11 at 01: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 08 '11 at 01:39
  • @sciurus - any thoughts on how i can setup my php applicaito n whichis running fine to now log these queries? – siliconpi May 09 '11 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 '11 at 05:04
0

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

Nikl
  • 101
  • 2