Skip to content
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: Unexpected TableScan #38967

Closed
qw4990 opened this issue Nov 8, 2022 · 1 comment
Closed

planner: Unexpected TableScan #38967

qw4990 opened this issue Nov 8, 2022 · 1 comment
Assignees
Labels
epic/cost-model the optimizer cost model sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.

Comments

@qw4990
Copy link
Contributor

qw4990 commented Nov 8, 2022

Enhancement

create table t (a int, b int, key(a));
insert into t values (1, 1);
analyze table t;
explain select a from t;
+-----------------------+---------+-----------+---------------+----------------------+
| id                    | estRows | task      | access object | operator info        |
+-----------------------+---------+-----------+---------------+----------------------+
| TableReader_5         | 1.00    | root      |               | data:TableFullScan_4 |
| └─TableFullScan_4     | 1.00    | cop[tikv] | table:t       | keep order:false     |
+-----------------------+---------+-----------+---------------+----------------------+
2 rows in set (0.01 sec)

The above case should use an IndexScan instead of a TableScan since IndexScan has a smaller row-size.

@qw4990 qw4990 added type/enhancement The issue or PR belongs to an enhancement. sig/planner SIG: Planner epic/cost-model the optimizer cost model labels Nov 8, 2022
@qw4990 qw4990 self-assigned this Nov 8, 2022
@qw4990
Copy link
Contributor Author

qw4990 commented Nov 8, 2022

The root cause is that the current way to calculate row-size is too complex and not robust.
This can be solved by #35240.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic/cost-model the optimizer cost model sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

2 participants