Skip to main content

Parameter Sniffing

  • Chapter
  • First Online:
SQL Server Query Performance Tuning
  • 1244 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 44.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints 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

Publish with us

Policies and ethics