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

plan: do not cache plan for query on range partition table #15697

Merged
merged 4 commits into from
Mar 26, 2020

Conversation

imtbkcat
Copy link

@imtbkcat imtbkcat commented Mar 25, 2020

What problem does this PR solve?

Issue Number: close #15720

Problem Summary:
Query on range partition may return error when using prepared plan cache, because table id is written in physical plan. Some user may use partition + plan cache when TiDB 4.0-rc released. So currently let plan-cache do not cache query on range partition table.

What is changed and how it works?

Proposal: xxx

What's Changed:

Add isRangePartition to check whether a plan is on range partition table.

How it Works:

If a plan is on range partition table, plan cache will not cache it.

Related changes

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

Check List

Tests

  • Unit test

Side effects

  • Performance regression
    • Consumes more CPU (a little)

Release note

@imtbkcat imtbkcat requested a review from a team as a code owner March 25, 2020 14:31
@ghost ghost removed their request for review March 25, 2020 14:31
@codecov
Copy link

codecov bot commented Mar 25, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@db789d7). Click here to learn what that means.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #15697   +/-   ##
===========================================
  Coverage          ?   80.7021%           
===========================================
  Files             ?        504           
  Lines             ?     135746           
  Branches          ?          0           
===========================================
  Hits              ?     109550           
  Misses            ?      17703           
  Partials          ?       8493

@jackysp jackysp requested a review from eurekaka March 26, 2020 04:13
@zz-jason
Copy link
Member

can we block all query on partition table to be filled into plan cache?

@imtbkcat
Copy link
Author

@zz-jason for hash partition, plan cache is supported.

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 eurekaka added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 26, 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 Mar 26, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Mar 26, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Mar 26, 2020

@imtbkcat merge failed.

@zz-jason zz-jason merged commit ec156a6 into pingcap:master Mar 26, 2020
sre-bot pushed a commit to sre-bot/tidb that referenced this pull request Mar 26, 2020
Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented Mar 26, 2020

cherry pick to release-3.0 in PR #15748

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

sre-bot commented Mar 26, 2020

cherry pick to release-3.1 in PR #15749

@sre-bot
Copy link
Contributor

sre-bot commented Mar 26, 2020

cherry pick to release-4.0 in PR #15750

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query result on partition table wrong when using prepared-pan-cache
4 participants