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: plan cache supports Batch/PointGet converted from (primary keys) in ((...), ...) #44830

Closed
qw4990 opened this issue Jun 20, 2023 · 1 comment · Fixed by #44838
Closed

Comments

@qw4990
Copy link
Contributor

qw4990 commented Jun 20, 2023

Enhancement

See the case below, it should hit the plan cache:

mysql> create table t (a int, primary key(a));
Query OK, 0 rows affected (0.01 sec)

mysql> prepare st from 'select * from t where 1=1 and a in (?, ?)';
Query OK, 0 rows affected (0.00 sec)

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

mysql> execute st using @a, @b;
Empty set, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+----------------------------------------------------------------------+
| Level   | Code | Message                                                              |
+---------+------+----------------------------------------------------------------------+
| Warning | 1105 | skip prepared plan-cache: Batch/PointGet plans may be over-optimized |
+---------+------+----------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> execute st using @a, @b;
Empty set, 1 warning (0.00 sec)

mysql> select @@last_plan_from_cache;
+------------------------+
| @@last_plan_from_cache |
+------------------------+
|                      0 |
+------------------------+
1 row in set (0.00 sec)
@qw4990
Copy link
Contributor Author

qw4990 commented Jun 20, 2023

Use set @@tidb_opt_fix_control = "44830:ON" to solve this.

ti-chi-bot bot pushed a commit that referenced this issue Jun 25, 2023
ti-chi-bot bot pushed a commit that referenced this issue Sep 22, 2023
ti-chi-bot bot pushed a commit that referenced this issue Dec 12, 2023
ti-chi-bot bot pushed a commit that referenced this issue Dec 22, 2023
ti-chi-bot bot pushed a commit that referenced this issue Dec 26, 2023
ti-chi-bot bot pushed a commit that referenced this issue Dec 27, 2023
qw4990 added a commit to qw4990/tidb that referenced this issue Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant