dbTalk Databases Forums  

Arrays vs Declared Global Temp Tables for Stored Procs in DB2 9.5

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss Arrays vs Declared Global Temp Tables for Stored Procs in DB2 9.5 in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Martin
 
Posts: n/a

Default Arrays vs Declared Global Temp Tables for Stored Procs in DB2 9.5 - 07-13-2010 , 11:45 PM






I am using DB2 9.5.5 and cannot migrate to 9.7 anytime soon, so I cannot use
Created Global Temporary Tables (CGTT).

I am wondering how Arrays are implemented for stored procedures and what the
performance is compared to declared global temporary tables (DGTT). In order
to improve performance, I want to use arrays instead of a DGTT, but I want
to make sure that Arrays are not creating a DGTT under the covers.

Assume that Arrays provides me with the functionality I need.

Reply With Quote
  #2  
Old   
Serge Rielau
 
Posts: n/a

Default Re: Arrays vs Declared Global Temp Tables for Stored Procs in DB29.5 - 07-14-2010 , 11:14 AM






On 7/14/2010 12:45 AM, Martin wrote:
Quote:
I am using DB2 9.5.5 and cannot migrate to 9.7 anytime soon, so I cannot use
Created Global Temporary Tables (CGTT).

I am wondering how Arrays are implemented for stored procedures and what the
performance is compared to declared global temporary tables (DGTT). In order
to improve performance, I want to use arrays instead of a DGTT, but I want
to make sure that Arrays are not creating a DGTT under the covers.

Assume that Arrays provides me with the functionality I need.
I'm actually preparing a talk on the topic.

For now: ARRAYs are a continuous piece of memory allocated on the
application heap. At lot less overhead than all the table infrastructure.
On the flip side if you have some open-ended and huge arrays paired with
many concurrent users... well you do the math.
Of course the API for ARRAY (SET, ARRAY_AGG, UNNEST) is fundamentally
different from DGTT (UPDATE, DELETE, INSERT, DECLARE cursor)

Cheers
Serge

PS: If you do a nested loop between two arrays that's what you get. No
optimizer is going to rewrite your join...

--
Serge Rielau
SQL Architect DB2 for LUW
IBM Toronto Lab

Reply With Quote
  #3  
Old   
Arun Srini
 
Posts: n/a

Default Re: Arrays vs Declared Global Temp Tables for Stored Procs in DB2 9.5 - 07-15-2010 , 08:03 AM



On Jul 14, 9:14*pm, Serge Rielau <srie... (AT) ca (DOT) ibm.com> wrote:
Quote:
On 7/14/2010 12:45 AM, Martin wrote:> I am using DB2 9.5.5 and cannot migrate to 9.7 anytime soon, so I cannot use
Created Global Temporary Tables (CGTT).

I am wondering how Arrays are implemented for stored procedures and what the
performance is compared to declared global temporary tables (DGTT). In order
to improve performance, I want to use arrays instead of a DGTT, but I want
to make sure that Arrays are not creating a DGTT under the covers.

Assume that Arrays provides me with the functionality I need.

I'm actually preparing a talk on the topic.

For now: ARRAYs are a continuous piece of memory allocated on the
application heap. At lot less overhead than all the table infrastructure.
On the flip side if you have some open-ended and huge arrays paired with
many concurrent users... well you do the math.
Of course the API for ARRAY (SET, ARRAY_AGG, UNNEST) is fundamentally
different from DGTT (UPDATE, DELETE, INSERT, DECLARE cursor)

Cheers
Serge

PS: If you do a nested loop between two arrays that's what you get. No
optimizer is going to rewrite your join...

--
Serge Rielau
SQL Architect DB2 for LUW
IBM Toronto Lab
Can you please share the presentation after your talk or in ur blog
maybe?

Reply With Quote
  #4  
Old   
Serge Rielau
 
Posts: n/a

Default Re: Arrays vs Declared Global Temp Tables for Stored Procs in DB29.5 - 07-15-2010 , 08:14 AM



