'IN' Clause or 'OR'

Hello,
[1]: select * from TABLEA where COL1 IN('value1','value2''valu3'....)
[2]:select * from TABLEA where COL1 = 'value1' OR COL1= 'value2' OR 
COL1='valu3'.
TABLEA is a huge table and it has non-clustered index on COL1. Among the 
above 2 queries, which query will give me the better performance or fast 
response and WHY? 
What is the difference between 'IN' and 'OR' clauses as for as Sybase 
Optimization is concerned. Which is the better one to be used on huge 
tables.
Thanks.
Mac
0
Ma
7/22/2002 10:25:52 AM
📁 sybase.ase.performance+tuning
📃 2395 articles.
⭐ 0 followers.

💬 1 Replies
👁️‍🗨️ 2769 Views


An IN list is treated as a series of OR clauses. There's no diff between the
two as far as the optimizer is concerned.
Eric Miner
Sr. engineer
Optimizer Group
Ma wrote:
> Hello,
>
> [1]: select * from TABLEA where COL1 IN('value1','value2''valu3'....)
>
> [2]:select * from TABLEA where COL1 = 'value1' OR COL1= 'value2' OR
> COL1='valu3'.
>
> TABLEA is a huge table and it has non-clustered index on COL1. Among the
> above 2 queries, which query will give me the better performance or fast
> response and WHY?
>
> What is the difference between 'IN' and 'OR' clauses as for as Sybase
> Optimization is concerned. Which is the better one to be used on huge
> tables.
>
> Thanks.
> Mac
0
Eric
7/22/2002 12:14:30 PM
Reply: