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, sessionctx : Add 'last_plan_from_cache' to help know whether sql's plan is from plan cache #16321

Merged
merged 67 commits into from
Apr 17, 2020

Conversation

danmay319
Copy link
Contributor

@danmay319 danmay319 commented Apr 13, 2020

What problem does this PR solve?

Issue Number: close #16127

Problem Summary:

What is changed and how it works?

What's Changed:

  • add a session scope system variable last_plan_from_cache to help decide whether the plan cache got hit.

How it Works:

  • last_plan_from_cache` indicates whether the last executed statement hit the plan cache. (true for yes, false for no)

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test

Side effects

Release note

The default value of last_plan_from_cache is false. Set operations of last_plan_from_cache will be ignored, and a warning will be given about that.

@danmay319 danmay319 requested a review from a team as a code owner April 13, 2020 09:13
@danmay319 danmay319 self-assigned this Apr 13, 2020
@ghost ghost requested a review from francis0407 April 13, 2020 09:13
Copy link
Contributor

@eurekaka eurekaka left a comment

Choose a reason for hiding this comment

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

LGTM

@eurekaka
Copy link
Contributor

Can we change the variable name to a simpler one, e.g, last_plan_from_cache?

@danmay319
Copy link
Contributor Author

Can we change the variable name to a simpler one, e.g, last_plan_from_cache?

I also think the name of this variable is too long, renamed now.

@danmay319 danmay319 changed the title planner, sessionctx : Add 'last_statement_found_in_plan_cache' to help know whether sql's plan is from plan cache planner, sessionctx : Add 'last_plan_from_cache' to help know whether sql's plan is from plan cache Apr 17, 2020
@danmay319 danmay319 added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 17, 2020
Copy link
Member

@francis0407 francis0407 left a comment

Choose a reason for hiding this comment

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

LGTM

@francis0407 francis0407 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 Apr 17, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Apr 17, 2020

/run-all-tests

@danmay319
Copy link
Contributor Author

/run-cherry-picker

sre-bot pushed a commit to sre-bot/tidb that referenced this pull request Apr 26, 2020
Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented Apr 26, 2020

cherry pick to release-4.0 in PR #16830

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/session sig/execution SIG execution sig/planner SIG: Planner status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

we should add extra info to inform that a query plan is from plan cache
5 participants