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: Mpp outer join build side (#25130) #25142

Merged
merged 7 commits into from
Jun 18, 2021

Conversation

ti-srebot
Copy link
Contributor

@ti-srebot ti-srebot commented Jun 4, 2021

cherry-pick #25130 to release-5.0
You can switch your code base to this Pull Request by using git-extras:

# In tidb repo:
git pr https://github.com/pingcap/tidb/pull/25142

After apply modifications, you can push your change to this PR via:

git push [email protected]:ti-srebot/tidb.git pr/25142:release-5.0-c59b3bcea6ef

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:
In MPP outer join, it always use the inner table as the build table, however, TiFlash actually support use outer table as the build table in outer join, so we can enable this to speed up query.

What is changed and how it works?

Proposal: xxx

What's Changed:

How it Works:
for mpp outer join, choose the build table based on the row count.

Related changes

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

Check List

Tests

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

Side effects

  • Performance regression
    • Consumes more CPU
    • Consumes more MEM
  • Breaking backward compatibility

Release note

  • allow mpp outer join to choose the build table based on table row count

@ti-srebot ti-srebot requested a review from a team as a code owner June 4, 2021 06:18
@ti-srebot ti-srebot requested review from hanfei1991 and removed request for a team June 4, 2021 06:18
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot ti-srebot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. type/5.0-cherry-pick labels Jun 4, 2021
@ti-srebot ti-srebot requested review from fzhedu and time-and-fate June 4, 2021 06:18
@ti-srebot ti-srebot added this to the v5.0.2 milestone Jun 4, 2021
@ti-srebot
Copy link
Contributor Author

@windtalker you're already a collaborator in bot's repo.

@ti-chi-bot ti-chi-bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 18, 2021
@ti-srebot ti-srebot requested a review from a team as a code owner June 18, 2021 01:55
@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 18, 2021
@github-actions github-actions bot added sig/execution SIG execution sig/sql-infra SIG: SQL Infra labels Jun 18, 2021
@windtalker
Copy link
Contributor

windtalker commented Jun 18, 2021

Cherry-pick #25240 into this pr.

Copy link
Contributor

@fzhedu fzhedu left a comment

Choose a reason for hiding this comment

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

add more cases?

@@ -129,6 +132,9 @@ func (s *tiflashTestSuite) TestReadUnsigedPK(c *C) {
tk.MustExec("set @@session.tidb_isolation_read_engines=\"tiflash\"")
tk.MustExec("set @@session.tidb_allow_mpp=ON")
Copy link
Contributor

Choose a reason for hiding this comment

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

enforce_mpp?

Copy link
Contributor

Choose a reason for hiding this comment

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

enforce_mpp is not supported in release-5.0

Comment on lines +1795 to +1802
if useBCJ || p.ctx.GetSessionVars().MPPOuterJoinFixedBuildSide || len(p.OtherConditions) > 0 {
if p.JoinType == LeftOuterJoin {
preferredBuildIndex = 1
}
} else if p.children[0].statsInfo().Count() > p.children[1].statsInfo().Count() {
preferredBuildIndex = 1
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

does tests cover these cases?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes

@@ -38,6 +38,27 @@
"explain format = 'brief' select count(*) from fact_t where d1_k not in (select d1_k from d1_t)"
]
},
{
"name": "TestMPPOuterJoinBuildSideForBroadcastJoin",
"cases": [
Copy link
Contributor

Choose a reason for hiding this comment

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

add more case for other conditions, cross join?

also need randgen tests to guarantee rightness.

Copy link
Contributor

Choose a reason for hiding this comment

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

If the outer join has other condition, it will always use inner table as the build side, this behavior is not changed by this pr. For cross join, TiFlash will convert Cross right join to Cross left join, so is not affected by this pr.

Copy link
Contributor

@fzhedu fzhedu left a comment

Choose a reason for hiding this comment

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

/LGTM

@ti-chi-bot
Copy link
Member

@fzhedu: Please use GitHub review feature instead of /lgtm [cancel] when you want to submit review to the pull request.
For how to use GitHub review feature, see also this document provided by GitHub.

For the reason we drop support to the commands, see also this page.
This reply is being used as a temporary reply during the migration of review process and will be removed on July 1st.

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 ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 18, 2021
@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • fzhedu
  • hanfei1991

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 status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 18, 2021
@windtalker
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

@windtalker: /merge is only allowed for the committers, you can assign this pull request to the committer in list by filling /assign @committer in the comment to help merge this pull request.

In response to this:

/merge

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.

@xiongjiwei
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 0d88cc6

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 18, 2021
@windtalker
Copy link
Contributor

/run-all-tests

@ti-chi-bot ti-chi-bot merged commit fbe99ff into pingcap:release-5.0 Jun 18, 2021
@zhouqiang-cl zhouqiang-cl modified the milestones: v5.0.2, v5.0.3 Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Cherry pick PR approved by release team. sig/execution SIG execution sig/sql-infra SIG: SQL Infra 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. type/5.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants