Category: Indexing

Performance Tuning

Yet Another Way Missing Index Requests are Misleading

Graduates of my Mastering Index Tuning class will already be familiar with the handful of ways the missing index DMVs and plan suggestions are just utterly insane. Let's add another oddity to the mix: the usage counts aren't necessarily correct, either. To prove it, Let's take MattDM's Stack Exchange query, "Who brings in the crowds?" He's…

Read more about Yet Another Way Missing Index Requests are Misleading 5 comments — Join the discussion

Does the Rowmodctr Update for Non-Updating Updates?

Update May 20 - make sure to read to the end for an update.

Okay, look, it's a mouthful of a blog post title, and there are only gonna be maybe six of us in the world who get excited enough to check this kind of thing, but if you're in that intimate group, then the title's already got you interested in the demo. (Shout out to Riddhi P. for asking this cool question in class.)

Read more about Does the Rowmodctr Update for Non-Updating Updates? 11 comments — Join the discussion
Performance Tuning

What happens when you cancel or kill a resumable index creation?

SQL Server 2019 adds resumable online index creation, and it's pretty spiffy:
[crayon-6a6366d6af491004215423/]
Those parameters mean:

ONLINE = ON means you've got the money for Enterprise Edition
RESUMABLE = ON means you can pause the index creation and start it again later
MAX_DURATION = 1 means work for 1 minute, and then gracefully pause yourself to pick up again later

Read more about What happens when you cancel or kill a resumable index creation? 22 comments — Join the discussion
Performance Tuning

What does Azure SQL DB Automatic Index Tuning actually do, and when?

Azure SQL DB's Automatic Tuning will create and drop indexes based on your workloads. It's easy to enable - just go into your database in the Azure portal, Automatic Tuning, and then turn "on" for create and drop index:

Let's track what it does, and when. I set up Kendra Little's DDL trigger to log index changes, which produces a nice table showing who changed what indexes, when, and how:

Read more about What does Azure SQL DB Automatic Index Tuning actually do, and when? 24 comments — Join the discussion
Performance Tuning

How Should We Show Statistics Histograms in sp_BlitzIndex?

If you're a graduate of my free How to Think Like the SQL Server Engine course - and you'd better be, dear reader - then you're vaguely familiar with DBCC SHOW_STATISTICS. It's a command that shows you the contents of a statistics histogram. When I'm doing the first two parts of the D.E.A.T.H. Method - (D)eduplicating identical…

Read more about How Should We Show Statistics Histograms in sp_BlitzIndex? 4 comments — Join the discussion
Performance Tuning

Indexed View Creation And Underlying Indexes

Accidental Haha
While working on some demos, I came across sort of funny behavior during indexed view creation and how the indexes you have on the base tables can impact how long it takes to create the index on the view.

Starting off with no indexes, this query runs in about six seconds.
[crayon-6a6366d6b3115746229937/]
Here's the plan and the query stats:

Read more about Indexed View Creation And Underlying Indexes 1 comment — Join the discussion
Performance Tuning

Adventures In Foreign Keys 5: How Join Elimination Makes Queries Faster

FINALLY...
This is the last post I'll write about foreign keys for a while. Maybe ever.

Let's face it, most developers probably find them more annoying than useful, and if you didn't implement them when you first started designing your database, you're not likely to go back and start trying to add them in.

Read more about Adventures In Foreign Keys 5: How Join Elimination Makes Queries Faster 14 comments — Join the discussion
Performance Tuning

Adventures In Foreign Keys 4: How to Index Foreign Keys

This week, we're all about foreign keys. So far, we set up the Stack Overflow database to get ready, then tried to set up relationships, and encountered cascading locking issues.
Dawn Of The Data
I don't know how long the recommendation to index your foreign keys has been a thing, but I generally find it useful to abide by, depending a bit on how they're used.

Read more about Adventures In Foreign Keys 4: How to Index Foreign Keys 6 comments — Join the discussion