Hello:
I have some question on DB2 SQL Statement Cache. In the Oracle world,
we allways use bind variables extensively, otherwise, Oracle does not
re-use the statement cache, and there by resulting in excessive parsing
of the SQL Statements.
In DB2, I have a situation where I have statements with different cast
lengths:
For example, here are my statements:
select * from foo where col1 = cast(:q01 as varchar(40))
and then later execute the same statement with a different casted
varchar length:
select * from foo where col1 = cast(:q01 as varchar(100))
Will the SQL statement be reused from DB2 SQL statement cache?
Does the SQL statement have to exactly match in order for the SQL
statement to be re-used?
I woud like to know the rules of the game in DB2.
Your feedback is appreciated.
Thanks
Sarvesh
Serge Rielau - 28 Jun 2006 17:41 GMT
> Hello:
>
[quoted text clipped - 21 lines]
>
> I woud like to know the rules of the game in DB2.
One of the criteria for a cache hit is an EXACT match of the SQL
Statement as typed.
Why do you have the different lengths for the VARCHAR? Just use the
bigger ....
Cheers
Serge

Signature
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
IOD Conference
http://www.ibm.com/software/data/ondemandbusiness/conf2006/
SR - 28 Jun 2006 20:39 GMT
Your response helped.
Thank you very Serge!
> > Hello:
> >
[quoted text clipped - 35 lines]
> IOD Conference
> http://www.ibm.com/software/data/ondemandbusiness/conf2006/