We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Please answer these questions before submitting your issue. Thanks!
CREATE TABLE `bmsql_item` ( `i_id` int(11) NOT NULL, `i_name` varchar(24) DEFAULT NULL, `i_price` decimal(5,2) DEFAULT NULL, `i_data` varchar(50) DEFAULT NULL, `i_im_id` int(11) DEFAULT NULL, PRIMARY KEY (`i_id`) )
enable prepare plan cache, then execute a prepared statement in the following steps:
TiDB(root@127.0.0.1:test) > prepare stmt from 'select i_id, i_price, i_name, i_data from bmsql_item where i_id in (?, ?)'; Query OK, 0 rows affected (0.00 sec)
execute it in the first time:
TiDB(root@127.0.0.1:test) > set @a = "123", @b = "456"; Query OK, 0 rows affected (0.00 sec) TiDB(root@127.0.0.1:test) > execute stmt using @a, @b; Empty set (0.00 sec) TiDB(root@127.0.0.1:test) > explain for connection 1; +-------------------------+-------+------+-----------------------------------------+ | id | count | task | operator info | +-------------------------+-------+------+-----------------------------------------+ | _0 | N/A | root | N/A | | └─Batch_Point_Get_1 | 2.00 | root | table:bmsql_item, handles: %#v[123 456] | +-------------------------+-------+------+-----------------------------------------+ 2 rows in set (0.00 sec)
execute it in the second time:
TiDB(root@127.0.0.1:test) > set @a = "123", @b = "45612"; Query OK, 0 rows affected (0.00 sec) TiDB(root@127.0.0.1:test) > execute stmt using @a, @b; Empty set (0.00 sec) TiDB(root@127.0.0.1:test) > explain for connection 1; +-------------------------+-------+------+-----------------------------------------+ | id | count | task | operator info | +-------------------------+-------+------+-----------------------------------------+ | _0 | N/A | root | N/A | | └─Batch_Point_Get_1 | 2.00 | root | table:bmsql_item, handles: %#v[123 456] | +-------------------------+-------+------+-----------------------------------------+ 2 rows in set (0.00 sec)
handles should be reset
got incorrect plan
tidb-server -V
select tidb_version();
TiDB(root@127.0.0.1:test) > select tidb_version()\G *************************** 1. row *************************** tidb_version(): Release Version: v4.0.0-beta-51-gc46044f02-dirty Git Commit Hash: c46044f02651fa18b0d4654c22ae69e715a5fdd0 Git Branch: master UTC Build Time: 2020-02-19 12:19:34 GoVersion: go1.13.5 Race Enabled: false TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306 Check Table Before Drop: false 1 row in set (0.00 sec)
The text was updated successfully, but these errors were encountered:
Simplified reproduction:
mysql> create table t(a int primary key, b int); Query OK, 0 rows affected (0.01 sec) mysql> insert into t values(1,1),(2,2),(3,3),(4,4); Query OK, 4 rows affected (0.00 sec) Records: 4 Duplicates: 0 Warnings: 0 mysql> explain select * from t where a in (1,2); +-------------------+-------+------+---------------+ | id | count | task | operator info | +-------------------+-------+------+---------------+ | Batch_Point_Get_1 | 2.00 | root | table:t | +-------------------+-------+------+---------------+ 1 row in set (0.00 sec) mysql> prepare stmt from "select * from t where a in (?,?)"; Query OK, 0 rows affected (0.00 sec) mysql> set @p1 = 1, @p2 = 2; Query OK, 0 rows affected (0.00 sec) mysql> execute stmt using @p1, @p2; +---+------+ | a | b | +---+------+ | 1 | 1 | | 2 | 2 | +---+------+ 2 rows in set (0.01 sec) mysql> set @p1 = 3, @p2 = 4; Query OK, 0 rows affected (0.00 sec) mysql> execute stmt using @p1, @p2; +---+------+ | a | b | +---+------+ | 3 | 3 | | 2 | 2 | +---+------+ 2 rows in set (0.00 sec)
Sorry, something went wrong.
_0
eurekaka
Successfully merging a pull request may close this issue.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. What did you do?
enable prepare plan cache, then execute a prepared statement in the following steps:
execute it in the first time:
execute it in the second time:
2. What did you expect to see?
handles should be reset
3. What did you see instead?
got incorrect plan
4. What version of TiDB are you using (
tidb-server -V
or runselect tidb_version();
on TiDB)?The text was updated successfully, but these errors were encountered: