开发者

performance difference between exec of SP and running the statements

开发者 https://www.devze.com 2023-03-06 20:40 出处:网络
I am experiencing a huge performance difference when calling a stored procedure with EXEC (with parameters) or running the exact same statements inside the stored procedure separately in Mana开发者_开

I am experiencing a huge performance difference when calling a stored procedure with EXEC (with parameters) or running the exact same statements inside the stored procedure separately in Mana开发者_开发知识库gement Studio. The EXEC is 3-4 times slower. What causes this?


See this answer.

It's a phenomenon called "parameter sniffing" - basically SQL tries to create the optimal execution plan based on what it expects your parameters to be, which is often not accurate at all.

0

精彩评论

暂无评论...
验证码 换一张
取 消