MYSQL OR vs IN performance
Posted
by Scott
on Stack Overflow
See other posts from Stack Overflow
or by Scott
Published on 2009-04-23T18:16:52Z
Indexed on
2010/03/20
1:11 UTC
Read the original article
Hit count: 384
I am wondering if there is any difference in regards to performance between the following
SELECT ... FROM ... WHERE someFIELD IN(1,2,3,4)
SELECT ... FROM ... WHERE someFIELD between 0 AND 5
SELECT ... FROM ... WHERE someFIELD = 1 OR someFIELD = 2 OR someFIELD = 3 ...
or will MySQL optimize the SQL in the same way compilers will optimize code ?
EDIT: Changed the AND's to OR's for the reason stated in the comments.
© Stack Overflow or respective owner