View previous topic :: View next topic |
Author |
Message |
nadh Intermediate
Joined: 08 Oct 2004 Posts: 192 Topics: 89
|
Posted: Thu Feb 10, 2005 9:47 am Post subject: query problem |
|
|
Code: |
SELECT PTY_ID
,ACCT_CO_CD
,CHK_DIG
,PTY_SUR
FROM DB2.TA02513A
WHERE PTY_ID >=:W-VAL1-SSA1-DB75B
AND PTY_ID < :W-VAL2-SSA1-DB75B
ORDER BY SUBSTR(PTY_ID,11,2)
OPTIMIZE FOR 16 ROWS
|
for this i got a coment from dba as
About, the TA02513A-CURP2, the usage of OPTIMIZE for 16 Rows is in conflict with the sort !!
I did not understand what he is asking... cant we use optimize and sort in one query?
pls. any one help me out.
thanks in advance.
nadh |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
SureshKumar Intermediate
Joined: 23 Jan 2003 Posts: 211 Topics: 21
|
Posted: Thu Feb 10, 2005 11:19 am Post subject: |
|
|
Nadh,
ORDER BY will invariably retrieve the entire result and sort it by the criteria. Optimize will be of no significant help here. If its expensive, work on the business requirements, using Index sort or verify if you would need a clustering index..etc. |
|
Back to top |
|
 |
|
|