Ron: if you're only requesting a single row response (Fetch Only), why are you using >= for VENDOR_NBR or VENDOR_DEPT_NBR. If anything they should be strictly equal. It would greatly reduce the number of index rows retrieved.
--------> signature = 6 lines follows <-------- Neil Duffee, Joe Sysprog, uOttawa, Ottawa, Ont, Canada telephone:1 613 562 5800 x4585 fax:1 613 562 5161 mailto:NDuffee of uOttawa.ca http:/ /aix1.uOttawa.ca/ ~nduffee “How *do* you plan for something like that?” Guardian Bob, Reboot “For every action, there is an equal and opposite criticism.” “Systems Programming: Guilty, until proven innocent” John Norgauer 2004 -----Original Message----- From: Ron Thomas [mailto:[email protected]] Sent: June 13, 2014 13:50 Subject: SQL Query Here is the query we used in one of the online programs, looks like the performance is not good. any alternate way to handle this ? SELECT ENDOR_NBR, ENDOR_DPT_NBR, ENDOR_SQ_NBR, P2TEM_NBR FROM ITEM WHERE VENDOR_NBR >= 898900 AND VENDOR_DEPT_NBR >= 10 AND VENDOR_SEQ_NBR >= 1 AND ITEM_NBR > 0 ORDER BY ENDOR_NBR, ENDOR_DPT_NBR, ENDOR_SQ_NBR, P2TEM_NBR ASC FETCH FIRST 1 ROW ONLY ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
