Is it possible to reduce the unwanted Scan count and Reads in Tsql when Query Toggling happens

  • 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

  • http://sqlinthewild.co.za/index.php/2009/03/19/catch-all-queries/

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Great Gail! Thanks I will move for the Dynamic query

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply