Problem Statement
What is parameter sniffing and how can it hurt performance?
Explanation
With parameter sniffing, the first execution influences the cached plan. If that value is atypical, later executions may reuse a poor plan and run slowly.
Mitigations include query hints or option recompile, separating skewed cases, or using plan guides and better statistics on skewed columns.
Code Solution
SolutionRead Only
-- SQL Server example EXEC sp_executesql N'SELECT * FROM t WHERE status=@s', N'@s nvarchar(10)', @s='HOT';
