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: cost trace for HashAgg in explain results is not correct #32672

Closed
qw4990 opened this issue Feb 28, 2022 · 0 comments · Fixed by #33675
Closed

planner: cost trace for HashAgg in explain results is not correct #32672

qw4990 opened this issue Feb 28, 2022 · 0 comments · Fixed by #33675
Assignees
Labels
severity/minor sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@qw4990
Copy link
Contributor

qw4990 commented Feb 28, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> explain format='verbose' select /*+ hash_agg() */ count(*) from t;
+---------------------------+---------+---------+-----------+---------------+---------------------------------+
| id                        | estRows | estCost | task      | access object | operator info                   |
+---------------------------+---------+---------+-----------+---------------+---------------------------------+
| HashAgg_9                 | 1.00    | 0.00    | root      |               | funcs:count(Column#4)->Column#3 |
| └─TableReader_10          | 1.00    | 9.08    | root      |               | data:HashAgg_5                  |
|   └─HashAgg_5             | 1.00    | 42.68   | cop[tikv] |               | funcs:count(1)->Column#4        |
|     └─TableFullScan_8     | 3.00    | 119.00  | cop[tikv] | table:t       | keep order:false                |
+---------------------------+---------+---------+-----------+---------------+---------------------------------+
4 rows in set (0.00 sec)

The actual cost of this plan is correct, but the traced cost(estCost in the explain result) is not correct.

2. What did you expect to see? (Required)

The cost of HashAgg_9 shouldn't be 0.

3. What did you see instead (Required)

It's 0.

4. What is your TiDB version? (Required)

mysql> select tidb_version();
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                                            |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v5.5.0-alpha-430-gc19e899b6
Edition: Community
Git Commit Hash: c19e899b6559ffbb0c5ab9c5c95fbf59289f5b07
Git Branch: master
UTC Build Time: 2022-02-28 13:37:46
GoVersion: go1.16.3
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/minor sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant