Both IN and OR will execute the query for b = 0 , followed by one for b = 3 , and then merge the merge on the two result sets and finally filter out any duplicates.
With IN duplicates don't really make sense, because b cannot be 0 and 3 , but the fact is that IN will be converted to b = 0 OR b = 3 , and with OR , duplicates make sense because you could would have b = 0 OR a = 3 , and if you joined two separate result sets, you could get duplicates for each record that meet all the criteria.
Thus, re-filtering will always be performed regardless of whether you use IN or OR . However, if from the very beginning you know that you will not have duplicates, which usually happens when using IN , then you can get some performance using UNION ALL , which does not filter out duplicates:
select distinct(a) from mytable where b = 0 UNION ALL select distinct(a) from mytable where b = 3
David Hedlund
source share