How to Recompile Stored Procedure? – Interview Question of the Week #260

Question: How to Recompile Stored Procedure?

Answer: The answer to this question is here:

EXEC sp_recompile 'NameofSP'

Well, that’s it technically we answered the question which was asked to us. However, the real question one should ask is when do we actually need to recompile the stored procedure. I only see one reason when one has to recompile the stored procedure is when the SP is facing the parameter sniffing issue and due to the issue, it is giving us poor performance.

How to Recompile Stored Procedure? - Interview Question of the Week #260 Recompile-Stored-800x293

Here are some really good blog posts which you can read about parameter sniffing and how you can avoid the problem related to it.

I suggest you go through the blog posts and understand what is parameter sniffing and how you can overcome it by using various different solutions.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Parameter Sniffing, SQL Performance, SQL Scripts, SQL Server, SQL Stored Procedure
Previous Post
What is TempDB Spill in SQL Server? – Interview Question of the Week #259
Next Post
What are Different Methods to Know the Row Count of Table? – Interview Question of the Week #261

Related Posts

Leave a Reply