The Problem :
declare @toggling int = null
Select * from Table1 a
inner join Table2 b
on a.id = b.is
where
((@toggling is null) or (a.id in (select id from table3 )))
The output is good based on the @toggling parameter value,
But When i sending with @toggling = null
the Sql processed the Sacn count and Logical reads for the OR part, i dont know how to stop the failed that OR conditions area
------(a.id in (select id from table3 ))
How to reduce the extra scan's