From: Benaya Paul Date: November 16 2012 8:47am Subject: Re: Query Optimization List-Archive: http://lists.mysql.com/mysql/228642 Message-Id: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec5540cd66ffe4104ce98d143 --bcaec5540cd66ffe4104ce98d143 Content-Type: text/plain; charset=ISO-8859-1 SELECT * FROM XYX WHERE VAL IN ('BLUE','RED','GREEN'); query will make it faster, if the field is ENUM On Fri, Nov 16, 2012 at 12:36 AM, Anupam Karmarkar wrote: > Hi All, > > Consider a scenario, I have table XYZ which contains value follow > BLUE > RED > GREEN > NULL > > following are queries we can use get this values > > 1. SELECT * FROM XYX WHERE VAL IN ('BLUE','RED','GREEN'); > 2. SELECT * FROM XYZ WHERE VAL IS NOT NULL > 3. SELECT * FROM XYZ WHERE VAL = 'BLUE' OR VAL='RED' OR VAL='GREEN' > and more > > So which one is good in terms of optimization. I guess, 1 and 3 are > similar in term of formation. > > > --Anupam > -- Thanks & Regards, P.Benaya Paul http://www.codeasearch.com http://www.iwannasearch.com --bcaec5540cd66ffe4104ce98d143--