-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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 from cost model1 to model2 #39013
Changes from 1 commit
8a3be2e
60dde93
73d6cb1
b6b8e00
b4eab94
4990426
1fc6491
db4f4c9
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 |
---|---|---|
|
@@ -384,12 +384,12 @@ | |
" │ └─TableFullScan 10.00 cop[tikv] table:t keep order:false", | ||
" └─StreamAgg(Probe) 10.00 root funcs:count(1)->Column#21", | ||
" └─HashJoin 10.00 root inner join, equal:[eq(test.t.a, test.t.a)]", | ||
" ├─TableReader(Build) 10.00 root data:Selection", | ||
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, IndexScan is always better than TableScan. |
||
" ├─IndexReader(Build) 10.00 root index:Selection", | ||
" │ └─Selection 10.00 cop[tikv] eq(test.t.a, test.t.a), not(isnull(test.t.a))", | ||
" │ └─TableFullScan 100.00 cop[tikv] table:t1 keep order:false", | ||
" └─TableReader(Probe) 10.00 root data:Selection", | ||
" │ └─IndexFullScan 100.00 cop[tikv] table:t1, index:idx(c, b, a) keep order:false", | ||
" └─IndexReader(Probe) 10.00 root index:Selection", | ||
" └─Selection 10.00 cop[tikv] eq(test.t.a, test.t.a), not(isnull(test.t.a))", | ||
" └─TableFullScan 100.00 cop[tikv] table:s keep order:false" | ||
" └─IndexFullScan 100.00 cop[tikv] table:s, index:idx(c, b, a) keep order:false" | ||
], | ||
[ | ||
"Projection 10.00 root Column#13", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1964,21 +1964,20 @@ | |
{ | ||
"SQL": "select * from t where a > 1 order by f", | ||
"Plan": [ | ||
"IndexLookUp_14 3333.33 136747.00 root ", | ||
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, model2 prefers to use single-read Scan instead of double-read Lookup if not much data to access. |
||
"├─Selection_13(Build) 3333.33 585000.00 cop[tikv] gt(test.t.a, 1)", | ||
"│ └─IndexFullScan_11 10000.00 555000.00 cop[tikv] table:t, index:f(f) keep order:true, stats:pseudo", | ||
"└─TableRowIDScan_12(Probe) 3333.33 370000.00 cop[tikv] table:t keep order:false, stats:pseudo" | ||
"Sort_5 3333.33 2146348.14 root test.t.f", | ||
"└─TableReader_9 3333.33 160128.74 root data:TableRangeScan_8", | ||
" └─TableRangeScan_8 3333.33 923531.15 cop[tikv] table:t range:(1,+inf], keep order:false, stats:pseudo" | ||
], | ||
"Warnings": [ | ||
"Note 1105 [t,f,f_g] remain after pruning paths for t given Prop{SortItems: [{test.t.f asc}], TaskTp: rootTask}" | ||
"Note 1105 [t] remain after pruning paths for t given Prop{SortItems: [], TaskTp: rootTask}" | ||
] | ||
}, | ||
{ | ||
"SQL": "select * from t where f > 1", | ||
"Plan": [ | ||
"IndexLookUp_10 3333.33 86674.83 root ", | ||
"├─IndexRangeScan_8(Build) 3333.33 185000.00 cop[tikv] table:t, index:f(f) range:(1,+inf], keep order:false, stats:pseudo", | ||
"└─TableRowIDScan_9(Probe) 3333.33 370000.00 cop[tikv] table:t keep order:false, stats:pseudo" | ||
"TableReader_7 3333.33 316532.90 root data:Selection_6", | ||
"└─Selection_6 3333.33 3269593.45 cop[tikv] gt(test.t.f, 1)", | ||
" └─TableFullScan_5 10000.00 2770593.45 cop[tikv] table:t keep order:false, stats:pseudo" | ||
], | ||
"Warnings": [ | ||
"Note 1105 [t,f,f_g] remain after pruning paths for t given Prop{SortItems: [], TaskTp: rootTask}" | ||
|
@@ -1987,8 +1986,8 @@ | |
{ | ||
"SQL": "select f from t where f > 1", | ||
"Plan": [ | ||
"IndexReader_6 3333.33 11140.22 root index:IndexRangeScan_5", | ||
"└─IndexRangeScan_5 3333.33 140000.00 cop[tikv] table:t, index:f(f) range:(1,+inf], keep order:false, stats:pseudo" | ||
"IndexReader_6 3333.33 50257.78 root index:IndexRangeScan_5", | ||
"└─IndexRangeScan_5 3333.33 542666.67 cop[tikv] table:t, index:f(f) range:(1,+inf], keep order:false, stats:pseudo" | ||
], | ||
"Warnings": [ | ||
"Note 1105 [f,f_g] remain after pruning paths for t given Prop{SortItems: [], TaskTp: rootTask}" | ||
|
@@ -1997,10 +1996,10 @@ | |
{ | ||
"SQL": "select * from t where f > 3 and g = 5", | ||
"Plan": [ | ||
"IndexLookUp_15 3.33 206.74 root ", | ||
"├─IndexRangeScan_12(Build) 10.00 570.00 cop[tikv] table:t, index:g(g) range:[5,5], keep order:false, stats:pseudo", | ||
"└─Selection_14(Probe) 3.33 1140.00 cop[tikv] gt(test.t.f, 3)", | ||
" └─TableRowIDScan_13 10.00 1110.00 cop[tikv] table:t keep order:false, stats:pseudo" | ||
"IndexLookUp_15 3.33 19551.99 root ", | ||
"├─IndexRangeScan_12(Build) 10.00 2035.00 cop[tikv] table:t, index:g(g) range:[5,5], keep order:false, stats:pseudo", | ||
"└─Selection_14(Probe) 3.33 3269.59 cop[tikv] gt(test.t.f, 3)", | ||
" └─TableRowIDScan_13 10.00 2770.59 cop[tikv] table:t keep order:false, stats:pseudo" | ||
], | ||
"Warnings": [ | ||
"Note 1105 [t,f_g,g] remain after pruning paths for t given Prop{SortItems: [], TaskTp: rootTask}" | ||
|
@@ -2009,10 +2008,10 @@ | |
{ | ||
"SQL": "select * from t where g = 5 order by f", | ||
"Plan": [ | ||
"Sort_5 10.00 353.68 root test.t.f", | ||
"└─IndexLookUp_13 10.00 230.01 root ", | ||
" ├─IndexRangeScan_11(Build) 10.00 570.00 cop[tikv] table:t, index:g(g) range:[5,5], keep order:false, stats:pseudo", | ||
" └─TableRowIDScan_12(Probe) 10.00 1110.00 cop[tikv] table:t keep order:false, stats:pseudo" | ||
"Sort_5 10.00 21321.97 root test.t.f", | ||
"└─IndexLookUp_13 10.00 19545.34 root ", | ||
" ├─IndexRangeScan_11(Build) 10.00 2035.00 cop[tikv] table:t, index:g(g) range:[5,5], keep order:false, stats:pseudo", | ||
" └─TableRowIDScan_12(Probe) 10.00 2770.59 cop[tikv] table:t keep order:false, stats:pseudo" | ||
], | ||
"Warnings": [ | ||
"Note 1105 [t,g] remain after pruning paths for t given Prop{SortItems: [], TaskTp: rootTask}" | ||
|
@@ -2021,10 +2020,10 @@ | |
{ | ||
"SQL": "select * from t where d = 3 order by c, e", | ||
"Plan": [ | ||
"IndexLookUp_15 10.00 57222.78 root ", | ||
"├─Selection_14(Build) 10.00 855000.00 cop[tikv] eq(test.t.d, 3)", | ||
"│ └─IndexFullScan_12 10000.00 825000.00 cop[tikv] table:t, index:c_d_e(c, d, e) keep order:true, stats:pseudo", | ||
"└─TableRowIDScan_13(Probe) 10.00 1110.00 cop[tikv] table:t keep order:false, stats:pseudo" | ||
"IndexLookUp_15 10.00 215519.24 root ", | ||
"├─Selection_14(Build) 10.00 2941000.00 cop[tikv] eq(test.t.d, 3)", | ||
"│ └─IndexFullScan_12 10000.00 2442000.00 cop[tikv] table:t, index:c_d_e(c, d, e) keep order:true, stats:pseudo", | ||
"└─TableRowIDScan_13(Probe) 10.00 2770.59 cop[tikv] table:t keep order:false, stats:pseudo" | ||
], | ||
"Warnings": [ | ||
"Note 1105 [t,c_d_e] remain after pruning paths for t given Prop{SortItems: [{test.t.c asc} {test.t.e asc}], TaskTp: rootTask}" | ||
|
@@ -2043,31 +2042,31 @@ | |
{ | ||
"SQL": "explain format = 'verbose' select * from t where b > 5", | ||
"Plan": [ | ||
"TableReader_7 3.00 19.21 root data:Selection_6", | ||
"└─Selection_6 3.00 195.00 cop[tikv] gt(test.t.b, 5)", | ||
" └─TableFullScan_5 5.00 180.00 cop[tikv] table:t keep order:false" | ||
"TableReader_7 3.00 130.42 root data:Selection_6", | ||
"└─Selection_6 3.00 1386.04 cop[tikv] gt(test.t.b, 5)", | ||
" └─TableFullScan_5 5.00 1136.54 cop[tikv] table:t keep order:false" | ||
], | ||
"Warnings": null | ||
}, | ||
{ | ||
"SQL": "explain format = 'verbose' select * from t where b = 6 order by a limit 1", | ||
"Plan": [ | ||
"Limit_11 0.00 14.33 root offset:0, count:1", | ||
"└─TableReader_24 0.00 14.33 root data:Limit_23", | ||
" └─Limit_23 0.00 195.00 cop[tikv] offset:0, count:1", | ||
" └─Selection_22 0.00 195.00 cop[tikv] eq(test.t.b, 6)", | ||
" └─TableFullScan_21 5.00 180.00 cop[tikv] table:t keep order:true" | ||
"Limit_11 0.00 92.40 root offset:0, count:1", | ||
"└─TableReader_24 0.00 92.40 root data:Limit_23", | ||
" └─Limit_23 0.00 1386.04 cop[tikv] offset:0, count:1", | ||
" └─Selection_22 0.00 1386.04 cop[tikv] eq(test.t.b, 6)", | ||
" └─TableFullScan_21 5.00 1136.54 cop[tikv] table:t keep order:true" | ||
], | ||
"Warnings": null | ||
}, | ||
{ | ||
"SQL": "explain format = 'verbose' select * from t where b = 6 limit 1", | ||
"Plan": [ | ||
"Limit_8 0.00 14.33 root offset:0, count:1", | ||
"└─TableReader_13 0.00 14.33 root data:Limit_12", | ||
" └─Limit_12 0.00 195.00 cop[tikv] offset:0, count:1", | ||
" └─Selection_11 0.00 195.00 cop[tikv] eq(test.t.b, 6)", | ||
" └─TableFullScan_10 5.00 180.00 cop[tikv] table:t keep order:false" | ||
"Limit_8 0.00 92.40 root offset:0, count:1", | ||
"└─TableReader_13 0.00 92.40 root data:Limit_12", | ||
" └─Limit_12 0.00 1386.04 cop[tikv] offset:0, count:1", | ||
" └─Selection_11 0.00 1386.04 cop[tikv] eq(test.t.b, 6)", | ||
" └─TableFullScan_10 5.00 1136.54 cop[tikv] table:t keep order:false" | ||
], | ||
"Warnings": null | ||
}, | ||
|
@@ -2079,9 +2078,9 @@ | |
{ | ||
"SQL": "explain format = 'verbose' select * from t where b > 5", | ||
"Plan": [ | ||
"IndexLookUp_7 3.00 57.91 root ", | ||
"├─IndexRangeScan_5(Build) 3.00 171.00 cop[tikv] table:t, index:idx_b(b) range:(5,+inf], keep order:false", | ||
"└─TableRowIDScan_6(Probe) 3.00 108.00 cop[tikv] table:t keep order:false" | ||
"IndexLookUp_7 3.00 5856.46 root ", | ||
"├─IndexRangeScan_5(Build) 3.00 610.50 cop[tikv] table:t, index:idx_b(b) range:(5,+inf], keep order:false", | ||
"└─TableRowIDScan_6(Probe) 3.00 681.92 cop[tikv] table:t keep order:false" | ||
], | ||
"Warnings": [ | ||
"Note 1105 [idx_b] remain after pruning paths for t given Prop{SortItems: [], TaskTp: rootTask}" | ||
|
@@ -2090,9 +2089,9 @@ | |
{ | ||
"SQL": "explain format = 'verbose' select * from t where b = 6 order by a limit 1", | ||
"Plan": [ | ||
"TopN_9 0.00 19.34 root test.t.a, offset:0, count:1", | ||
"└─IndexLookUp_16 0.00 19.33 root ", | ||
" ├─TopN_15(Build) 0.00 0.00 cop[tikv] test.t.a, offset:0, count:1", | ||
"TopN_9 0.00 1925.01 root test.t.a, offset:0, count:1", | ||
"└─IndexLookUp_16 0.00 1920.21 root ", | ||
" ├─TopN_15(Build) 0.00 3.20 cop[tikv] test.t.a, offset:0, count:1", | ||
" │ └─IndexRangeScan_13 0.00 0.00 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false", | ||
" └─TableRowIDScan_14(Probe) 0.00 0.00 cop[tikv] table:t keep order:false" | ||
], | ||
|
@@ -2103,7 +2102,7 @@ | |
{ | ||
"SQL": "explain format = 'verbose' select * from t where b = 6 limit 1", | ||
"Plan": [ | ||
"IndexLookUp_13 0.00 19.33 root limit embedded(offset:0, count:1)", | ||
"IndexLookUp_13 0.00 1152.00 root limit embedded(offset:0, count:1)", | ||
"├─Limit_12(Build) 0.00 0.00 cop[tikv] offset:0, count:1", | ||
"│ └─IndexRangeScan_10 0.00 0.00 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false", | ||
"└─TableRowIDScan_11(Probe) 0.00 0.00 cop[tikv] table:t keep order:false" | ||
|
@@ -4314,9 +4313,9 @@ | |
{ | ||
"SQL": "desc format = 'brief' select /*+ read_from_storage(tikv[t], tiflash[t]) */ avg(a) from t", | ||
"Plan": [ | ||
"StreamAgg 1.00 root funcs:avg(Column#7, Column#8)->Column#4", | ||
"└─IndexReader 1.00 root index:StreamAgg", | ||
" └─StreamAgg 1.00 cop[tikv] funcs:count(test.t.a)->Column#7, funcs:sum(test.t.a)->Column#8", | ||
"HashAgg 1.00 root funcs:avg(Column#5, Column#6)->Column#4", | ||
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, HashAgg is better since there are lots of rows(10000) to process. |
||
"└─IndexReader 1.00 root index:HashAgg", | ||
" └─HashAgg 1.00 cop[tikv] funcs:count(test.t.a)->Column#5, funcs:sum(test.t.a)->Column#6", | ||
" └─IndexFullScan 10000.00 cop[tikv] table:t, index:ia(a) keep order:false, stats:pseudo" | ||
], | ||
"Warn": [ | ||
|
@@ -4326,19 +4325,19 @@ | |
{ | ||
"SQL": "desc format = 'brief' select /*+ read_from_storage(tikv[t]) */ avg(a) from t", | ||
"Plan": [ | ||
"StreamAgg 1.00 root funcs:avg(Column#7, Column#8)->Column#4", | ||
"└─IndexReader 1.00 root index:StreamAgg", | ||
" └─StreamAgg 1.00 cop[tikv] funcs:count(test.t.a)->Column#7, funcs:sum(test.t.a)->Column#8", | ||
"HashAgg 1.00 root funcs:avg(Column#5, Column#6)->Column#4", | ||
"└─IndexReader 1.00 root index:HashAgg", | ||
" └─HashAgg 1.00 cop[tikv] funcs:count(test.t.a)->Column#5, funcs:sum(test.t.a)->Column#6", | ||
" └─IndexFullScan 10000.00 cop[tikv] table:t, index:ia(a) keep order:false, stats:pseudo" | ||
], | ||
"Warn": null | ||
}, | ||
{ | ||
"SQL": "desc format = 'brief' select /*+ read_from_storage(tiflash[t]) */ avg(a) from t", | ||
"Plan": [ | ||
"StreamAgg 1.00 root funcs:avg(Column#7, Column#8)->Column#4", | ||
"└─IndexReader 1.00 root index:StreamAgg", | ||
" └─StreamAgg 1.00 cop[tikv] funcs:count(test.t.a)->Column#7, funcs:sum(test.t.a)->Column#8", | ||
"HashAgg 1.00 root funcs:avg(Column#5, Column#6)->Column#4", | ||
"└─IndexReader 1.00 root index:HashAgg", | ||
" └─HashAgg 1.00 cop[tikv] funcs:count(test.t.a)->Column#5, funcs:sum(test.t.a)->Column#6", | ||
" └─IndexFullScan 10000.00 cop[tikv] table:t, index:ia(a) keep order:false, stats:pseudo" | ||
], | ||
"Warn": [ | ||
|
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 plan change, just update Operator ID.