473,473 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

performance implications of calling PREPARE more than once


Hi there,

I'm thinking of using a PREPARE statement inside a stored
procedure, but
am wondering about the performance penalty associated with calling
PREPARE
multiple times. Below is an example of the kind of statements I
was thinking
of using.

...
SET S1 = 'UPDATE MFDP SET reliab=?';
PREPARE PS1 FROM S1;
EXECUTE S1 USING newreliab;
...

Is it true that if PREPARE is called multiple times with the same
statement,
the statement is only compiled once? Does that mean that the
performance
penalty for calling it multiple times would be low (compared with
compiling
it multiple times)?

Thanks for any help,

Bill

Sep 21 '07 #1
2 1735
wi********************@gmail.com wrote:
Hi there,

I'm thinking of using a PREPARE statement inside a stored
procedure, but
am wondering about the performance penalty associated with calling
PREPARE
multiple times. Below is an example of the kind of statements I
was thinking
of using.

...
SET S1 = 'UPDATE MFDP SET reliab=?';
PREPARE PS1 FROM S1;
EXECUTE S1 USING newreliab;
...

Is it true that if PREPARE is called multiple times with the same
statement,
the statement is only compiled once? Does that mean that the
performance
penalty for calling it multiple times would be low (compared with
compiling
it multiple times)?
Depends on your definition of low.
The subsequent PREPAREs will discover that a statement with the same
text and environment (CURRENT SCHEMA, etc..) already exists and reuse
it's compiled plan.
However that discovery, while a fraction of the cost of compilation,
isn't free.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Sep 21 '07 #2


Serge,

Thanks for the info.

Bill
>
Depends on your definition of low.
The subsequent PREPAREs will discover that a statement with the same
text and environment (CURRENT SCHEMA, etc..) already exists and reuse
it's compiled plan.
However that discovery, while a fraction of the cost of compilation,
isn't free.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

Sep 22 '07 #3

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

Similar topics

25
by: Brian Patterson | last post by:
I have noticed in the book of words that hasattr works by calling getattr and raising an exception if no such attribute exists. If I need the value in any case, am I better off using getattr...
10
by: Woody | last post by:
I have a page that is linked into by other pages that pass it query strings, it then reads a config file, displays 1 of several forms, gets posted to itself, depending upon users response may...
0
by: agherring | last post by:
Hi, We've just started evaluating the Data Direct ODBC Oracle driver and comparing performance with Oracle's own driver in a development project we're undertaking. We have struck a problem -...
8
by: leo | last post by:
Hello all - I was wondering about the performance implications of explicitly raising exceptions to get information about the current frame. Something like what the inspect module does, with: ...
7
by: Dima | last post by:
Call to XmlNode.GetElementsByTagName returns XmlNodeList that stays in sync with XmlDocument thanks to events fired by XmlDocument. Once this list is created there is no way to remove its event...
0
by: Mark | last post by:
We're using delegation in our ASP.NET application to connect to a SQL Server that is on the same hub as our IIS 6 web server. What are the performance implications of using Delegation rather than...
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...
2
by: Shawn B. | last post by:
Greetings, Lets say I have this class written in standard C++. I want to expose it to C# programs. So lets say I create a ref class to "wrap" around the standard C++ class. What are the...
13
by: atlaste | last post by:
Hi, I'm currently developing an application that uses a lot of computational power, disk access and memory caching (to be more exact: an information retrieval platform). In these kind of...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.