ignore stmtClose to make sure smtPrepare can hit plan cache #31056
Labels
epic/plan-cache
sig/planner
SIG: Planner
type/enhancement
The issue or PR belongs to an enhancement.
Enhancement
It's not uncommon that real-world application will follow the stmtPrepare -> stmtExec -> stmtClose loop.
In TiDB, the stmtClose will evict the cached plan, and the following stmtPrepare need to recompile the plan, make the plan cache useless.
In Oracle, stmtClose only close the session local handle. The cached plan still exists the in the global cache shared pool, the following prepare call can still re-use the cached plan.
I propose adding a global variable, to ignore the stmtClose calls, so that the cached plan can be re-used.
The text was updated successfully, but these errors were encountered: