Pre-Optimized Query Plan for SP? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Pre-Optimized Query Plan for SP?

I was wondering if anyone knows how to tell SQL which execution plan to use for a stored procedure before you initial run the SP. What I mean is that the first time I run my SP it takes a while. Then after subsequent execution runs smoothly for the SP. My GOAL is to not have the SP run slow the first time it is called. Thanks
Tom

It runs slower because data are not in database cache when you first run stored procedure.
The SP needs to be compiled, put into prodecure cache… That’s a natural and necessary mechanism you cannot avoid. Apart from this is the Query Optimizer a quite sophisticated piece of software. Don’t try to outsmart the optimizer by "guessing" what decision it might take. Are you experiencing any serious performance problems? —
Frank Kalis
Moderator
Microsoft SQL Server MVP
Webmaster:http://www.insidesql.de
… and how often the database optimization tasks are scheduled to take care of such performance issues. Satya SKJ
Microsoft SQL Server MVP
Contributing Editor & Forums Moderator
http://www.SQL-Server-Performance.Com
This posting is provided AS IS with no rights for the sake of knowledge sharing.
]]>