sql server - SQL View Performance increases after adding OR condition in where clause -
i have view this, takes 2 minutes execute.
select col1, col2, col3, col4, ..., table1 inner join table2 on condition1 inner join table3 on condition2 inner join table4 on condition3 .... left outer join table12 on condition11 left outer join table13 on condition12 ... condition13 , condition14 , condition15
but if add or
condition view, performance increases dramatically, takes 13 sec. or
condition never true in case. col1
primary key on table2
, idea why happen, , there neat way achieve these results.
or table2.col1 = 0
altered query:
select col1, col2, col3, col4, ..., table1 inner join table2 on condition1 inner join table3 on condition2 inner join table4 on condition3 .... left outer join table12 on condition11 left outer join table13 on condition12 ... condition13 , condition14 , condition15 or table2.col1 = 0
thanks in advance
Comments
Post a Comment