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

planner, infoschema : add columns about plan cache in 'performance_schema.events_statements_summary_by_digest' (#16476) #17493

Merged
merged 3 commits into from
Jun 1, 2020

Conversation

sre-bot
Copy link
Contributor

@sre-bot sre-bot commented May 28, 2020

cherry-pick #16476 to release-4.0


What problem does this PR solve?

Issue Number: close #16217

Problem Summary:

What is changed and how it works?

What's Changed:

  • Three columns (plan_cache_hits and plan_in_cache) are added to information_schema.statements_summary
  • Add some variables in StatementContext to record plan cache info.

How it Works:

  • plan_in_cache indicates whether the last statement in these statements hit plan cache.
  • plan_cache_hits indicates the number of times these statements hit plan cache.

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:

Tests

  • Unit test
  • Integration test

Side effects

  • Performance regression
    • Consumes more MEM

Release note

  • Users can see the statistics about the use of plan cache by
    select digest_text, plan_cache_hits, plan_in_cache from information_schema.statements_summary

@sre-bot sre-bot requested a review from a team as a code owner May 28, 2020 13:57
@sre-bot
Copy link
Contributor Author

sre-bot commented May 28, 2020

/run-all-tests

Comment on lines +730 to +735
//plan cache
if sei.PlanInCache {
ssElement.planInCache = true
ssElement.planCacheHits += 1
}

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems planCacheHits is enough. Why add planInCache?

Copy link
Contributor

Choose a reason for hiding this comment

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

@djshow832 If users use last_plan_in_cache, there is no way to view historical plan cache hit information. Add plan_in_cache, then you can record the last plan cache hit information for each sql_digest.

@danmay319 danmay319 requested a review from djshow832 June 1, 2020 01:25
Copy link
Contributor

@djshow832 djshow832 left a comment

Choose a reason for hiding this comment

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

LGTM

@danmay319
Copy link
Contributor

PTAL @eurekaka , @zz-jason

@danmay319 danmay319 added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 1, 2020
Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason added status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 1, 2020
@sre-bot
Copy link
Contributor Author

sre-bot commented Jun 1, 2020

/run-all-tests

@sre-bot sre-bot merged commit d150d38 into pingcap:release-4.0 Jun 1, 2020
@zz-jason zz-jason removed this from the v4.0.1 milestone Jun 5, 2020
@zz-jason zz-jason added this to the v4.0.2 milestone Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution sig/sql-infra SIG: SQL Infra status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants