472,350 Members | 1,684 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,350 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 6857
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...
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...
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...
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...
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...
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...
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...
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...
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...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

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.