Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / June 2006

Tip: Looking for answers? Try searching our database.

DB2 Statement Cache

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SR - 28 Jun 2006 17:14 GMT
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/
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.