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

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
Microsoft SQL Server MVP
… 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
This posting is provided AS IS with no rights for the sake of knowledge sharing.