planner: let projection can push down to TiFlash when mpp is not enforced.#26207
planner: let projection can push down to TiFlash when mpp is not enforced.#26207LittleFall wants to merge 3 commits into
Conversation
|
[REVIEW NOTIFICATION] This pull request has not been approved. To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. DetailsReviewer can indicate their review by submitting an approval review. |
|
/cc @hanfei1991 @rebelice |
6ddd78b to
b8eecf1
Compare
|
/sig planner |
8ad0483 to
676225a
Compare
| tk.MustExec("drop table if exists t") | ||
| tk.MustExec("create table t(a int, b int, index idx_a(a), index idx_b(b))") | ||
| tk.MustExec("insert into t values (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8), (9,9), (10,10)") | ||
| tk.MustExec("create table t(a int, index idx_a(a))") |
There was a problem hiding this comment.
What happened to these test?
|
|
||
| // Even if index of TiKV has lower cost, it chooses TiFlash. | ||
| rows = tk.MustQuery("explain select * from t where a >= 11 and b >= 11").Rows() | ||
| rows = tk.MustQuery("explain select * from t where a >= 11").Rows() |
There was a problem hiding this comment.
Why change the binding tests?
|
after #25450 and this pr is patched, the cost of some plan will be changed (The cost of plan on tiflash is reduced because it can use mpp), �so some test is broken. |
For example, the bind test. In this test, it is assumed that it will select tikv. In fact, it selected tiflash. In order to ensure that it reaches tikv, I modified the test sql. |
|
another things is after this patch, the estCost in drop table t;
create table t(a int, index idx(a));
alter table t set tiflash replica 1;
analyze table t;
explain format='verbose' select /*+ read_from_storage(tikv[t]) */ * from t where a>=11; -- 11473
explain format='verbose' select * from t where a>=11; -- 12098
explain format='verbose' select /*+ read_from_storage(tiflash[t]) */ * from t where a>=11; -- 12098 |
|
I will close this pr because the influence on optimizer cost model can't be evaluated. |
What problem does this PR solve?
Problem Summary: #25450 support projection push down to TiFlash, but it only takes effect when mpp mode is enforced. This changes the semantics of
tidb_enforce_mpp: It will introduce new optimization rules instead of just ignoring the optimizer cost estimate.What is changed and how it works?
Proposal: xxx
What's Changed: make this optimization rule takes effect in the normal situation.
Check List
Tests
Side effects
It may bring more optimizer search space and branches, but in TP business, it will be blocked by the following check
p.canPushToCop.Documentation
Release note