Abstract
In the previous chapter, I discussed how to get execution plans into cache and how to get them reused. 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 within when creating the execution plan. When this works well, as it does most of the time, you benefit from more accurate plans. But when it goes wrong and becomes bad parameter sniffing, you can see serious performance issues.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2014 Grant Fritchey
About this chapter
Cite this chapter
Fritchey, G. (2014). Parameter Sniffing. In: SQL Server Query Performance Tuning. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4302-6742-3_16
Download citation
DOI: https://doi.org/10.1007/978-1-4302-6742-3_16
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4302-6743-0
Online ISBN: 978-1-4302-6742-3
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books