Even if your statement uses Statements instead of PreparedStatements, can reuse the statement
execution plan for the statements from the statement cache. Statements from
any connection can share the same statement execution plan, avoiding compilation,
by using the single-statement cache. The statement cache maintains statement
plans across connections. It does not, however, maintain them across reboots.
(See .) When, in the
same database, an application submits an SQL Statement that exactly
matches one already in the cache, grabs
the statement from the cache, even if the Statement has already been
closed by the application.
To match exactly with a statement already
in the cache, the SQL Statement must meet the following requirements:
- The text must match exactly
- The current schema must match
- The unicode flag that the statement was compiled under must match the
current connection's flag