pingcap / pingcap/tidb

Ignore the comment in the sql statement for plan cache

Open
#38,490 0 comments 0 reactions 0 assignees View on GitHub
epic/plan-cache sig/planner type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement
If there are some comments in the sql statement, it can not use the exist plan cache.
```
mysql> prepare stmt from 'select * from t';
Query OK, 0 rows affected (0.01 sec)

mysql> execute stmt;
Empty set (0.01 sec)

mysql> execute stmt;
Empty set (0.00 sec)

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

mysql> prepare stmt1 from '/* add a comment */ select * from t';
Query OK, 0 rows affected (0.00 sec)

mysql> execute stmt1;
Empty set (0.00 sec)

mysql> select @@last_plan_from_cache;
+------------------------+
| @@last_plan_from_cache |
+------------------------+
| 0 |
+------------------------+
1 row in set (0.00 sec)
```
The final one should use the plan cache.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.