sql - Huge performance difference between exec of SP and running the statements of sp is solved by alter query (without any change) of the same SP -
today run interesting problem no 1 in our 8-person software team have ever seen.
exec firmsearch 1, 1
that simple sp took 45 sec. execute in every time. running exact same statements inside stored procedure took less 1 sec. create firmsearchv2 same functionality. then:
exec firmsearchv2 1, 1
firmsearchv2 took less 1 sec. tried execute modify query (without change) of firmsearch sp , problem disappeared. firmsearch executes in less 1 sec. using mssql 2008.
what possible reasons of problem?
i don't know sql-server may wrong, in dbms stored procedures compiled statistics exists when sp created. is, if data changes lot access plan compiled sp may sub-optimal. may explain why recreate of sp improves performance. check if there utility can recompile sp without having recreate it.
Comments
Post a Comment