On 7/15/2010 9:03 AM, Arun Srini wrote:
Quote:
On Jul 14, 9:14 pm, Serge Rielau<srie... (AT) ca (DOT) ibm.com> wrote:
On 7/14/2010 12:45 AM, Martin wrote:> I am using DB2 9.5.5 and cannot migrate to 9.7 anytime soon, so I cannot use
Created Global Temporary Tables (CGTT).

I am wondering how Arrays are implemented for stored procedures and what the
performance is compared to declared global temporary tables (DGTT). In order
to improve performance, I want to use arrays instead of a DGTT, but I want
to make sure that Arrays are not creating a DGTT under the covers.

Assume that Arrays provides me with the functionality I need.

I'm actually preparing a talk on the topic.

For now: ARRAYs are a continuous piece of memory allocated on the
application heap. At lot less overhead than all the table infrastructure.
On the flip side if you have some open-ended and huge arrays paired with
many concurrent users... well you do the math.
Of course the API for ARRAY (SET, ARRAY_AGG, UNNEST) is fundamentally
different from DGTT (UPDATE, DELETE, INSERT, DECLARE cursor)

Cheers
Serge

PS: If you do a nested loop between two arrays that's what you get. No
optimizer is going to rewrite your join...

--
Serge Rielau
SQL Architect DB2 for LUW
IBM Toronto Lab

Can you please share the presentation after your talk or in ur blog
maybe?
Absolutely. After IDUG Europe and IOD Las Vegas.
I often turn them into developerworks articles.


--
Serge Rielau
SQL Architect DB2 for LUW
IBM Toronto Lab

Reply With Quote
  #5  
Old   
Martin
 
Posts: n/a

Default Re: Arrays vs Declared Global Temp Tables for Stored Procs in DB2 9.5 - 08-26-2010 , 09:46 PM



"Serge Rielau" <srielau (AT) ca (DOT) ibm.com> wrote

Quote:
For now: ARRAYs are a continuous piece of memory allocated on the
application heap. At lot less overhead than all the table infrastructure.
On the flip side if you have some open-ended and huge arrays paired with
many concurrent users... well you do the math.
Of course the API for ARRAY (SET, ARRAY_AGG, UNNEST) is fundamentally
different from DGTT (UPDATE, DELETE, INSERT, DECLARE cursor)

Cheers
Serge

PS: If you do a nested loop between two arrays that's what you get. No
optimizer is going to rewrite your join...

--
Serge Rielau
SQL Architect DB2 for LUW
IBM Toronto Lab
My developers are reporting that SP's with arrays are performing well in 9.7
(compared to GTT), but seem to run much slower in 9.5. Is this to be
expected? We are testing the exact same SP's both releases.

Reply With Quote
  #6  
Old   
Serge Rielau
 
Posts: n/a

Default Re: Arrays vs Declared Global Temp Tables for Stored Procs in DB29.5 - 09-01-2010 , 03:34 PM



On 8/26/2010 10:46 PM, Martin wrote:
Quote:
"Serge Rielau"<srielau (AT) ca (DOT) ibm.com> wrote in message
news:8a663mFn5sU1 (AT) mid (DOT) individual.net...
For now: ARRAYs are a continuous piece of memory allocated on the
application heap. At lot less overhead than all the table infrastructure.
On the flip side if you have some open-ended and huge arrays paired with
many concurrent users... well you do the math.
Of course the API for ARRAY (SET, ARRAY_AGG, UNNEST) is fundamentally
different from DGTT (UPDATE, DELETE, INSERT, DECLARE cursor)
PS: If you do a nested loop between two arrays that's what you get. No
optimizer is going to rewrite your join...
My developers are reporting that SP's with arrays are performing well in 9.7
(compared to GTT), but seem to run much slower in 9.5. Is this to be
expected? We are testing the exact same SP's both releases.
Interesting... no significant design changes were done.
We merely added row support.

--
Serge Rielau
SQL Architect DB2 for LUW
IBM Toronto Lab

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.