SQL Q+A Predicates, Stored Procedures, and More
SELECT x FROM t1 JOIN t2 ON t1.p = t2.f WHERE t1.v = 5 AND t2.u = 10
A From what you're describing, the procedure has most likely hit upon a poor execution plan and retained it going forward. When SQL Server has an execution plan for a query, it will retain that plan until it's dropped from the cache. The procedure can be dropped from the cache for many reasons including:
- Altering or Drop/Creating the stored procedure
- Issuing a sp_recompile command on the stored procedure
Edited by Nancy Michell
© 2008 Microsoft Corporation and CMP Media, LLC. All rights reserved; reproduction in part or in whole without permission is prohibited.