Stored procedures and prepared statements can use parameters as placeholders for values. The optimizer can use the values in the parameter when the plans compile to get specific statistics, commonly known as parameter sniffing. Most of the time, this enhances performance. However, some queries suffer poor performance because they are very sensitive to exactly which values are used to create the plan. These are known as parameter-sensitive queries. Dealing with these queries can be a challenge.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Parameter-Sensitive Queries: Causes and Solutions

  • Grant Fritchey

摘要

Stored procedures and prepared statements can use parameters as placeholders for values. The optimizer can use the values in the parameter when the plans compile to get specific statistics, commonly known as parameter sniffing. Most of the time, this enhances performance. However, some queries suffer poor performance because they are very sensitive to exactly which values are used to create the plan. These are known as parameter-sensitive queries. Dealing with these queries can be a challenge.