Subject | Statement Cache [was: User name SYSDBA] |
---|---|
Author | Jim Starkey |
Post date | 2005-08-29T19:20:49Z |
Nando Dessena wrote:
statement matching the SQL string (one can quibble, but exact match is
good enough). If it finds a statement, it checks the privileges
required for each table referenced in the statement. If not, it
compiles the statement and (optionally) adds it to the cache. It then
creates a statement instance for the compiled request. The client can't
tell whether a prepare actually compiled something or just got a
secondary instance to a previously compiled request.
In Vulcan, a compiled statement is represented by a CStatement object, a
statement instance by a DStatement object.
There is never any need to invalidate compiled statements. If a table
is the target of a significant metadata change, any compiled statements
referencing that table are quietly removed from the statement cache and
have their reference count decremented. When the last instance goes
away, it takes the compiled statement with it.
In Netfrastructure I don't bother to cache statements without input
parameters, which automatically kicks out DDL requests.
--
Jim Starkey
Netfrastructure, Inc.
978 526-1376
>please clarify the difference between compiling and preparing.The prepare call first checks the statement cache for a compiled
>Is a cached compiled statement re-prepared at each reuse?
>
>
statement matching the SQL string (one can quibble, but exact match is
good enough). If it finds a statement, it checks the privileges
required for each table referenced in the statement. If not, it
compiles the statement and (optionally) adds it to the cache. It then
creates a statement instance for the compiled request. The client can't
tell whether a prepare actually compiled something or just got a
secondary instance to a previously compiled request.
In Vulcan, a compiled statement is represented by a CStatement object, a
statement instance by a DStatement object.
There is never any need to invalidate compiled statements. If a table
is the target of a significant metadata change, any compiled statements
referencing that table are quietly removed from the statement cache and
have their reference count decremented. When the last instance goes
away, it takes the compiled statement with it.
In Netfrastructure I don't bother to cache statements without input
parameters, which automatically kicks out DDL requests.
--
Jim Starkey
Netfrastructure, Inc.
978 526-1376