开发者

Stored procedure called from C# executes 6 times longer than from SQL Management studio

I have search stored procedure which is my performance bottleneck.

In order to get control about what is happened, I added logging for all parameters and also execution time in SP.

I noticed, that when I call SP from MIcrosoft SQL server management Studio execution time is 1.开发者_如何学JAVA3-1.6 seconds, but when i call it from C#, it takes 6-8 secods (!!!)

Parameters                                                            | Time (ms)
"tb *"TreeType:259Parents:212fL:13;14fV:0;lcid:2057min:0max:10sort:-1 | 6406      
"tb *"TreeType:259Parents:212fL:13;14fV:0;lcid:2057min:0max:10sort:-1 | 1346      

SP is called with LINQ. Login settings are same. SP uses full text search

What could cause this?


In order to locate such issues, the best tool is SQL Profiler, which records the exact call to database.

For me the difference was with novalue passed by SQL sample, which was substituted by '' and null value passed by C#.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