Re: Performance question
Posted in 1998
Rui Domingos — — source: Informix-list mailing list archive (1991-1998)
I can help you for this two:
>
>select * from table1 where col in (value1,value2,value3,value4, ...)>
>vs
>
>select * from table1 where col=value1 or col=value2 or col=value3 or ...>
The fastest way is neither one, but:
select * from table1 where col=value1
UNION
select * from table1 where col=value2
UNION
select * from table1 where col=value3
This is true because Informix doesn't use indexes in the presence of an or
operation.
So if table1 is big and you have an index on col the UNION example will work
much faster, because now you have 3 selects but no ORs.
Rui Domingos
rui.domingos@psidoc.pt