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: open fully order prop push down for partition table's table scan and single index scan #42694

Merged

Conversation

winoros
Copy link
Member

@winoros winoros commented Mar 29, 2023

What problem does this PR solve?

Issue Number: ref #26166

Problem Summary:

What is changed and how it works?

We've implemented merge operation between partitions of table scan and single index scan.
So we don't need the former quick path.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 29, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Defined2014
  • qw4990

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 29, 2023
@winoros winoros force-pushed the open-some-full-limit-push-down-for-part-table branch from 64d068a to 50cb177 Compare March 29, 2023 18:29
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 31, 2023
@winoros winoros force-pushed the open-some-full-limit-push-down-for-part-table branch from 5517030 to 6857844 Compare April 4, 2023 12:32
@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 4, 2023
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 14, 2023
@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 25, 2023
@ti-chi-bot ti-chi-bot bot deleted a comment from ti-chi-bot Apr 25, 2023
@ti-chi-bot ti-chi-bot bot deleted a comment from ti-chi-bot Apr 25, 2023
@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Apr 26, 2023
@qw4990
Copy link
Contributor

qw4990 commented Apr 26, 2023

/test mysql-test

@qw4990
Copy link
Contributor

qw4990 commented Apr 26, 2023

/merge

@ti-chi-bot
Copy link

ti-chi-bot bot commented Apr 26, 2023

This pull request has been accepted and is ready to merge.

Commit hash: 9ca5616

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 26, 2023
@qw4990 qw4990 added the sig/planner SIG: Planner label Apr 26, 2023
@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 26, 2023
@ti-chi-bot ti-chi-bot bot removed status/can-merge Indicates a PR has been approved by a committer. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 26, 2023
@winoros
Copy link
Member Author

winoros commented Apr 26, 2023

/merge

@ti-chi-bot
Copy link

ti-chi-bot bot commented Apr 26, 2023

This pull request has been accepted and is ready to merge.

Commit hash: 8b0b953

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 26, 2023
@ti-chi-bot ti-chi-bot bot removed the status/can-merge Indicates a PR has been approved by a committer. label Apr 26, 2023
Comment on lines 1537 to 1544
if ds.tableInfo.GetPartitionInfo() != nil && !is.Index.Global {
is.Columns = append(is.Columns, model.NewExtraPhysTblIDColInfo())
is.schema.Append(&expression.Column{
RetType: types.NewFieldType(mysql.TypeLonglong),
UniqueID: ds.ctx.GetSessionVars().AllocPlanColumnID(),
ID: model.ExtraPhysTblID,
})
}
Copy link
Member

@time-and-fate time-and-fate Apr 26, 2023

Choose a reason for hiding this comment

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

Why do we need this? Does this conflict with (*PhysicalIndexScan).initSchema()?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, that case is to add a partition id for the global index(It's decoded from the value of the global index). Here we add an extra partition id for non-global index which is decoded from the key instead of the value.

Copy link
Contributor

@Defined2014 Defined2014 Apr 26, 2023

Choose a reason for hiding this comment

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

ExtraPhysTblID will let TiKV return PID in chunk. IndexWorker will use the pid to create a partitionHandle for tableWorker found the handle belongs to which PID and use it to keep order.

Comment on lines 1228 to 1230
} else {
return nil, false
}
Copy link
Member

Choose a reason for hiding this comment

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

This entire if-else branch can be simplified.

Copy link
Member Author

Choose a reason for hiding this comment

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

This func will be removed in the next pr since there's fully support for IndexMerge

@winoros
Copy link
Member Author

winoros commented Apr 26, 2023

/merge

@ti-chi-bot
Copy link

ti-chi-bot bot commented Apr 26, 2023

This pull request has been accepted and is ready to merge.

Commit hash: 218a241

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 26, 2023
@ti-chi-bot ti-chi-bot bot merged commit 4b6f0ce into pingcap:master Apr 26, 2023
@winoros winoros deleted the open-some-full-limit-push-down-for-part-table branch April 26, 2023 12:10
@winoros
Copy link
Member Author

winoros commented Apr 26, 2023

/cherry-pick release-7.1

@ti-chi-bot
Copy link
Member

@winoros: new pull request created to branch release-7.1: #43441.

In response to this:

/cherry-pick release-7.1

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Apr 26, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. 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.

5 participants