0

I want to get a list of queries executed against my mysql instance, I also want to get list of executions counts for them and duration,

I can get these stats in something like datadog APM, but I would like to be able to run a query for them locally.

is there a table or schema I need to look at?

JaChNo
  • 1,493
  • 9
  • 28
  • 56
  • 1
    Possible duplicate of [How to show the last queries executed on MySQL?](https://stackoverflow.com/questions/650238/how-to-show-the-last-queries-executed-on-mysql) – Progman Sep 02 '19 at 20:54

1 Answers1

1
  1. Turn on the "general log" and have it write to a file.

  2. Wait a finite amount of time.

  3. Then use pt-query-digest to summarize the results.

  4. Turn off the general log before it fills up disk.

The slowlog (with a small value in long_query_time) is more useful for finding naughty queries.

Rick James
  • 135,179
  • 13
  • 127
  • 222