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
A heavy door propped open by a red wedge that has quietly slid across the floor.

Forcing a Plan in Query Store and Checking That It Held

April 17, 2020
Pinal Dave
SQL Performance
Execution Plan, Query Store, SQL Performance, SQL Server

Use forcing a plan in Query Store with verified IDs, then audit force failures and runtime results every week so the fix stays useful.

Read More
Gouache painting of a half-woven basket with a bundle of reeds and one vermilion reed where the weaving stopped

Canceled Query Plan: Three Ways to Capture It in SQL Server

April 1, 2020
Pinal Dave
SQL Performance
Execution Plan, Query Store, SQL DMV, SQL Server Management Studio

A canceled query plan can be captured with Live Query Statistics, with a live plan query while the statement runs, or from Query Store after the cancel. This post runs a long query, reads its plan while it runs, cancels it and then reads the aborted run from Query Store. It also explains which plan each method returns.

Read More
A boat ramp ending in dry cracked mud with a red buoy at its foot, the lake shrunk far away

Stale Statistics: Detecting and Updating Them

March 20, 2020
Pinal Dave
SQL Performance
DBA, Execution Plan, SQL Performance, SQL Server Agent, SQL Statistics

Detect stale statistics with update properties, review modification thresholds, and schedule targeted refreshes with recorded outcomes.

Read More
Gouache painting of attic shelves with a few shiny pots, many dusty ones and a vermilion broom leaning on the shelf

Remove Cached Plans Not Used for a Set Time in SQL Server

March 7, 2020
Pinal Dave
SQL Performance
Execution Plan, SQL Cache, SQL Scripts, SQL Server DBCC

To clear cached plans not used for a set time, list the plans by their last execution time or by the time they were built, then clear each one by its plan handle. This post builds a small procedure that previews the plans first and removes them only when you switch it on. It also explains why the plan handle needs its 0x prefix.

Read More
Gouache painting of a brass balance scale weighing a wooden spoon against a vermilion weight, with mixing bowls behind it

Last Query Cost in MySQL: Read It With SHOW STATUS

February 20, 2020
Pinal Dave
SQL Tips and Tricks
Execution Plan, MySQL, SQL Scripts

The last query cost in MySQL is a number the optimizer computes for the last query it compiled, and SHOW STATUS LIKE ‘Last_query_cost’ returns it. This post shows the command on a Sakila query, explains what the number means and where it misleads. It also points to EXPLAIN FORMAT=JSON for the cost of each part of a plan.

Read More
Illustrated cover: Stream vs Hash Aggregate

SQL SERVER – Stream Aggregate and Hash Aggregate

February 17, 2020
Pinal Dave
SQL Performance
Execution Plan, MAXDOP, Parallel, Query Hint, SQL Group By, SQL Operator, SQL Server Management Studio

Recently during the on-demand consultation, I was asked a very interesting question about Stream Aggregate and Hash Aggregate.

Read More
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
Previous 1 … 9 10 11 12 13 14 15 … 35 Next
  • Books
  • Testimonials
  • Privacy Policy

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