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: query cannot hit the plan cache and has no un-cacheable reason #46159

Closed
qw4990 opened this issue Aug 16, 2023 · 1 comment · Fixed by #46278
Closed

planner: query cannot hit the plan cache and has no un-cacheable reason #46159

qw4990 opened this issue Aug 16, 2023 · 1 comment · Fixed by #46278
Assignees
Labels
affects-6.5 affects-7.1 epic/plan-cache sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.

Comments

@qw4990
Copy link
Contributor

qw4990 commented Aug 16, 2023

Enhancement

mysql> create table t (a varchar(10), key(a(5)));
Query OK, 0 rows affected (0.02 sec)

mysql> prepare st from 'select a from t use index(a) where a=?';
Query OK, 0 rows affected (0.00 sec)

mysql> set @a='a';
Query OK, 0 rows affected (0.00 sec)

mysql> execute st using @a;
Empty set (0.01 sec)

mysql> execute st using @a;
Empty set (0.00 sec)

mysql> select @@last_plan_from_cache;
+------------------------+
| @@last_plan_from_cache |
+------------------------+
|                      0 |
+------------------------+
1 row in set (0.01 sec)

mysql> show warnings;
Empty set (0.00 sec)

show warnings should output the reason why this query cannot hit the cache.

@qw4990 qw4990 added type/enhancement The issue or PR belongs to an enhancement. sig/planner SIG: Planner epic/plan-cache labels Aug 16, 2023
@qw4990 qw4990 self-assigned this Aug 16, 2023
@qw4990
Copy link
Contributor Author

qw4990 commented Aug 16, 2023

If the plan rebuilding fails, its error is ignored, we'd better output this error through warning:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.5 affects-7.1 epic/plan-cache 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