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

Prepared plan cache doesn't work #26873

Closed
xuyifangreeneyes opened this issue Aug 4, 2021 · 10 comments · Fixed by #28478
Closed

Prepared plan cache doesn't work #26873

xuyifangreeneyes opened this issue Aug 4, 2021 · 10 comments · Fixed by #28478
Assignees
Labels
epic/plan-cache severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@xuyifangreeneyes
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Enable prepared-plan-cache.

use test
drop table if exists t;
create table t(a int primary key, b int, c int);
prepare stmt from 'select * from t where a = 2 or a = ?';
set @p = 3;
execute stmt using @p;
select @@last_plan_from_cache;
execute stmt using @p;
select @@last_plan_from_cache;

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

mysql> execute stmt using @p;
Empty set (0.00 sec)

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

mysql> execute stmt using @p;
Empty set (0.00 sec)

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

3. What did you see instead (Required)

mysql> execute stmt using @p;
Empty set (0.00 sec)

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

mysql> execute stmt using @p;
Empty set (0.00 sec)

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

4. What is your TiDB version? (Required)

mysql> SELECT tidb_version();
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                                            |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v5.2.0-alpha-479-gdd5546dfd
Edition: Community
Git Commit Hash: dd5546dfd0ad8376b3c7188da7c19d8c3b1818ab
Git Branch: master
UTC Build Time: 2021-08-03 11:38:57
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
@xuyifangreeneyes xuyifangreeneyes added the type/bug The issue is confirmed as a bug. label Aug 4, 2021
@xuyifangreeneyes
Copy link
Contributor Author

/sig planner

@ti-chi-bot ti-chi-bot added the sig/planner SIG: Planner label Aug 4, 2021
@Reminiscent
Copy link
Contributor

/assign

@Reminiscent
Copy link
Contributor

/close

@ti-chi-bot
Copy link
Member

@Reminiscent: Closing this issue.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

@Reminiscent
Copy link
Contributor

/reopen

@ti-chi-bot ti-chi-bot reopened this Aug 31, 2021
@ti-chi-bot
Copy link
Member

@Reminiscent: Reopened this issue.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@Reminiscent
Copy link
Contributor

Related to #23238

@qw4990
Copy link
Contributor

qw4990 commented Oct 8, 2021

This issue can be fixed by #28478.

@github-actions
Copy link

github-actions bot commented Oct 9, 2021

Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic/plan-cache severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
6 participants