0

I've read good articles on enabling and logging slow_query_log, tried and it works.

But I would like to understand how to use it in real life scenarios.

I set the slow query log globally like below, which means its applicable to all databases?

SET GLOBAL slow_query_log = 'ON';
SET GLOBAL long_query_time = X;
SET GLOBAL slow_query_log_file = '/path/filename';

and so forth.....

Now, the real life scenario:

My PC has multiple projects hosted by wamp server. But now I want to check the queries for project A. How do I check which queries in this project works slowly, assuming they are using one database only?

How would the slow_query_log know that which database I'm checking? Also how the process flows? I mean, once I enabled the slow_query_log, do I type the queries written in the project one by one to see which one slowing down?

Or once I enabled slow_query_log, I start making all the calls through the system to the database and then later come back and check what has been triggered by slow_query_log during the process?

Incidentally, I prefer using CMD to execute the slow_query_log

halfer
  • 19,824
  • 17
  • 99
  • 186
112233
  • 2,406
  • 3
  • 38
  • 88

1 Answers1

0

Once you have the file, use one of these to summarize it. Then study the first few queries.

mysqldumpslow -s t

pt-query-digest
Rick James
  • 135,179
  • 13
  • 127
  • 222