O'Reilly logo

SQL Server 2017 Query Performance Tuning: Troubleshoot and Optimize Query Performance by Grant Fritchey

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Grant Fritchey 2018
Grant FritcheySQL Server 2017 Query Performance Tuninghttps://doi.org/10.1007/978-1-4842-3888-2_17

17. Parameter Sniffing

Grant Fritchey1 
(1)
Grafton, Massachusetts, USA
 

In the previous chapter, I discussed how to get execution plans into the cache and how to get them reused from there. It’s a laudable goal and one of the many ways to improve the overall performance of the system. One of the best mechanisms for ensuring plan reuse is to parameterize the query, through either stored procedures, prepared statements, or sp_executesql. All these mechanisms create a parameter that is used instead of a hard-coded value when creating the plan. These parameters can be sampled, or sniffed, by the optimizer to use the values contained ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required