ignore stmtClose to make sure smtPrepare can hit plan cache #31056
Closed
Description
opened on Dec 27, 2021
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.
Activity