-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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: update some UTs to cost model2 #38893
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
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. Reviewer can indicate their review by submitting an approval review. |
@@ -745,12 +745,12 @@ | |||
{ | |||
"name": "TestPushDownProjectionForTiFlash", | |||
"cases": [ | |||
"desc format = 'brief' select /*+ hash_agg()*/ count(b) from (select id + 1 as b from t)A", |
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.
Expected, just add some hints to fix them to use TiFlash.
" ├─TopN(Build) 3.00 cop[tikv] test.tbl.b:desc, offset:0, count:3", | ||
" │ └─IndexRangeScan 4.00 cop[tikv] table:tbl, index:idx_b_c(b, c) range:(1,+inf], keep order:false", | ||
" └─TableRowIDScan(Probe) 3.00 cop[tikv] table:tbl keep order:false" | ||
"Limit 1.00 root offset:2, count: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.
Expected, Limit+Order is better than TopN.
@@ -4878,13 +4879,13 @@ | |||
"SQL": "desc format = 'brief' select * from t right join (select id-2 as b from t) A on A.b=t.id", | |||
"Plan": [ | |||
"HashJoin 12487.50 root right outer join, equal:[eq(test.t.id, Column#25)]", | |||
"├─TableReader(Build) 9990.00 root data:Selection", |
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.
Expected, the current build-side has the smaller row-size which results in a smaller hash-build-cost.
"└─TableReader 10000.00 root data:TableFullScan", | ||
" └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo" | ||
"TableReader 10000.00 root data:Projection", | ||
"└─Projection 10000.00 cop[tikv] md5(test.t.s)->Column#13", |
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.
Expected, pushing the Projection down can result a smaller cost.
"│ └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo", | ||
"└─Projection(Probe) 10000.00 root minus(test.t.id, 2)->Column#9", |
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.
Expected, the current build-side has the smaller row-size which results in a smaller hash-build-cost.
" └─HashAgg 8000.00 mpp[tiflash] group by:test.t.id, funcs:sum(Column#21)->Column#20, funcs:sum(Column#22)->Column#5, funcs:firstrow(test.t.id)->test.t.id", | ||
" └─ExchangeReceiver 8000.00 mpp[tiflash] ", | ||
" └─ExchangeSender 8000.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.t.id, collate: binary]", | ||
" └─HashAgg 8000.00 mpp[tiflash] group by:Column#26, funcs:count(Column#24)->Column#21, funcs:sum(Column#25)->Column#22", |
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.
Expected, 2Phase-Agg is better than 1Phase-Agg in this case.
" └─HashAgg 8000.00 mpp[tiflash] group by:test.t.id, funcs:sum(Column#12)->Column#5, funcs:firstrow(test.t.id)->test.t.id", | ||
" └─ExchangeReceiver 8000.00 mpp[tiflash] ", | ||
" └─ExchangeSender 8000.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.t.id, collate: binary]", | ||
" └─HashAgg 8000.00 mpp[tiflash] group by:test.t.id, funcs:count(1)->Column#12", |
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.
Expected, 2Phase-Agg is better than 1Phase-Agg in this case.
" └─TableFullScan_18 10000.00 255000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo" | ||
"StreamAgg_10 1.00 65360.67 root funcs:count(1)->Column#4", | ||
"└─TableReader_24 10.00 64861.67 root data:Selection_23", | ||
" └─Selection_23 10.00 972291.38 cop[tiflash] eq(test.t.a, 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.
Expected, no need to push the Agg down since there are only 10 rows.
" └─TableFullScan_20 10000.00 255000.00 mpp[tiflash] table:t keep order:false, stats:pseudo" | ||
"StreamAgg_12 1.00 65360.67 root funcs:count(1)->Column#4", | ||
"└─TableReader_31 10.00 64861.67 root data:Selection_30", | ||
" └─Selection_30 10.00 972291.38 cop[tiflash] eq(test.t.a, 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.
Expected, no need to push the Agg down since there are only 10 rows.
" └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo" | ||
"HashAgg 8000.00 root group by:Column#7, funcs:count(Column#8)->Column#6", | ||
"└─IndexReader 8000.00 root index:HashAgg", | ||
" └─HashAgg 8000.00 cop[tikv] group by:md5(cast(test.t.a, var_string(20))), funcs:count(test.t.a)->Column#8", |
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.
Expected, pushding this Agg down is better in this case.
" └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo" | ||
"StreamAgg 1.00 root funcs:count(Column#8)->Column#6", | ||
"└─TableReader 1.00 root data:StreamAgg", | ||
" └─StreamAgg 1.00 cop[tikv] funcs:count(test.t.a)->Column#8", |
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.
Expected, pushding this Agg down is better in this case.
" │ └─HashAgg_29 8000.00 mpp[tiflash] group by:test.o.c_id, funcs:sum(Column#8)->Column#7, funcs:firstrow(test.o.c_id)->test.o.c_id", | ||
" │ └─ExchangeReceiver_31 8000.00 mpp[tiflash] ", | ||
" │ └─ExchangeSender_30 8000.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.o.c_id, collate: binary]", | ||
" │ └─HashAgg_20 8000.00 mpp[tiflash] group by:test.o.c_id, funcs:count(1)->Column#8", |
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.
Expected, pushding this Agg down is better in this case.
" │ └─HashAgg_30 8000.00 mpp[tiflash] group by:test.o.c_id, test.o.o_id, funcs:sum(Column#9)->Column#7, funcs:firstrow(test.o.o_id)->Column#8, funcs:firstrow(test.o.o_id)->test.o.o_id, funcs:firstrow(test.o.c_id)->test.o.c_id", | ||
" │ └─ExchangeReceiver_32 8000.00 mpp[tiflash] ", | ||
" │ └─ExchangeSender_31 8000.00 mpp[tiflash] ExchangeType: HashPartition, Hash Cols: [name: test.o.o_id, collate: binary], [name: test.o.c_id, collate: binary]", | ||
" │ └─HashAgg_21 8000.00 mpp[tiflash] group by:test.o.c_id, test.o.o_id, funcs:count(1)->Column#9", |
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.
Expected, pushding this Agg down is better in this case.
@@ -1169,10 +1162,10 @@ | |||
{ | |||
"SQL": "EXPLAIN select count(distinct b), json_objectagg(d,c) from t;", | |||
"Plan": [ | |||
"StreamAgg_7 1.00 root funcs:count(distinct Column#9)->Column#7, funcs:json_objectagg(Column#10, Column#11)->Column#8", | |||
"HashAgg_6 1.00 root funcs:count(distinct Column#9)->Column#7, funcs:json_objectagg(Column#10, Column#11)->Column#8", |
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.
Expected, HashAgg is better since the data size to process is not small(10000).
/merge |
This pull request has been accepted and is ready to merge. Commit hash: b48d20a
|
/run-build |
TiDB MergeCI notify🔴 Bad News! [1] CI still failing after this pr merged.
|
What problem does this PR solve?
Issue Number: ref #35240
Problem Summary: planner: update some UTs to cost model2
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.