473,388 Members | 1,286 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,388 software developers and data experts.

Stored procedures using declared temporary tables: please help!

Hi, we are currently implementing an application running on DB2 V7 on
Z/OS using largely COBOL stored procedures, managed using WLM.

Some of these stored procedures declared global temporary tables, which
are declared with ON COMMIT DELETE ROWS to perform work on and then
return these temporary tables to the client (which is a message driven
EJB connecting via DB2 connect). The client reads the data in the result
sets, creates some XML to be sent back to the front end and then commits
the transaction. At this point, I would expect the temporary tables to
be destroyed and the threads to be returned to the WLM thread pool for
re-use by a subsequent request.

This doesn't appear to be the case. According to a number of articles,
the client is expected to destroy the temporary table itself, otherwise
the threads hang around. Our experience in practice is that if we do
destroy the temporary table from the EJB we get a noticable gain in
performance (twice as fast!) over a sample of 200 executions. Our guess
is that performance deteriorates since WLM dowgrades the priority of the
long-running thread when it gets re-used (could be wrong, but it's our
best guess). We do also notice that there are some threads hanging
around for hours.

This isn't a huge problem, and we can do this if we need to; however, it
doesn't sit very well. It appears to be a violation of the general
principle that it should be the same piece of code that allocates
resource that should take responsibility for destroying it. That and I
can't personally see why DB2 wouldn't just destroy the temporary table
and return the threads to the thread pool on commit (assuming you
haven't declared the table as ON COMMIT RETAIN ROWS, or used a WITH HOLD
cursor).

If any of you DB2 experts out there are able to confirm or deny the
above I would greatly appreciate it, as I would rather not take the step
to 'manually' delete the temporary tables if I can avoid it.

Many thanks, Keith.

Nov 12 '05 #1
2 6938
I can't comment on DB2 z/OS performance problems, but ON COMMIT DELETE
_ROWS_ will only delete teh rows. It will not drop the temp table.
You could try to DROP the temp after opening the cursor.
With luck (meaning I don't remember) DB2 marks the tabel as drop
pending. If no luck your cursor gets closed :-(

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2
I can't comment on DB2 z/OS performance problems, but ON COMMIT DELETE
_ROWS_ will only delete teh rows. It will not drop the temp table.
You could try to DROP the temp after opening the cursor.
With luck (meaning I don't remember) DB2 marks the tabel as drop
pending. If no luck your cursor gets closed :-(

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #3

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

Similar topics

7
by: pkruti | last post by:
Below is a stored procedure i am working with and i am trying to drop the yesno_holding table if it exists but how do i add it back? Meaning i want it to drop if it exists but i want to add it back...
0
by: Keith Watson | last post by:
Hi, we are currently implementing an application running on DB2 V7 on Z/OS using largely COBOL stored procedures, managed using WLM. Some of these stored procedures declared global temporary...
8
by: Thomasb | last post by:
With a background in MS SQL Server programming I'm used to temporary tables. Have just started to work with DB2 ver 7 on z/OS and stumbled into the concept of GLOBAL TEMPORARY TABLE. I have...
1
by: Roman Prigozhin | last post by:
Hi all, I have one stored procedure where I defined 3 temporary tables, which i return back to java. I want to have 3 separate sub procedures which would go after the data and fill out these...
2
by: Mike Hutton | last post by:
I have a rather odd problem. I have a SP which uses temp. tables along the way, and then returns a table of results: CREATE PROCEDURE dbo.usp_myproc( @pNameList VARCHAR(6000) ) AS
3
by: mandible | last post by:
I'm trying to call one stored procedure inside another. I was wondering if this is possible Some ideas I was toying with is putting the first stored procedure inside of a temp table but haven't...
3
by: comp_databases_ms-sqlserver | last post by:
This post is related to SQL server 2000 and SQL Server 2005 all editions. Many of my stored procedures create temporary tables in the code. I want to find a way to find the query plan for these...
3
by: Otto Carl Marte | last post by:
Hi, As I understand it, Declared Global Temporary Tables (DGTTs) have a scope that is session/connection based. Using the same connection, I have discovered that if I declare a DGTT in one...
1
by: birundha | last post by:
Hi Hope this will help more peolpe... We got a new design where we use Global temporary tables(GTT) inside stored procedure... My question is can we use GTT inside a stored procedure and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.