someone can tell me if
SELECT ... WHERE myField IN (1,2,3)
is more efficient than
SELECT ... WHERE (myField = 1) OR (myField = 2) OR (myField = 3)
thanks in advancedepends on your database, but in general, they will be exactly the same
the IN is easier to write, though, easier to read, and easier to maintain, isn't it
:)|||I guess the query will run better if there's an index on 'myfield' column; IN compared to multiple ORs doesn't improve execution at all (at least, that's what a quick example on Oracle database (its explain plan and statistics) showed).
Showing posts with label myfield. Show all posts
Showing posts with label myfield. Show all posts
Sunday, February 19, 2012
Subscribe to:
Posts (Atom)