Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
@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 1:07

2 Answers 2

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

share|improve this answer
    
@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 '11 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 '11 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 '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 5:04

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.