Skip to main content
added 40 characters in body
Source Link
Peter
  • 2.5k
  • 2
  • 5
  • 20

i've got a procedure that i want to improve that uses this where clause: WHERE p.PlatformId = ISNULL(@PlatformId, p.PlatformId) and p.PayeeStsId = 1 and p.PlatformPayeeId = ISNULL(@platformPayeeId, p.PlatformPayeeId) and pba.PayeeBankStsId=1 and a.Gcid = ISNULL(@Gcid, a.Gcid)

WHERE   p.PlatformId = ISNULL(@PlatformId, p.PlatformId)
and p.PayeeStsId     = 1
and p.PlatformPayeeId   = ISNULL(@platformPayeeId, p.PlatformPayeeId)
and pba.PayeeBankStsId=1
and a.Gcid = ISNULL(@Gcid, a.Gcid)

the ISNULLISNULL is causing me problems with using the index how can i avoid using this format of ISNULLISNULL? -> p.PlatformId = ISNULL(@PlatformAccountId, p.PlatformId)

p.PlatformId = ISNULL(@PlatformAccountId, p.PlatformId)

this format is causing the execution plan to do index scan.

i've got a procedure that i want to improve that uses this where clause: WHERE p.PlatformId = ISNULL(@PlatformId, p.PlatformId) and p.PayeeStsId = 1 and p.PlatformPayeeId = ISNULL(@platformPayeeId, p.PlatformPayeeId) and pba.PayeeBankStsId=1 and a.Gcid = ISNULL(@Gcid, a.Gcid)

the ISNULL is causing me problems with using the index how can i avoid using this format of ISNULL? -> p.PlatformId = ISNULL(@PlatformAccountId, p.PlatformId)

this format is causing the execution plan to do index scan.

i've got a procedure that i want to improve that uses this where clause:

WHERE   p.PlatformId = ISNULL(@PlatformId, p.PlatformId)
and p.PayeeStsId     = 1
and p.PlatformPayeeId   = ISNULL(@platformPayeeId, p.PlatformPayeeId)
and pba.PayeeBankStsId=1
and a.Gcid = ISNULL(@Gcid, a.Gcid)

the ISNULL is causing me problems with using the index how can i avoid using this format of ISNULL?

p.PlatformId = ISNULL(@PlatformAccountId, p.PlatformId)

this format is causing the execution plan to do index scan.

Source Link
dexon
  • 47
  • 5

Execution plan - Not using Index seek due to ISNULL

i've got a procedure that i want to improve that uses this where clause: WHERE p.PlatformId = ISNULL(@PlatformId, p.PlatformId) and p.PayeeStsId = 1 and p.PlatformPayeeId = ISNULL(@platformPayeeId, p.PlatformPayeeId) and pba.PayeeBankStsId=1 and a.Gcid = ISNULL(@Gcid, a.Gcid)

the ISNULL is causing me problems with using the index how can i avoid using this format of ISNULL? -> p.PlatformId = ISNULL(@PlatformAccountId, p.PlatformId)

this format is causing the execution plan to do index scan.