Einstien's definition of insane was "Doing the same thing twice, and expecting different results"
If I run this with the red code, my query takes 2:45, if I run it with the green code, it takes 1:53. Shouldn't the equivilate to the same thing?
Code:
declare @indextyp char(5)
declare @IL char(5)
set @indextyp='D'
set @IL='A'
select
names.key1 as name1,
case when @indextyp='D' then inst.a19 else inst.a18 end as name2,
inst.b15 as recep#,
inst.a1 as insttype,
inst.a17 as instdate,
inst.key2 as recdate,
inst.a4 as book,
inst.a5 as booknumber,
inst.d1,41 as legal,
inst.id as id
from object names, object inst
where
[COLOR=#ff0000]((@IL = 'L' and inst.typ=25) or (@IL='I' and inst.typ=3) or (@IL='A' and inst.typ in (3,25)))
[/color]
[COLOR=green]inst.typ in (3,25)[/color]
and names.typ=10
and names.link1=inst.id
and (names.a5='Grantor' or names.a5='Issued Against')