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: costs of Selection operators from DataSources are not accumulated #36243

Closed
qw4990 opened this issue Jul 15, 2022 · 1 comment · Fixed by #36244
Closed

planner: costs of Selection operators from DataSources are not accumulated #36243

qw4990 opened this issue Jul 15, 2022 · 1 comment · Fixed by #36244
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 Jul 15, 2022

Enhancement

mysql> create table t (a int);

mysql> insert into mysql.expr_pushdown_blacklist values ('>','tikv','');
Query OK, 1 row affected (0.00 sec)

mysql> admin reload expr_pushdown_blacklist;
Query OK, 0 rows affected (0.00 sec)

mysql> explain format=verbose select * from tx where a>0;
+-------------------------+----------+-----------+-----------+---------------+--------------------------------+
| id                      | estRows  | estCost   | task      | access object | operator info                  |
+-------------------------+----------+-----------+-----------+---------------+--------------------------------+
| Selection_7             | 3333.33  | 34418.00  | root      |               | gt(test.tx.a, 0)               |
| └─TableReader_6         | 10000.00 | 34418.00  | root      |               | data:TableFullScan_5           |
|   └─TableFullScan_5     | 10000.00 | 435000.00 | cop[tikv] | table:tx      | keep order:false, stats:pseudo |
+-------------------------+----------+-----------+-----------+---------------+--------------------------------+
3 rows in set, 1 warning (0.01 sec)

As you can see above, Selection_7 has the same cost with TableReader_6, which is not correct.

@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 Jul 15, 2022
@qw4990 qw4990 self-assigned this Jul 15, 2022
@qw4990
Copy link
Contributor Author

qw4990 commented Jul 15, 2022

For safety, I'll just fix it in cost model ver2 and keep it unchanged in ver1.

@qw4990 qw4990 reopened this Oct 11, 2022
@qw4990 qw4990 closed this as completed Dec 1, 2022
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

Successfully merging a pull request may close this issue.

1 participant