Why are there performance differences when a SQL function is called from .Net app vs when the same call is made in Management Studio

后端 未结 3 1568
难免孤独
难免孤独 2021-01-12 05:10

We are having a problem in our test and dev environments with a function that runs quite slowly at times when called from an .Net Application. When we call this function di

3条回答
  •  时光说笑
    2021-01-12 06:01

    This is usually because you are getting a different execution plan in your SSMS connection. Often related to parameter sniffing issues where when the plan gets generated with a specific value that is sub optimal for other values of the parameters. This also explains why recompiling would resolve the issue. This thread seems to have a good explanation Parameter Sniffing (or Spoofing) in SQL Server

提交回复
热议问题