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

sql: request statement bundle with min duration #65451

Closed
tbg opened this issue May 19, 2021 · 1 comment
Closed

sql: request statement bundle with min duration #65451

tbg opened this issue May 19, 2021 · 1 comment
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) O-postmortem Originated from a Postmortem action item.

Comments

@tbg
Copy link
Member

tbg commented May 19, 2021

Is your feature request related to a problem? Please describe.

When someone requests a statement bundle, more often than not they want to capture a particularly slow query. However, if only a small fraction of the queries is slow (say, there is a single contended row in a table but a lot of traffic does not hit that row), the statement bundle in all likelihood will not manage to capture the query with parameters of interest.

Describe the solution you'd like
When requesting the statement bundle, I would like to specify a time threshold which the captured query is guaranteed to have exceeded.

Describe alternatives you've considered

While this is possible to implement, it's possibly difficult to implement efficiently. As long as the queries that are traced are chosen "randomly", it is very rare to hit the interesting case. As a result, with this feature added, statement bundles would simply take a very long time to become available, but it is also important that we don't have to wait for too long. Tracing all incarnations of the statement, on the other hand, comes with a performance cost since verbose tracing is expensive.

Possibly a solution could be to unconditionally enable non-verbose tracing for the statement and turn on the verbosity when the threshold is met. This would result in a partial verbose trace (a prefix of messages is missing) but this may be acceptable as long as it is clearly indicated (via a message); this can also independently occur for any trace since traces control their memory footprint by evicting old messages anyway.

Additional context

https://github.com/cockroachlabs/support/issues/973

@tbg tbg added the C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) label May 19, 2021
@tbg tbg added the O-postmortem Originated from a Postmortem action item. label May 19, 2021
@yuzefovich
Copy link
Member

Closing as a dup of #57634

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) O-postmortem Originated from a Postmortem action item.
Projects
Archived in project
Development

No branches or pull requests

3 participants