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: fix performance when disabling sql.metrics.statement_details #109785

Merged
merged 1 commit into from
Sep 1, 2023
Merged

sql: fix performance when disabling sql.metrics.statement_details #109785

merged 1 commit into from
Sep 1, 2023

Conversation

j82w
Copy link
Contributor

@j82w j82w commented Aug 30, 2023

There is a performance regression when disabling
sql.metrics.statement_details.enabled. It will see that every execution is the first time the query was executed so it will enabled execution stats collection for all executions. This is a bug caused by always collecting the execution stats of the first time a statement is executed in #89418.

Fixes: #106811

Release note (bug fix): Fixes a bug causing performance regression when disabling sql.metrics.statement_details.enabled which caused execution stats to be
collected for all queries instead of the default one percent.

@j82w j82w requested a review from a team August 30, 2023 23:17
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@j82w j82w added the backport-23.1.x Flags PRs that need to be backported to 23.1 label Aug 30, 2023
@j82w j82w changed the title SQL: fix performance when disabling sql.metrics.statement_details sql: fix performance when disabling sql.metrics.statement_details Aug 31, 2023
Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

this should also be backported to 22.2

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @j82w)

Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like something must be wrong with the code because the new test is failing

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @j82w)

…bled

There is a performance regression when disabling
sql.metrics.statement_details.enabled. It will see that every execution
is the first time the query was executed so it will enabled execution
stats collection for all executions. This is a bug caused by always
collecting the execution stats of the first time a statement is
executed in #89418.

Fixes: #106811

Release note (bug fix): Fixes a bug causing performance regression
when disabling `sql.metrics.statement_details.enabled` which caused
execution stats to be collected for all queries instead of the default
one percent.
@j82w
Copy link
Contributor Author

j82w commented Sep 1, 2023

The test failure is fixed now. The execution stats are still enabled 1% of the time which caused it to be flaky. I changed the logic so all 4 executions had to have executions stats collected for it to fail.

@j82w
Copy link
Contributor Author

j82w commented Sep 1, 2023

bors r+

@craig
Copy link
Contributor

craig bot commented Sep 1, 2023

Build succeeded:

@blathers-crl
Copy link

blathers-crl bot commented Sep 1, 2023

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 716f6a9 to blathers/backport-release-22.2-109785: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 22.2.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance regression if sql.metrics.statement_details.enabled is disabled
3 participants