View previous topic :: View next topic
|
Author |
Message |
aruna_mtech
New User
Joined: 29 May 2005 Posts: 1 Location: Mysore
|
|
|
|
Hi,
following query is taking more CPU and Run time(more than 12hours for 65,0000 input records),do u have any sugeestions how to fine tune this DB2 query.
DECLARE EMP1 CURSOR WITH HOLD FOR
SELECT A.EMP1_LN_ID,
B.EMP2_LN_ID
FROM EMP1 A,
EMP2 B,
EMP3 C
WHERE A.STRT_LN_LOC_C = :POE
A.END_LN_LOC_C = :POI
A.EMP1_LN_ID = B.EMP1_LN_ID
B.EMP2_LN_ID = C.EMP2_LN_ID
C.DEPTR_D > :WS-CURR-DATE
A.SCAC_C = :CODE
WITH UR
FOR FETCH ONLY
pls let me know ur suggestins for fine tuning this query. |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
what are the predicates you are using in the where clause 'OR' / 'AND' ?
provide more detials like the keys, indexes etc .. and if u r using the cursor for only fetch y the with hold ? wht are you using this cursor for ? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Why the HOLD?
because even a FETCH only cursor should be COMMITted occaisionally to release resources.
by the way, I would remove table EMP2. you don"t need it. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If the query execution caused multiple cartesian products (say 25k * 20k * 20k rows = 65k total input), the number of rows processed could be
10,000,000,000,000. . . .
I suspect that would take some time. . . |
|
Back to top |
|
|
|