Home » RDBMS Server » Performance Tuning » Need help to Optimize this query
icon5.gif  Need help to Optimize this query [message #335241] Mon, 21 July 2008 10:19 Go to next message
srajan
Messages: 1
Registered: July 2008
Junior Member
SELECT DISC.NAME,DLINES2.ENTITY_ID,DLINES2.ENTITY_VALUE
FROM
SO_DISCOUNT_LINES DLINES,SO_DISCOUNT_LINES DLINES2,SO_DISCOUNTS DISC,
SO_DISCOUNT_CUSTOMERS DCUST WHERE DISC.DISCOUNT_ID != :b1 AND
DISC.PRICE_LIST_ID = :b2 AND DCUST.DISCOUNT_ID = DISC.DISCOUNT_ID AND
DCUST.CUSTOMER_ID = :b3 AND NVL(:b4,1) = NVL(DCUST.SITE_USE_ID,1) AND
DLINES2.DISCOUNT_ID (+) = DISC.DISCOUNT_ID AND DLINES.DISCOUNT_ID = :b5
AND NVL(DLINES2.ENTITY_ID,-1) = NVL(DLINES.ENTITY_ID,-1) AND
NVL(DLINES2.ENTITY_VALUE,'') = NVL(DLINES.ENTITY_VALUE,'') AND
LEAST(NVL(:b6,TO_DATE('31-12-2900','DD-MM-YYYY')),NVL(:b7,
TO_DATE('31-12-2900','DD-MM-YYYY')),NVL(DLINES.END_DATE_ACTIVE,
TO_DATE('31-12-2900','DD-MM-YYYY'))) >= GREATEST(NVL(DISC.START_DATE_ACTIVE,
SYSDATE),NVL(DCUST.START_DATE_ACTIVE,SYSDATE),NVL(DLINES2.START_DATE_ACTIVE,
SYSDATE)) AND GREATEST(NVL(:b8,SYSDATE),NVL(:b9,SYSDATE),
NVL(DLINES.START_DATE_ACTIVE,SYSDATE)) <= LEAST(NVL(DISC.END_DATE_ACTIVE,
TO_DATE('31-12-2900','DD-MM-YYYY')),NVL(DCUST.END_DATE_ACTIVE,
TO_DATE('31-12-2900','DD-MM-YYYY')),NVL(DLINES2.END_DATE_ACTIVE,
TO_DATE('31-12-2900','DD-MM-YYYY'))) AND ROWNUM < 2
Re: Need help to Optimize this query [message #335243 is a reply to message #335241] Mon, 21 July 2008 10:22 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & follow posting guidelines as stated in URL above
Re: Need help to Optimize this query [message #335492 is a reply to message #335243] Tue, 22 July 2008 05:49 Go to previous message
rajatratewal
Messages: 507
Registered: March 2008
Location: INDIA
Senior Member
Please post the explain plan.

And format the post please.

Regards,
Rajat
Previous Topic: How to enable Bitmap Index
Next Topic: How many times Queries/DML statement run over a week.
Goto Forum:
  


Current Time: Fri Dec 09 07:49:25 CST 2016

Total time taken to generate the page: 0.12278 seconds