Plan Cache, Query Store, and Query Analysis

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

200 associated posts60 primary posts

[Video] I Must Be an Idiot: Automatic Tuning Never Works for Me.

I don't get it. I've given this feature one chance after another, and every time, it takes a smoke break rather than showing up for work.

The latest instance involved the recent Query Exercise where you were challenged to fix a computed column's performance. In the comments, some folks noted that performance of the query was actually great on old compat levels, like SQL Server 2008, and that it only sucked on newer compat levels like 2016 and later.

Read more about [Video] I Must Be an Idiot: Automatic Tuning Never Works for Me. 21 comments — Join the discussion
Performance Tuning

What Happens When Multiple Queries Compile at Once?

An interesting question came in on PollGab. DBAmusing asked: If a query takes 5-7s to calculate the execution plan (then executes <500ms) if multiple SPIDS all submit that query (different param values) when there's no plan at start, does each SPID calc the execution plan, one after the other after waiting for the prior SPID…

Read more about What Happens When Multiple Queries Compile at Once? 5 comments — Join the discussion
Performance Tuning

Improving Cardinality Estimation: Answers & Discussion

Your challenge for last week was to take this Stack Overflow database query to show the top-ranking users in the most popular location:
[crayon-6a6ece2a8ca11384540524/]
And make it read less pages only by tuning the query? You weren't allowed to make index or server changes, and you weren't allowed to hard code the location in the query since it might change over time.
The Core of the Problem
The main problem is that when we run a statement (like SELECT), SQL Server:

Read more about Improving Cardinality Estimation: Answers & Discussion 16 comments — Join the discussion

Office Hours: “Read This” Edition

Sometimes when people post questions at https://pollgab.com/room/brento, the answer is just a link, nothing more, nothing less. It doesn't make sense for me to rehash something that's been covered really well online, and I want to link 'em to the best resource possible. Petr: Huge slowdown of basic queries when using a partitioned table (Partition_Key…

Read more about Office Hours: “Read This” Edition 1 comment — Join the discussion

[Video] Office Hours at the Northernmost Town in the World

Despite its location, Hammerfest, Norway attracts countless tourists eager to see the festival celebrating one of the world's favorite rappers. Did I get that right? I'm not sure I got that right. There's also fierce competition for the title of northernmost town: nearby Honningsvåg Norway also wants that claim, but with a population of only…

Read more about [Video] Office Hours at the Northernmost Town in the World Be the first to comment
Production DBA

“Oops, I Lost My Indexes in Azure SQL DB.”

I got an interesting request for consulting, and I'm going to paraphrase it: We were using Azure SQL DB with automatic index tuning enabled for months. Things were going great, but... we just deployed a new version of our code. Our deployment tool made the database schema match our source control, which... dropped the indexes…

Read more about “Oops, I Lost My Indexes in Azure SQL DB.” 12 comments — Join the discussion