Can You Get Parameter Sniffing on Updates and Deletes?


Sure you can – parameter sniffing is everywhere. Anytime that you have one piece of code that needs to handle a varying number of rows, you’re probably gonna have to worry about parameter sniffing.

I’ll start with any Stack Overflow database and run a couple of non-parameterized update statements. I’m using literals here, not parameters:

UPDATE dbo.Users SET LastAccessDate = GETDATE() WHERE DisplayName = N’Brent Ozar’; /* There’s only one me */ UPDATE dbo.Users SET LastAccessDate = GETDATE() WHERE DisplayName = N’Alex’; /* There are a lot of Alexes */

These two statements have two very different actual execution plans. The