Results 1 to 3 of 3
  1. #1
    Join Date
    May 2006
    Location
    New York
    Posts
    15

    Unanswered: Efficiency question in 'WHERE' clause

    would it be more efficient to do

    WHERE a = 'b' OR a = 'c' OR a = 'd'

    or

    WHERE a IN ('b','c','d')?
    Spelling ALWAYS counts!

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    try it and see

    I'd guess there will be little or no difference, it wouldn't surprise me if the optimiser resolved both constructs in the same manner
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    depends

    are you referring to computer efficiency or programmer efficiency?

    if the former, it's a wash

    if the latter, the IN list is definitely favoured
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •