Plan Cache, Query Store, and Query Analysis

Using query history, cached plans, and runtime data to investigate performance.

200 associated posts60 primary posts

[Video] Office Hours at Iceland’s Most Famous Waterfall

Iceland has some pretty famous waterfalls, from Þórufoss and Skógafoss in Game of Thrones, to Háifoss in Stranger Things, to Dettifoss in Prometheus, and more. However, probably the most-photographed one is Seljalandsfoss, partially because of its easy access from the Ring Road, and partially because of, uh, Justin Bieber's video for I'll Show You. That video is also a pretty good intro to the greatest hits of Iceland's south coast.

Read more about [Video] Office Hours at Iceland’s Most Famous Waterfall Be the first to comment
Performance Tuning

New Official Documentation on Forced Parameterization

I love me some documentation.

For years, I've pointed folks to the SQL Server 2008 documentation on Forced Parameterization, a really useful tool for reducing plan cache bloat, getting more accurate reusable query plans, and enabling SQL Server 2019 and 2022's Intelligent Query Plan features, many of which rely on the same query text coming in repeatedly over time in order to tune it. That documentation was pretty sparse, though.

Read more about New Official Documentation on Forced Parameterization 5 comments — Join the discussion

Automatic Stats Updates Don’t Always Invalidate Cached Plans

Normally, when SQL Server updates statistics on an object, it invalidates the cached plans that rely on that statistic as well. That's why you'll see recompiles happen after stats updates: SQL Server knows the stats have changed, so it's a good time to build new execution plans based on the changes in the data.

However, updates to system-created stats don't necessarily cause plan recompiles.

Read more about Automatic Stats Updates Don’t Always Invalidate Cached Plans 9 comments — Join the discussion

[Video] Office Hours in Kyoto, Japan

Kyoto feels like a timeless, classic version of historical Japan with quiet tree-lined streets, giant temples, and bubbling brooks. It's the exact opposite of last week's experience in noisy Osaka! Last year, I filmed in Kyoto outside a temple, and this year, I'm at another temple just after New Year's, the time when Japanese folks traditionally go to visit their many gorgeous temples.

Read more about [Video] Office Hours in Kyoto, Japan 3 comments — Join the discussion
Production DBA

Let’s Build a Better KILL. What Do We Need to Consider?

When there's a performance emergency, a lot of us perform the same manual tasks over and over. We run sp_BlitzWho or sp_WhoIsActive, look for blocking, long-running or out-of-control queries, and kill them. I'm going to build a new sp_kill for the First Responder Kit to make that easier, faster, and safer, and I want your…

Read more about Let’s Build a Better KILL. What Do We Need to Consider? 62 comments — Join the discussion

[Video] Office Hours on the Beach in Cancun

In retrospect, I should have put on sunscreen - even for just a 20-minute Office Hours session on the beach! Dang, that sun is powerful. Let's go through your top-voted questions from https://pollgab.com/room/brento. This is a 360-degree video, so if you watch it on YouTube, you'll be able to pan the camera around and take a little virtual vacation with me.

Read more about [Video] Office Hours on the Beach in Cancun 4 comments — Join the discussion
T-SQL & Development

The Query Tuning Trick You Should Use More: Pagination

When I'm tuning queries, the normal answer is to make the query perform better - either via changing the T-SQL, adding hints, or adding indexes so that the data's better prepared for the query.

However, sometimes when I'm looking at the output of sp_BlitzCache, I scroll across to the Average Rows column and double-check that the query's actually returning a reasonable number of rows out in the wild.

Read more about The Query Tuning Trick You Should Use More: Pagination 6 comments — Join the discussion

How SQL Server 2025’s Optional Parameter Plan Optimization Works

About three years ago, SQL Server 2022 introduced Parameter-Sensitive Plan Optimization (PSPO). At the time, I explained that it didn't work particularly well, and went so far as to pronounce PSPO in a rather unflattering way. I wouldn't suggest that anyone turn it off - it's fine, just fine - but it isn't powerful enough, and poses serious challenges for monitoring and plan cache analysis.

Read more about How SQL Server 2025’s Optional Parameter Plan Optimization Works 15 comments — Join the discussion