Bug #70905 Automatic global cache for prepared statements
Submitted: 14 Nov 2013 0:42
Reporter: Sebastien Diebler Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: Prepared statements Severity:S4 (Feature request)
Version:5.x OS:Any
Assigned to: CPU Architecture:Any

[14 Nov 2013 0:42] Sebastien Diebler
Description:
Prepared statements are currently cached only at the session level. In the context of a stateless web application (think PHP web app), this makes the current system pretty much useless (even considering persistent connections as they have a fairly limited lifetime).

Such a web application should still be able to benefit from the security advantage of prepared statement without incurring the cost of having to prepare a query almost every time. The cost being at least 2 more network round-trip to prepare the statement and the tiny performance hit of caching it at the session level.

How to repeat:
This is a new feature request.

Suggested fix:
It would be very useful to have the ability to globally cache prepared statement and set a cache size limit, either by memory of number of cached prepared statement.