SP v/s Batch

  • Hi Guys,

    If I execute the SP with same parameters logical reads are more and if i execute it as batch then

    the logical reads are considerably less .What might be the reason ?

  • Different execution plan?

  • This could be a classic case of parameter sniffing.

    Like Grant said at the summit, Parameter sniffing is your best friend, but can cause headaches for you at times. When you are running the SQL as a batch, you set the parameters to a local variable. But when you are running it of the SP, it uses the parameter that is passed in. This could cause a bad plan for that particular Query.

    -Roy

  • Thanks Guys

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

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