This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
Gouache painting of a beagle sitting beside a wicker picnic basket with a vermilion cloth, looking away

DISABLE_PARAMETER_SNIFFING Hint: Turn Off Sniffing for One Query

February 12, 2020
Pinal Dave
SQL Performance
Execution Plan, Parameter Sniffing, Query Hint, SQL Scripts, SQL Stored Procedure

The DISABLE_PARAMETER_SNIFFING hint makes one query ignore the parameter value it was first compiled for. This post compares it with the default, OPTIMIZE FOR UNKNOWN and RECOMPILE on a table where one customer owns 40 percent of the rows. The reads show which variant fits which workload.

Read More
An unfinished knitted square can be unravelled and worked anew from the same yarn

How to Recompile Stored Procedure? – Interview Question of the Week #260

January 19, 2020
Pinal Dave
SQL Interview Questions and Answers
Parameter Sniffing, SQL Performance, SQL Scripts, SQL Server, SQL Stored Procedure

Question: How to Recompile Stored Procedure?
Answer: The answer to this question is here:

EXEC sp_recompile ‘NameofSP’

Let us read more about it.

Read More
A tray of flat-head screwdrivers beside a closed wooden box, a hand hovering between them on a workbench.

Why a Filtered Index Is Ignored by Parameterized Queries

January 15, 2020
Pinal Dave
SQL Performance
Execution Plan, Parameter Sniffing, SQL Index, SQL Performance

Explain why a filtered index is ignored with parameters, inspect plan warnings, and compare literal filters, RECOMPILE, and coverage fixes.

Read More
Gouache painting of four garden tools hanging on a rail, the second one a vermilion trowel and the others grey and sage

Parameter Sniffing Fixes Compared: Which One to Use

January 1, 2020
Pinal Dave
SQL Performance
Parameter Sniffing, Query Hint, Recompile, SQL Scripts, SQL Stored Procedure

Parameter sniffing fixes compared on one table show a clear order, from a cheap guess to a better index. This post runs the plain procedure, a local variable, OPTIMIZE FOR UNKNOWN, a scoped setting, OPTION (RECOMPILE) and a covering index on the same skewed table, and prints the page reads of each in both call orders.

Read More
Gouache painting of a fresh pattern sheet pinned on cloth with vermilion scissors beside a pile of crumpled old patterns

OPTION (RECOMPILE) Hint: When a Fresh Plan Pays Off

December 31, 2019
Pinal Dave
SQL Tips and Tricks
Parameter Sniffing, Query Hint, Recompile, SQL Scripts, SQL Stored Procedure

The OPTION (RECOMPILE) hint tells SQL Server to build a new plan every time a statement runs. This post measures the page reads it saves on skewed data, the compile cost it adds, the filtered index it unlocks, and how to apply it to one statement of a procedure.

Read More
Gouache painting of a brass tap with a vermilion wheel feeding a trough that runs past a row of young apple trees

Database Scoped Configuration: Turn Off Parameter Sniffing

December 30, 2019
Pinal Dave
SQL Performance
Parameter Sniffing, SQL Scripts, SQL Server Configuration, SQL Stored Procedure

A database scoped configuration lets you turn off parameter sniffing for one database with a single statement. This post measures a procedure with the setting on and off, shows that the change clears the cached plans of the database, and explains what the switch does not fix.

Read More
Illustrated cover: OPTIMIZE FOR UNKNOWN

SQL SERVER – Parameter Sniffing and OPTIMIZE FOR UNKNOWN

December 21, 2019
Pinal Dave
SQL Tips and Tricks
Parameter Sniffing, SQL Performance, SQL Scripts, SQL Server, SQL Stored Procedure

I consider myself fortunate that I receive a follow-up question from my blog posts. Let’s discuss Parameter Sniffing and OPTIMIZE FOR UNKNOWN.

Read More
Previous 1 2 3 4 5 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com