-
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 use cost model2 #38875
Changes from 8 commits
d048aad
885552d
28ab270
5362285
26c12c2
d443761
69fec6f
f98bd77
b3bde8a
4a09ea0
735549b
0414a3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,11 +65,11 @@ | |
"Result": [ | ||
"HashJoin 4166.67 root right outer join, equal:[eq(test.t1.a, test.t2.a)]", | ||
"├─TableReader(Build) 3333.33 root data:Selection", | ||
"│ └─Selection 3333.33 cop[tikv] gt(test.t1.a, 1), not(isnull(test.t1.a))", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both sides are accepted since they have the same est-row 3333.33. |
||
"│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo", | ||
"│ └─Selection 3333.33 cop[tikv] gt(test.t2.a, 1)", | ||
"│ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo", | ||
"└─TableReader(Probe) 3333.33 root data:Selection", | ||
" └─Selection 3333.33 cop[tikv] gt(test.t2.a, 1)", | ||
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo" | ||
" └─Selection 3333.33 cop[tikv] gt(test.t1.a, 1), not(isnull(test.t1.a))", | ||
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo" | ||
] | ||
}, | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,10 +45,9 @@ | |
{ | ||
"SQL": "explain format = 'brief' select count(*) from t group by a", | ||
"Plan": [ | ||
"HashAgg 2.00 root group by:test.t.a, funcs:count(Column#4)->Column#3", | ||
"└─TableReader 2.00 root data:HashAgg", | ||
" └─HashAgg 2.00 cop[tikv] group by:test.t.a, funcs:count(1)->Column#4", | ||
" └─TableFullScan 8.00 cop[tikv] table:t keep order:false" | ||
"HashAgg 2.00 root group by:test.t.a, funcs:count(1)->Column#3", | ||
"└─TableReader 8.00 root data:TableFullScan", | ||
" └─TableFullScan 8.00 cop[tikv] table:t keep order:false" | ||
] | ||
} | ||
] | ||
|
@@ -160,13 +159,13 @@ | |
], | ||
"Plan": [ | ||
"Limit 1.00 root offset:0, count:1", | ||
"└─IndexJoin 1.00 root left outer semi join, inner:IndexReader, outer key:test.t.a, inner key:test.t.b, equal cond:eq(test.t.a, test.t.b)", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expected since cost of IndexJoin is under-estimated in model1. |
||
" ├─TopN(Build) 1.00 root test.t.a, offset:0, count:1", | ||
" │ └─IndexReader 1.00 root index:TopN", | ||
" │ └─TopN 1.00 cop[tikv] test.t.a, offset:0, count:1", | ||
" │ └─IndexRangeScan 6.00 cop[tikv] table:t1, index:idx_bc(b, c) range:[-inf,6], keep order:false", | ||
" └─IndexReader(Probe) 1.04 root index:IndexRangeScan", | ||
" └─IndexRangeScan 1.04 cop[tikv] table:t2, index:idx_bc(b, c) range: decided by [eq(test.t.b, test.t.a)], keep order:false" | ||
"└─MergeJoin 1.00 root left outer semi join, left key:test.t.a, right key:test.t.b", | ||
" ├─IndexReader(Build) 25.00 root index:IndexFullScan", | ||
" │ └─IndexFullScan 25.00 cop[tikv] table:t2, index:idx_bc(b, c) keep order:true", | ||
" └─TopN(Probe) 1.00 root test.t.a, offset:0, count:1", | ||
" └─IndexReader 1.00 root index:TopN", | ||
" └─TopN 1.00 cop[tikv] test.t.a, offset:0, count:1", | ||
" └─IndexRangeScan 6.00 cop[tikv] table:t1, index:idx_bc(b, c) range:[-inf,6], keep order:false" | ||
] | ||
}, | ||
{ | ||
|
@@ -433,13 +432,13 @@ | |
{ | ||
"Name": "TestIndexRead", | ||
"Cases": [ | ||
"IndexReader(Index(t.e)[[NULL,+inf]])->HashAgg", | ||
"IndexReader(Index(t.e)[[NULL,+inf]]->StreamAgg)->StreamAgg", | ||
"IndexReader(Index(t.e)[[-inf,10]]->StreamAgg)->StreamAgg", | ||
"IndexReader(Index(t.e)[[-inf,50]]->StreamAgg)->StreamAgg", | ||
"IndexReader(Index(t.b_c)[[NULL,+inf]]->Sel([gt(test.t.c, 1)])->HashAgg)->HashAgg", | ||
"IndexReader(Index(t.b_c)[[NULL,+inf]]->Sel([gt(test.t.c, 1)])->StreamAgg)->StreamAgg", | ||
"IndexLookUp(Index(t.e)[[1,1]], Table(t))->HashAgg", | ||
"TableReader(Table(t)->Sel([gt(test.t.e, 1)])->HashAgg)->HashAgg", | ||
"IndexLookUp(Index(t.b)[[-inf,20]], Table(t)->HashAgg)->HashAgg", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expected since cost of IndexLookup is under-estimated in model1. |
||
"TableReader(Table(t)->Sel([le(test.t.b, 20)])->StreamAgg)->StreamAgg", | ||
"TableReader(Table(t)->Sel([le(test.t.b, 30)])->StreamAgg)->StreamAgg", | ||
"TableReader(Table(t)->Sel([le(test.t.b, 40)])->StreamAgg)->StreamAgg", | ||
"TableReader(Table(t)->Sel([le(test.t.b, 50)])->StreamAgg)->StreamAgg", | ||
|
@@ -449,7 +448,7 @@ | |
"TableReader(Table(t)->Sel([le(test.t.b, 10000000000)]))", | ||
"TableReader(Table(t)->Sel([le(test.t.b, 50)]))", | ||
"TableReader(Table(t)->Sel([le(test.t.b, 100)])->Limit)->Limit", | ||
"IndexLookUp(Index(t.b)[[-inf,1]]->TopN([test.t.a],0,10), Table(t))->TopN([test.t.a],0,10)", | ||
"TableReader(Table(t)->Sel([le(test.t.b, 1)])->Limit)->Limit", | ||
"IndexLookUp(Index(t.b)[[1,1]], Table(t))", | ||
"IndexLookUp(Index(t.d)[[-inf,1991-09-05 00:00:00)], Table(t))", | ||
"IndexLookUp(Index(t.ts)[[-inf,1991-09-05 00:00:00)], Table(t))", | ||
|
@@ -501,10 +500,10 @@ | |
"SQL": "explain format = 'brief' select * from t where a <= 10000 order by b limit 1", | ||
"Plan": [ | ||
"TopN 1.00 root test.t.b, offset:0, count:1", | ||
"└─IndexLookUp 1.00 root ", | ||
" ├─IndexRangeScan(Build) 10000.00 cop[tikv] table:t, index:idx_a(a) range:[-inf,10000], keep order:false", | ||
" └─TopN(Probe) 1.00 cop[tikv] test.t.b, offset:0, count:1", | ||
" └─TableRowIDScan 10000.00 cop[tikv] table:t keep order:false" | ||
"└─TableReader 1.00 root data:TopN", | ||
" └─TopN 1.00 cop[tikv] test.t.b, offset:0, count:1", | ||
" └─Selection 10000.00 cop[tikv] le(test.t.a, 10000)", | ||
" └─TableFullScan 1000000.00 cop[tikv] table:t keep order:false" | ||
] | ||
}, | ||
{ | ||
|
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 since model2 prefers to use StreamAgg instead of HashAgg if no much data to process.