473,327 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

DB2 Statement Cache

SR
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

Jun 28 '06 #1
2 3687
SR wrote:
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.

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
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Jun 28 '06 #2
SR
Your response helped.

Thank you very Serge!
Serge Rielau wrote:
SR wrote:
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.

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
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/


Jun 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: JJ | last post by:
Hi, I have written a web app in asp3 which is used by lots of users. The data is all held server side. However, I want it so that the users can export the data in a csv file, much like you can...
3
by: Klemens | last post by:
The same dynamic sql statement at the same database needs from one application seconds and from another milliseconds. Isolation level and optimization level are the same. What else could be...
6
by: Hardy | last post by:
One of my customers have a sql statement totaled more than 400 lines, about 40KB. when excuted, error arrised saying "SQL0101N The statement is too long or too complex". I tried one of his...
19
by: Arjen | last post by:
Hi, Inside my method I'm using the using-statement for data access. Before that, I create an object of a class. This works fine. Inside the using-statement I set properties of the class (with...
1
by: martin | last post by:
Hi, I have a page that contain a dropdown list of values. This drop down list rarely changes so I wish to cache the page. However the values in the dropdown box are taken from a database, so if...
1
by: anoop | last post by:
Hello, I am working on ASP .Net 2.0. I created a .aspx file named as enter_department_info.aspx and its code behind file as enter_department_info.aspx.vb which is written as codefile in asp.net...
2
by: Rajat Katyal | last post by:
Hi: I prepare the statement for execution as follows: PREPARE query(text) as SELECT count(*) FROM transform_customer_billing where inv_no = $1; The problem is Iam not able to execute this...
3
by: aj | last post by:
DB2 LUW 8.1 fixpak 14 Red Hat EL AS 4.4 I'm trying to diagnose some nocturnal CPU pressure, and am trying to understand the dynamic statement cache as it applies to LUW. The only doc/redbooks...
1
by: Massimiliano Campagnoli | last post by:
Hy, I am trying to understand how the prepare statement works. I am using Qt C++ library to access db2: { .... QSqlQuery cust_query; cust_query.prepare("SELECT CUST_NAME FROM CUSTOMERS...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.