MySQL Forums
Forum List  »  Optimizer & Parser

Re: How could this SQL be optimized?
Posted by: Øystein Grøvlen
Date: May 30, 2014 02:41AM

Hi,

I do not think these statements are equivalent. Are you optimizing for speed or statement complexity? If the former, and assuming that ORDERID values are unique, I suggest the following:

SELECT ID,WAYBILL_NO,EXP_TYPE,PKG_QTY,EXPRESS_CONTENT_CODE,EFFECTIVE_TYPE_CODE
FROM T_EXP_OP
WHERE AUX_OP_CODE NOT IN ('NEW','UPDATE','DELETE') OR NOT ((OP_CODE IN (176, 162, 171, 131, 136) AND EXP_TYPE IN ('10', '20', '30')) OR (OP_CODE IN (191, 121) AND EXP_TYPE IN ('10', '20')) OR (OP_CODE IN (181, 111)AND EXP_TYPE = '10'));

Øystein Grøvlen,
Senior Principal Software Engineer,
MySQL Group, Oracle,
Trondheim, Norway

Options: ReplyQuote


Subject
Views
Written By
Posted
2454
May 29, 2014 11:26PM
Re: How could this SQL be optimized?
1249
May 30, 2014 02:41AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.