473,503 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Performance questions DB2 UDB 8.1.9 Linux

The following query takes 3-5 seconds which seems a bit excessive:

select * from is3.pedigree2
where bhid in
( 322380, 379701, 380901, 394336, 394342, 396039, 400764)

Furthermore, when extended to the desired use, it generates a warning
message for which I can find no explanation for the reason code:

select * from is3.pedigree2
where bhid in
(select bhid from is3.ANIMAL_SETS
where set_name = '000' and USERID = 'jhoughex')

DB2 SQL error: SQLCODE: 437, SQLSTATE: 01602, SQLERRMC: 1
Performance of this complex query may be sub-optimal. Reason code: "1".

Both queries depend on the same complex view. I have used much more
complex sql without generating such a message or having such poor
running times. Any suggestions greatly appreciated. The view is below
(longish):

CREATE VIEW IS3.Pedigree2 AS
SELECT animal.BHID AS BHID,
animal.Namex AS Name,
animal.assoc AS Assoc,
animal.prefix AS Prefix,
animal.regnum AS Regnum,

Sire.Namex AS Name_Sire,
Sire.assoc AS Assoc_Sire,
Sire.prefix AS Prefix_Sire,
Sire.regnum AS Regnum_Sire,
Dam.Namex AS Name_Dam,
Dam.assoc AS Assoc_Dam,
Dam.prefix AS Prefix_Dam,
Dam.regnum AS Regnum_Dam,

Sire_Sire.Namex AS Name_Sire_Sire,
Sire_Sire.assoc AS Assoc_Sire_Sire,
Sire_Sire.prefix AS Prefix_Sire_Sire,
Sire_Sire.regnum AS Regnum_Sire_Sire,
Sire_Dam.Namex AS Name_Sire_Dam,
Sire_Dam.assoc AS Assoc_Sire_Dam,
Sire_Dam.prefix AS Prefix_Sire_Dam,
Sire_Dam.regnum AS Regnum_Sire_Dam,
Dam_Sire.Namex AS Name_Dam_Sire,
Dam_Sire.assoc AS Assoc_Dam_Sire,
Dam_Sire.prefix AS Prefix_Dam_Sire,
Dam_Sire.regnum AS Regnum_Dam_Sire,
Dam_Dam.Namex AS Name_Dam_Dam,
Dam_Dam.assoc AS Assoc_Dam_Dam,
Dam_Dam.prefix AS Prefix_Dam_Dam,
Dam_Dam.regnum AS Regnum_Dam_Dam,

Sire_Sire_Sire.Namex AS Name_Sire_Sire_Sire,
Sire_Sire_Sire.assoc AS Assoc_Sire_Sire_Sire,
Sire_Sire_Sire.prefix AS Prefix_Sire_Sire_Sire,
Sire_Sire_Sire.regnum AS Regnum_Sire_Sire_Sire,
Sire_Sire_Dam.Namex AS Name_Sire_Sire_Dam,
Sire_Sire_Dam.assoc AS Assoc_Sire_Sire_Dam,
Sire_Sire_Dam.prefix AS Prefix_Sire_Sire_Dam,
Sire_Sire_Dam.regnum AS Regnum_Sire_Sire_Dam,
Sire_Dam_Sire.Namex AS Name_Sire_Dam_Sire,
Sire_Dam_Sire.assoc AS Assoc_Sire_Dam_Sire,
Sire_Dam_Sire.prefix AS Prefix_Sire_Dam_Sire,
Sire_Dam_Sire.regnum AS Regnum_Sire_Dam_Sire,
Sire_Dam_Dam.Namex AS Name_Sire_Dam_Dam,
Sire_Dam_Dam.assoc AS Assoc_Sire_Dam_Dam,
Sire_Dam_Dam.prefix AS Prefix_Sire_Dam_Dam,
Sire_Dam_Dam.regnum AS Regnum_Sire_Dam_Dam,
Dam_Sire_Sire.Namex AS Name_Dam_Sire_Sire,
Dam_Sire_Sire.assoc AS Assoc_Dam_Sire_Sire,
Dam_Sire_Sire.prefix AS Prefix_Dam_Sire_Sire,
Dam_Sire_Sire.regnum AS Regnum_Dam_Sire_Sire,
Dam_Sire_Dam.Namex AS Name_Dam_Sire_Dam,
Dam_Sire_Dam.assoc AS Assoc_Dam_Sire_Dam,
Dam_Sire_Dam.prefix AS Prefix_Dam_Sire_Dam,
Dam_Sire_Dam.regnum AS Regnum_Dam_Sire_Dam,
Dam_Dam_Sire.Namex AS Name_Dam_Dam_Sire,
Dam_Dam_Sire.assoc AS Assoc_Dam_Dam_Sire,
Dam_Dam_Sire.prefix AS Prefix_Dam_Dam_Sire,
Dam_Dam_Sire.regnum AS Regnum_Dam_Dam_Sire,
Dam_Dam_Dam.Namex AS Name_Dam_Dam_Dam,
Dam_Dam_Dam.assoc AS Assoc_Dam_Dam_Dam,
Dam_Dam_Dam.prefix AS Prefix_Dam_Dam_Dam,
Dam_Dam_Dam.regnum AS Regnum_Dam_Dam_Dam

