-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
planner: remove duplicate offset when push down pure limit down across outer join #59927
base: master
Are you sure you want to change the base?
Conversation
drop table if exists t; | ||
create table t(a int, primary key (a)); | ||
insert into t values(1), (2); | ||
select * from t t1 left join t t2 on t1.a=t2.a limit 1, 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about desc the explain result, in the before case the top limit will be eliminated here
tidb> explain select * from t t1 left join t t2 on t1.a=t2.a limit 1, 1;
+----------------------------------+---------+-----------+---------------+--------------------------------------------------------------------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+----------------------------------+---------+-----------+---------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Limit_14 | 1.00 | root | | offset:1, count:1 |
| └─IndexJoin_19 | 1.25 | root | | left outer join, inner:TableReader_16, left side:Limit_26, outer key:test.t.a, inner key:test.t.a, equal cond:eq(test.t.a, test.t.a) |
| ├─Limit_26(Build) | 1.00 | root | | offset:1, count:1 |
| │ └─TableReader_30 | 2.00 | root | | data:Limit_29 |
| │ └─Limit_29 | 2.00 | cop[tikv] | | offset:0, count:2 |
| │ └─TableFullScan_28 | 2.00 | cop[tikv] | table:t1 | keep order:false, stats:pseudo |
| └─TableReader_16(Probe) | 1.00 | root | | data:TableRangeScan_15 |
| └─TableRangeScan_15 | 1.00 | cop[tikv] | table:t2 | range: decided by [test.t.a], keep order:false, stats:pseudo |
+----------------------------------+---------+-----------+---------------+--------------------------------------------------------------------------------------------------------------------------------------+
8 rows in set (0.00 sec)
@winoros: The following test failed, say
Full PR test history. Your PR dashboard. 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 kubernetes-sigs/prow repository. I understand the commands that are listed here. |
@winoros: The following tests failed, say
Full PR test history. Your PR dashboard. 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 kubernetes-sigs/prow repository. I understand the commands that are listed here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AilinKid, elsa0520 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What problem does this PR solve?
Issue Number: close #59926, to fix bug caused by #56483
Problem Summary:
What changed and how does it work?
in the pull #57471, we deal with the wrong case when there's order by. but doesn't fix the case if there's only a limit.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.