List:General Discussion« Previous MessageNext Message »
From:Claudio Nanni Date:March 29 2009 2:19pm
Subject:Re: IN vs. OR on performance
View as plain text  
An explain of the two statements yields the same plan,
anybody knows if they are actually translated in the same plan?

Ian P. Christian wrote:
> 2009/3/29 Oscar <ro4tub@stripped>:
>> Hi all-
>> I want to know what the difference between IN and OR is under the hood.
>> select * from dummy_table where id in (2, 3, 4, 5, 6, 7);
>> select * from dummy_table where id=2 or id=3 or id=4 or id=5 or id=6 or
>> id=7;
> I've have thought once the query is compiled, they are the same. What
> might cause a difference in performance is doing  id > 2 and id <= 7.
> Test it on a large dataset and let us know :)

IN vs. OR on performanceOscar29 Mar
  • Re: IN vs. OR on performanceIan P. Christian29 Mar
    • RE: IN vs. OR on performanceMartin Gainty29 Mar
    • Re: IN vs. OR on performanceClaudio Nanni29 Mar
      • Re: IN vs. OR on performanceBaron Schwartz31 Mar