oracle - Does the compiled prepared statement in the database driver still require compilation in the database? -
in oracle jdbc driver, there option cache prepared statements. understanding of prepared statements precompiled driver, cached, improves performance cached prepared statements.
my question is, mean database never has compile prepared statements? jdbc driver send precompiled representation, or there still kind of parsing/compilation happens in database itself?
when use implicit statement cache (or oracle extension explicit statement cache) oracle driver cache prepared- or callable statement after(!) close() re-use physical connection.
so happens is: if prepared statement used, , physical connection has never seen it, sends sql db. depending if db has seen statement before or not, hard parse or soft parse. typically if have 10 connection pool, see 10 parses, 1 of beein hard parse.
after statement closed on connection oracle driver put handle parsed statement (shared cursor) lru cache. next time use preparestatement on connection finds cached handle use , not need send sql @ all. results in execution no parse.
if have more (different) prepared statements used on physical connection cache in size longest unused open shared cursor closed. results in soft parse next time statement used again - because sql needs sent server again.
this same function data sources middleware have implemented more generically (for example prepared-statement-cache in jboss). use 1 of both avoid double caching.
you can find details here:
http://docs.oracle.com/cd/e11882_01/java.112/e16548/stmtcach.htm#g1079466
also check out oracle unified connection pool (ucp) supports , interacts fan.
Comments
Post a Comment