List:General Discussion« Previous MessageNext Message »
From:Benaya Paul Date:November 16 2012 8:47am
Subject:Re: Query Optimization
View as plain text  
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
<sb_akarmarkar@stripped>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

Thread
Query OptimizationAnupam Karmarkar16 Nov
  • Re: Query OptimizationBenaya Paul16 Nov
  • RE: Query OptimizationRick James16 Nov