-
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 cost model2 #39438
planner: update cost model2 #39438
Changes from all commits
f958c5a
f7e0c06
a36e38e
a7150a0
5550b49
1a5c4fe
3ed014f
2c65189
bc1e3ec
847a5d0
40059a9
6dc1374
83c2880
6fa4954
e5a7dc8
bf3006a
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 |
---|---|---|
|
@@ -462,12 +462,12 @@ func TestPointGetUserVarPlanCache(t *testing.T) { | |
tk.Session().SetSessionManager(&testkit.MockSessionManager{PS: ps}) | ||
tk.MustQuery(fmt.Sprintf("explain for connection %d", tkProcess.ID)).Check(testkit.Rows( // can use idx_a | ||
`Projection_9 1.00 root test.t1.a, test.t1.b, test.t2.a, test.t2.b`, | ||
`└─IndexJoin_17 1.00 root inner join, inner:TableReader_13, outer key:test.t2.a, inner key:test.t1.a, equal cond:eq(test.t2.a, test.t1.a)`, | ||
` ├─Selection_44(Build) 0.80 root not(isnull(test.t2.a))`, | ||
` │ └─Point_Get_43 1.00 root table:t2, index:idx_a(a) `, | ||
` └─TableReader_13(Probe) 0.00 root data:Selection_12`, | ||
` └─Selection_12 0.00 cop[tikv] eq(test.t1.a, 1)`, | ||
` └─TableRangeScan_11 0.80 cop[tikv] table:t1 range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo`)) | ||
`└─MergeJoin_10 1.00 root inner join, left key:test.t2.a, right key: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. Expected, MergeJoin is more cpu-effective if data-size is small. |
||
` ├─Selection_42(Build) 10.00 root eq(test.t1.a, 1)`, | ||
` │ └─TableReader_41 10.00 root data:TableRangeScan_40`, | ||
` │ └─TableRangeScan_40 10.00 cop[tikv] table:t1 range:[1,1], keep order:true, stats:pseudo`, | ||
` └─Selection_39(Probe) 0.80 root not(isnull(test.t2.a))`, | ||
` └─Point_Get_38 1.00 root table:t2, index:idx_a(a) `)) | ||
|
||
tk.MustExec("set @a=2") | ||
tk.MustQuery("execute stmt using @a").Check(testkit.Rows( | ||
|
@@ -478,12 +478,12 @@ func TestPointGetUserVarPlanCache(t *testing.T) { | |
tk.Session().SetSessionManager(&testkit.MockSessionManager{PS: ps}) | ||
tk.MustQuery(fmt.Sprintf("explain for connection %d", tkProcess.ID)).Check(testkit.Rows( // can use idx_a | ||
`Projection_9 1.00 root test.t1.a, test.t1.b, test.t2.a, test.t2.b`, | ||
`└─IndexJoin_17 1.00 root inner join, inner:TableReader_13, outer key:test.t2.a, inner key:test.t1.a, equal cond:eq(test.t2.a, test.t1.a)`, | ||
` ├─Selection_44(Build) 0.80 root not(isnull(test.t2.a))`, | ||
` │ └─Point_Get_43 1.00 root table:t2, index:idx_a(a) `, | ||
` └─TableReader_13(Probe) 0.00 root data:Selection_12`, | ||
` └─Selection_12 0.00 cop[tikv] eq(test.t1.a, 2)`, | ||
` └─TableRangeScan_11 0.80 cop[tikv] table:t1 range: decided by [eq(test.t1.a, test.t2.a)], keep order:false, stats:pseudo`)) | ||
`└─MergeJoin_10 1.00 root inner join, left key:test.t2.a, right key:test.t1.a`, | ||
` ├─Selection_42(Build) 10.00 root eq(test.t1.a, 2)`, | ||
` │ └─TableReader_41 10.00 root data:TableRangeScan_40`, | ||
` │ └─TableRangeScan_40 10.00 cop[tikv] table:t1 range:[2,2], keep order:true, stats:pseudo`, | ||
` └─Selection_39(Probe) 0.80 root not(isnull(test.t2.a))`, | ||
` └─Point_Get_38 1.00 root table:t2, index:idx_a(a) `)) | ||
tk.MustQuery("execute stmt using @a").Check(testkit.Rows( | ||
"2 4 2 2", | ||
)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1479,7 +1479,7 @@ func TestIndexNestedLoopHashJoin(t *testing.T) { | |
" └─TableRowIDScan 27.00 cop[tikv] table:l2 keep order:false")) | ||
tk.MustQuery("select * from t l1 where exists ( select * from t l2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey )order by `l_orderkey`,`l_linenumber`;").Check(testkit.Rows("0 0 0 0", "0 1 0 1", "0 2 0 0", "1 0 1 0", "1 1 1 1", "1 2 1 0", "2 0 0 0", "2 1 0 1", "2 2 0 0")) | ||
tk.MustQuery("desc format = 'brief' select count(*) from t l1 where exists ( select * from t l2 where l2.l_orderkey = l1.l_orderkey and l2.l_suppkey <> l1.l_suppkey );").Check(testkit.Rows( | ||
"HashAgg 1.00 root funcs:count(1)->Column#11", | ||
"StreamAgg 1.00 root funcs:count(1)->Column#11", | ||
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, StreamAgg is more cpu-effective if data-size is small. |
||
"└─IndexHashJoin 7.20 root semi join, inner:IndexLookUp, outer key:test.t.l_orderkey, inner key:test.t.l_orderkey, equal cond:eq(test.t.l_orderkey, test.t.l_orderkey), other cond:ne(test.t.l_suppkey, test.t.l_suppkey)", | ||
" ├─TableReader(Build) 9.00 root data:Selection", | ||
" │ └─Selection 9.00 cop[tikv] not(isnull(test.t.l_suppkey))", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,23 +123,23 @@ | |
"operator_info": "data:TableFullScan_16" | ||
} | ||
], | ||
"cost": 975351.9825195674, | ||
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, just update cost values. |
||
"cost": 976848.9825195674, | ||
"est_rows": 100000000, | ||
"act_rows": 8, | ||
"task_type": 1, | ||
"store_type": 1, | ||
"operator_info": "CARTESIAN inner join" | ||
} | ||
], | ||
"cost": 998975351.9825196, | ||
"cost": 998976848.9825196, | ||
"est_rows": 100000000, | ||
"act_rows": 8, | ||
"task_type": 1, | ||
"store_type": 1, | ||
"operator_info": "cast(test.t.a, decimal(10,0) BINARY)->Column#8" | ||
} | ||
], | ||
"cost": 1996975363.5625196, | ||
"cost": 1996978357.5625196, | ||
"est_rows": 1, | ||
"act_rows": 1, | ||
"task_type": 1, | ||
|
@@ -283,7 +283,7 @@ | |
"operator_info": "data:Selection_33" | ||
} | ||
], | ||
"cost": 1798740.0717058014, | ||
"cost": 1800237.0717058014, | ||
"est_rows": 12487.5, | ||
"task_type": 1, | ||
"store_type": 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, not push Agg down.