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
An execution plan showing SELECT, Top and Index Scan, all carrying 17 rows with no warnings, beside a properties panel where Estimated Rows Read says 25 and Actual Rows Read says 5,000,000

AI Execution Plan Analysis: I Gave It My Plan and Asked What Was Wrong

September 16, 2026
Pinal Dave
SQL Performance
Parameter Sniffing, Recompile, SQL Statistics

I handed AI a plan with no warnings and healthy numbers, yet it read five million rows to return seventeen. That is the real test of AI execution plan analysis.

Read More
with recompile

SQL SERVER – Understanding WITH RECOMPILE in Stored Procedures

November 25, 2024
Pinal Dave
SQL Performance
Recompile, SQL Stored Procedure

The culprit? Parameter sniffing. The solution? You guessed it: WITH RECOMPILE. Comprehensive Database Performance Health Check

Read More
A wooden cable drum on a quay paying out rope, a red chalk mark on the rope showing how far it has moved.

Batch Requests and Compilations per Second From T-SQL

March 26, 2020
Pinal Dave
SQL Performance
Recompile, SQL Cache, SQL Counter, SQL DMV, SQL Server

Calculate compilations per second from cumulative SQL Server counters, compare batch rates, and investigate single-use plans with context.

Read More
Gouache painting of a vermilion template board beside a pile of identical pieces cut from it on a workbench

KEEP PLAN Hint: Cut Temp Table Recompiles in SQL Server

March 11, 2020
Pinal Dave
SQL Performance
Query Hint, Recompile, SQL TempDB, Temp Table

The KEEP PLAN hint gives a temp table the same recompile threshold as a permanent table. This post counts statistics recompiles with Extended Events for a plain query, a KEEP PLAN query and a KEEPFIXED PLAN query. It shows where the hint helps, where it does nothing and what the stronger hint costs.

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
A garden hose nozzle with a red dial, one sharp jet and one wide gentle shower over flower beds

Catch-All Queries and Optional Parameter Plan Optimization in SQL Server 2025

January 18, 2019
Pinal Dave
SQL Performance
Dynamic SQL, Parameter Sniffing, Recompile, SQL Server

Compare catch-all queries with recompilation, parameterized dynamic SQL, and SQL Server 2025 optional parameter plan optimization.

Read More
1 2 Next
  • Books
  • Testimonials
  • Privacy Policy

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