function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
testrest97testrest97 

Which clause is better IN or OR

select id from account where name='123' or name='345' or name='456';

 

or

 

select id from account where name IN ('123','345','456');

 

Which one you all think is optimized more. Or both are same??

souvik9086souvik9086

IN will be the better option always for large no of options.

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

ryanjuptonryanjupton

There's also a great webinar that you find interesting here: http://wiki.developerforce.com/page/Webinar:_Inside_the_Force.com_Query_Optimizer_(2013-Apr)