FROM is3.animals animal
/* Sire and Dam of the Animal */
JOIN is3.animals Sire ON animal.Sire_bhid = Sire.bhid
JOIN is3.animals Dam ON animal.Dam_bhid = Dam.bhid
/* Sire and Dam of the Sire */
JOIN is3.animals Sire_Sire ON Sire.Sire_bhid = Sire_Sire.bhid
JOIN is3.animals Sire_Dam ON Sire.Dam_bhid = Sire_Dam.bhid
/* Sire and Dam of the Dam */
JOIN is3.animals Dam_Sire ON Dam.Sire_bhid = Dam_Sire.bhid
JOIN is3.animals Dam_Dam ON Dam.Dam_bhid = Dam_Dam.bhid
/* Sire and Dam of the Sire_Sire */
JOIN is3.animals Sire_Sire_Sire ON Sire_Sire.Sire_bhid =
Sire_Sire_Sire.bhid
JOIN is3.animals Sire_Sire_Dam ON Sire_Sire.Dam_bhid =
Sire_Sire_Dam.bhid
/* Sire and Dam of the Sire_Dam */
JOIN is3.animals Sire_Dam_Sire ON Sire_Dam.Sire_bhid =
Sire_Dam_Sire.bhid
JOIN is3.animals Sire_Dam_Dam ON Sire_Dam.Dam_bhid = Sire_Dam_Dam.bhid
/* Sire and Dam of the Dam_Sire */
JOIN is3.animals Dam_Sire_Sire ON Dam_Sire.Sire_bhid =
Dam_Sire_Sire.bhid
JOIN is3.animals Dam_Sire_Dam ON Dam_Sire.Dam_bhid = Dam_Sire_Dam.bhid
/* Sire and Dam of the Dam_Dam */
JOIN is3.animals Dam_Dam_Sire ON Dam_Dam.Sire_bhid = Dam_Dam_Sire.bhid
JOIN is3.animals Dam_Dam_Dam ON Dam_Dam.Dam_bhid = Dam_Dam_Dam.bhid
Jul 12 '06 #1
2 6527
Maybe you could mention what indexes are present
on the underlying tables (animals, pedigree2, etc), and their
cardinality, and
the query-optimisation level you are using, and whether
the statistics are up to date, and what the access
plan shows?

Jul 12 '06 #2
Ian
Bob Stearns wrote:
The following query takes 3-5 seconds which seems a bit excessive:

select * from is3.pedigree2
where bhid in
( 322380, 379701, 380901, 394336, 394342, 396039, 400764)
It would be interesting to see the compilation time for this query.
You may find that it is significant.
Furthermore, when extended to the desired use, it generates a warning
message for which I can find no explanation for the reason code:

select * from is3.pedigree2
where bhid in
(select bhid from is3.ANIMAL_SETS
where set_name = '000' and USERID = 'jhoughex')

DB2 SQL error: SQLCODE: 437, SQLSTATE: 01602, SQLERRMC: 1
Performance of this complex query may be sub-optimal. Reason code: "1".

Both queries depend on the same complex view. I have used much more
complex sql without generating such a message or having such poor
running times. Any suggestions greatly appreciated. The view is below
(longish):
I don't know what you mean about "much more complex SQL" - the view is a
15 way join, and adding the subselect to the query make this effectively
a 16-way join.

The problem is that you don't have enough memory (in STMTHEAP) for the
optimizer to compute the optimal join order for the 16 tables, so the
optimizer reverts to greedy join enumeration (which uses less memory,
at a cost of not selecting the optimal plan).
Have you tried making your view recursive? Not sure if this would help.
Jul 12 '06 #3

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

Similar topics

8
3316
by: Lu | last post by:
Hi there, I got a program to write data to a randomly accessed file (the program moves file pointer to a certain position of the file according the current "keyword" and then writes data). It...
57
25466
by: Bing Wu | last post by:
Hi all, I am running a database containing large datasets: frames: 20 thousand rows, coordinates: 170 million row. The database has been implemented with: IBM DB2 v8.1
3
1463
by: jane | last post by:
HI, I have an performance questions... is # of tables in one tablespaces matter for performance point of view? why?
115
7468
by: Mark Shelor | last post by:
I've encountered a troublesome inconsistency in the C-language Perl extension I've written for CPAN (Digest::SHA). The problem involves the use of a static array within a performance-critical...
13
1832
by: Shane Wright | last post by:
Hi, I've been trying to spec a new server for my company's database for a few weeks and one of the biggest problems I've had is trying to find meaningful performance information about how...
2
2436
by: tomdean20 | last post by:
Does anyone have a general idea of the difference in performance when compiling PHP with primarily shared extensions rather than static? A recent Yahoo presentation "PHP at Yahoo" highlighted that...
1
13666
by: marcfischman | last post by:
Please help. I have a website running on a linux/apache/mysql/php server. I receive about 8,000-10,000 visitors a day with about 200,000 to 300,000 page views. The server is a RedHat Linux...
30
2249
by: GeorgeRXZ | last post by:
Hi Friends, I have some questions related to C Language. 1What is the difference between the standard C language and Non standard C language ? 2which is better C Lanugage, C under Linux/...
4
2377
by: joa2212 | last post by:
Hello everybody, I'm posting this message because I'm quiet frustrated. We just bought a software from a small software vendor. In the beginning he hosted our application on a small server at...
0
7199
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
7076
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
7453
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...
1
5005
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4670
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3162
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1507
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 ...
1
732
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
377
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.