[plan cache] cannot use point get plan when plan cache enabled #16820
Labels
epic/plan-cache
sig/planner
SIG: Planner
type/enhancement
The issue or PR belongs to an enhancement.
Performance Improvement
1. Reproduce Steps
step 1: start a tidb-server with mocktikv and plan cache enabled
step 2: run the following statements in a connection:
The last statements is using plan cache, you can confirm that by executing
select @@last_plan_from_cache
.2. What did you see instead?
The plan of the statements is:
The plan is not a
Point_Get
plan is because of the comparison between bigint and string values results in casting bigint value to string, which can be confirmed by the operator info ofSelection_53
:eq(cast(test.t2.a), 1)
.But if we executing the following SQL, the query can benefit from point get:
From the user's angle, this query and the prepared query should have the same behavior: trying to convert string to int and utilize the
Point_Get
plan.This further cause the above prepared query executes faster when the plan cache is disabled, because it can utilize the
Point_Get
plan.3. 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: