Live registration reopens October 1, 2026, in 3d 20h 22m — Notify me

Category: Development

Performance Tuning

“But NOLOCK won’t hurt me if I’m using an index!”

NOLOCK is bad and you probably shouldn't use it, but every time I mention that publicly, the pushback just keeps coming. I don't know why people so firmly believe that their situation couldn't possibly be affected by bad/random data from NOLOCK.

Today's misconception comes from a LinkedIn commenter telling me it's safe to use if you're doing index seeks. Hoo boy. Let's whip up a table with an index:

Read more about “But NOLOCK won’t hurt me if I’m using an index!” 15 comments — Join the discussion
T-SQL & Development

Set Your Application Names Before You Wish You Had.

When you run monitoring queries like sp_BlitzWho and sp_WhoIsActive, you wanna see the program names that are running the queries. It's super useful when you've got multiple apps running on the same servers, or when you've got apps scattered across end user computers.

If you don't set the program names, you'll either end up with empty strings, or your dev tool's default name, like Core .Net SqlClient Data Provider, which doesn't tell you jack.

Read more about Set Your Application Names Before You Wish You Had. 10 comments — Join the discussion

Database Animations: Why Higher Maxdop Equals More TempDB Spills

You've probably heard of the setting Max Degree of Parallelism. I hate that name: it should really be called just plain ol' Degrees of Parallelism, and here's why. There are a lot of conflicting opinions out there about how to set it, and Microsoft has official guidance about it in that article above. It's basically set…

Read more about Database Animations: Why Higher Maxdop Equals More TempDB Spills 8 comments — Join the discussion
T-SQL & Development

T-SQL Tuesday Roundup: You Know A Query’s Gonna Be Bad When…

For this month's T-SQL Tuesday, I invited y'all to tell me how you know a query's gonna be bad when you open it. Riccardo Perico and Shane O'Neill says WHILE loops and/or CURSORs are pretty good indicators. I agree, because especially when you're opening code in the year 2026, and someone still hasn't figured this out…

Read more about T-SQL Tuesday Roundup: You Know A Query’s Gonna Be Bad When… 12 comments — Join the discussion

How to Format Your Queries in SSMS

Microsoft SQL Server Management Studio 22.7 added the ability to format your T-SQL queries by right-clicking and clicking Format SQL, or by hitting control-K, control-Q on your keyboard:

You're probably not going to like the default formatting out of the box because you're the kind of person who has strong, passionate feelings and likes to argue about them on the Internet. Good news! The configurations are really flexible. Go into Tools, Options, SQL Formatter:

Read more about How to Format Your Queries in SSMS 10 comments — Join the discussion
T-SQL & Development

Get Your Blog Posts Ready for T-SQL Tuesday #200. Here’s the Topic.

Way back in December of 2009, Adam Machanic published a blog post (archive) in which he invited database bloggers to participate in a new monthly event he called T-SQL Tuesday. Each month, he (or a blogger he picked) proposed a topic, and on that date, we'd all publish our blog posts at the same time. It was a fun way to get a variety of opinions about a topic.

Read more about Get Your Blog Posts Ready for T-SQL Tuesday #200. Here’s the Topic. 53 comments — Join the discussion
Performance Tuning

And Then There Was The Time RCSI Actually Made Query Results More Accurate.

Normally when I tell people about SQL Server's optimistic concurrency isolation levels, Read Committed Snapshot Isolation (RCSI) and Snapshot Isolation (SI), I have to give them a little speech about how they need to test their queries because the results can change. Recently, though, I was working with a client who was getting the wrong query…

Read more about And Then There Was The Time RCSI Actually Made Query Results More Accurate. 11 comments — Join the discussion
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

You Can’t Trust “Edit Query Text” in SSMS’s Execution Plans.

When there are IF branches or conditional logic, "Edit Query Text" only shows you the branches that actually executed. It's easy to miss whole swaths of code that didn't happen to execute one particular time.

To demo it, let's create a simple stored procedure with an IF branch that sometimes executes, and sometimes doesn't:

Read more about You Can’t Trust “Edit Query Text” in SSMS’s Execution Plans. Be the first to comment

How Multi-Column Statistics Work

The short answer: in the real world, only the first column works. When SQL Server needs data about the second column, it builds its own stats on that column instead (assuming they don't already exist), and uses those two statistics together - but they're not really correlated.

For the longer answer, let's take a large version of the Stack Overflow database, create a two-column index on the Users table, and then view the resulting statistics:

Read more about How Multi-Column Statistics Work 4 comments — Join the discussion

SSMS v22.4.1: Copilot is GA. So What’s It Do Right Now?

Copilot in SSMS has two parts. Usually people focus on the pop-out Copilot chat window, and that's useful for sure, but honestly I think you're going to get way more mileage out of the code completions feature, right away, because it blends in with your existing workflows. Let's say that I'm working with the Stack…

Read more about SSMS v22.4.1: Copilot is GA. So What’s It Do Right Now? 14 comments — Join the discussion
Performance Tuning

Row-Level Security Can Slow Down Queries. Index For It.

The official Azure SQL Dev's Corner blog recently wrote about how to enable soft deletes in Azure SQL using row-level security, and it's a nice, clean, short tutorial. I like posts like that because the feature is pretty cool and accomplishes a real business goal. It's always tough deciding where to draw the line on how much to include in a blog post, so I forgive them for not including one vital caveat with this feature.

Read more about Row-Level Security Can Slow Down Queries. Index For It. 3 comments — Join the discussion

I Just Don’t Understand Why You Don’t Update SSMS.

A long time ago in a galaxy far, far away, SQL Server Management Studio was included as part of the SQL Server installer.

Back then, upgrading SSMS was not only a technical problem, but a political one too. Organizations would say things like, "Sorry, we haven't certified that cool new SQL Server 1982 here yet, so you can't have access to the installer." Developers and DBAs were forced to run SSMS from whatever ancient legacy version of SQL Server that their company had certified.

Read more about I Just Don’t Understand Why You Don’t Update SSMS. 42 comments — Join the discussion