2

MySQL has feature of logging all sql queries - General log.

But this log does not contain queries durations.

How to log all sql queries to analyze those durations?

  • The is some mysql-slow.log or similar, it logs the queries whose execution time was longer as a specific duration. You can configure this value. I can't remember the exact details, probably it is somewhere in my.cnf. Hopefully others will give you a full-featured answer. – peterh - Reinstate Monica Aug 14 '18 at 17:09
0

I got an answer after writing a question, but i want to share it to community.

Just set up Slow log and set SET GLOBAL long_query_time = 0.

You will see all sql queries with durations in slow log file.

|improve this answer|||||
  • And once you have done that, use pt-query-digest or mysqldumpslow -s t to discover the 'worst' queries and deal with them. – Rick James Aug 25 '18 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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