Live registration reopens October 1, 2026, in 18d 03h 14mNotify me

Author: Erik Darling

Restoring tempdb since GETDATE(). Now blogging at ErikDarlingData.com.
Performance Tuning

Filtered Indexes vs Parameterization (Again)

At First I Was Like... This won't work at all, because parameters are a known enemy of filtered indexes. But it turns out that some filtered indexes can be used for parameterized queries, whether they're from stored procedures, dynamic SQL, or in databases with forced parameterization enabled. Unfortunately, it seems limited to filtering out NULLs…

Read more about Filtered Indexes vs Parameterization (Again) 2 comments — Join the discussion

Index Tuning Week: Fixing Nonaligned Indexes On Partitioned Tables

Unquam Oblite
This post will not change your life, but it will help me remember something.

When you decide to partition a table to take advantage of data management features, because IT IS NOT A PERFORMANCE FEATURE, or you have an existing partitioned table that takes advantage of data management features, because IT IS NOT A PERFORMANCE FEATURE, you may have or end up with nonclustered indexes that aren't aligned with the partitioning scheme.

Read more about Index Tuning Week: Fixing Nonaligned Indexes On Partitioned Tables 19 comments — Join the discussion
Performance Tuning

A Simple Stored Procedure Pattern To Avoid

Get Yourself Together
This is one of the most common patterns that I see in stored procedures. I'm going to simplify things a bit, but hopefully you'll get enough to identify it when you're looking at your own code.

Here's the stored procedure:
[crayon-6aa5b9f249dd5099365006/]
There's a lot of perceived cleverness in here.

Read more about A Simple Stored Procedure Pattern To Avoid 15 comments — Join the discussion
Performance Tuning

Forwarded Fetches and Bookmark Lookups

Base Table
When you choose to forgo putting  a clustered index on your table, you may find your queries utilizing forwarded fetches -- SQL Server's little change of address form for rows that don't fit on the page anymore.

This typically isn't a good thing, though. All that jumping around means extra reads and CPU that can be really confusing to troubleshoot.

Read more about Forwarded Fetches and Bookmark Lookups 4 comments — Join the discussion
Performance Tuning

Locks Taken During Indexed View Modifications

Frankenblog
This post has been nagging at me for a while, because I had seen it hinted about in several other places, but never written about beyond passing comments.

A long while back, Conor Cunningham wrote:
This same condition applies to indexed view maintenance, but I’ll save that for another day :).
AFAIK he hasn't written about it or typed an emoji since then.

Read more about Locks Taken During Indexed View Modifications 8 comments — Join the discussion