-
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
point_get is not chosen as expected #31543
Comments
tidb/planner/core/point_get_plan.go Lines 1487 to 1494 in 50dfe6b
We should check for _, col := range tbl.Columns {
logutil.BgLogger().Error(fmt.Sprintf("%v, %v",col.Name.L, colName.Name.L))
if colName.Name.L == model.ExtraHandleName.L && !tbl.PKIsHandle {
colInfo := model.NewExtraHandleColInfo()
colInfo.Offset = len(tbl.Columns) - 1
return colInfo
}
if col.Name.L == colName.Name.L {
return col
}
} |
Before: tidb> explain select t.*, _tidb_rowid from t where a = 1;
+-------------------------------+---------+-----------+-----------------------+---------------------------------------------+
| id | estRows | task | access object | operator info |
+-------------------------------+---------+-----------+-----------------------+---------------------------------------------+
| IndexLookUp_7 | 1.00 | root | | |
| ├─IndexRangeScan_5(Build) | 1.00 | cop[tikv] | table:t, index:idx(a) | range:[1,1], keep order:false, stats:pseudo |
| └─TableRowIDScan_6(Probe) | 1.00 | cop[tikv] | table:t | keep order:false, stats:pseudo |
+-------------------------------+---------+-----------+-----------------------+---------------------------------------------+
3 rows in set (0.00 sec) After: tidb> explain analyze select t.*, _tidb_rowid from t where a = 1;
+-------------+---------+---------+------+-----------------------+-------------------------------------------------------------+---------------+--------+------+
| id | estRows | actRows | task | access object | execution info | operator info | memory | disk |
+-------------+---------+---------+------+-----------------------+-------------------------------------------------------------+---------------+--------+------+
| Point_Get_1 | 1.00 | 1 | root | table:t, index:idx(a) | time:112.8µs, loops:2, Get:{num_rpc:2, total_time:33.8µs} | | N/A | N/A |
+-------------+---------+---------+------+-----------------------+-------------------------------------------------------------+---------------+--------+------+ |
point_get -> projection |
|
|
Enhancement
schema
sql1:
sql2:
Expected:
Both SQL1 and SQL2 use point_get plan.
Actual:
SQL1 does not use the point_get plan.
The text was updated successfully, but these errors were encountered: