Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log slow queries #6429

Closed
jwilder opened this issue Apr 20, 2016 · 4 comments
Closed

Log slow queries #6429

jwilder opened this issue Apr 20, 2016 · 4 comments

Comments

@jwilder
Copy link
Contributor

jwilder commented Apr 20, 2016

Feature Request

The database should be able to log queries that exceed a threshold to assist operators with identifying potential problematic queries. This setting should log the slow queries even if query logging is disabled.

We currently have a query-timeout setting that will kill a long running query. We also have show queries that will report the duration of the query. These are similar ideas, but solve slightly different use cases. The query-timeout is intended to automatically kill queries to prevent them from consuming too many resources. The show queries statement is useful for interactive monitoring of queries currently running.

The slow query log setting would is useful to identify slow queries retrospectively.

@jwilder jwilder added this to the 0.13.0 milestone Apr 20, 2016
@jsternberg jsternberg self-assigned this Apr 20, 2016
@jsternberg
Copy link
Contributor

jsternberg commented Apr 20, 2016

@jwilder when should the message be printed?

  1. After the query completes.
  2. While the query is executing.

The first is easier and doesn't require an extra goroutine running, but you may want it to be printed while the query is actively running.

@jwilder
Copy link
Contributor Author

jwilder commented Apr 20, 2016

@jsternberg While running.

@e-dard
Copy link
Contributor

e-dard commented Apr 22, 2016

@jsternberg @jwilder yeah I agree. I think it's more important that you know some query was slower than x rather than exactly how much slower than x it was.

@S31121992
Copy link

I have added Custom Headers(X-Request-Id) to keep track of logs for each API request.
Problem is for slow queries (when I enable Log-Queries-After) I do not get this Request Id displayed.
Is there a way how can we make it work, if not request ID then something else to keep track of logs associated with API ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants