Black Friday prices end in 18d 15h 46m — See the sale

Author: Brent Ozar

I make Microsoft SQL Server go faster. I love teaching, travel, cars, and laughing. I'm based out of Las Vegas. He/him.
Performance Tuning

Query Plan Pop Quiz Answers 2 and 3: I’ve Got Good News and Bad News.

In the Query Plan Pop Quiz, questions 2 and 3 asked you about what the sizes of arrows on query plans meant. The good news is that almost all of you got Question 2 right, but the bad news is that the vast majority of you got Question 3 completely incorrect, and the saddest part of that is that you've been using that inaccurate knowledge to guide your query tuning - and wasting your time.

Read more about Query Plan Pop Quiz Answers 2 and 3: I’ve Got Good News and Bad News. 5 comments — Join the discussion
Performance Tuning

Query Plans Pop Quiz Answer #1: Costs are Garbage.

In last week's Query Plans Pop Quiz, the first question was, someone hands you these two queries and you get their estimated plans to decide which query to tune. Perhaps you get the estimated plans from SSMS, or from sp_BlitzCache, or from your monitoring tool. The question was, which query should you focus on tuning?…

Read more about Query Plans Pop Quiz Answer #1: Costs are Garbage. 4 comments — Join the discussion

SSMS v22 Query Hint Recommendation Tool: The Invasion of the Query Hints

SQL Server Management Studio 22 Preview 3 is out, and it brings with it a new Query Hint Recommendation tool. Start by highlighting the query you want to test, then click Tools, Query Hint Recommendation Tool. It slides out a new pane on the right hand side: The maximum tuning time defaults to 300 seconds,…

Read more about SSMS v22 Query Hint Recommendation Tool: The Invasion of the Query Hints 24 comments — Join the discussion
Performance Tuning

Query Plans Pop Quiz: Three Simple Questions

Question 1: Pick the Problematic Plan: someone hands you a pair of queries, and you get the estimated query plans. (Perhaps you get the estimated plans from SSMS, or from sp_BlitzCache, or from your monitoring tool.) Which one of these two should you focus on tuning first, Query 1 or Query 2?

Question 2: on an estimated plan, what does the thickness of the colored arrow represent?

Read more about Query Plans Pop Quiz: Three Simple Questions 28 comments — Join the discussion
T-SQL & Development

Which Should You Use: VARCHAR or NVARCHAR?

Your queries won’t tune themselves. My 2027 Live Class Season Pass is $995 (normally $4,395), with live Fundamentals and Mastering classes plus recordings. Register by October 31 to join Fundamentals Week, November 2–6. See the pass.

You're building a new table or adding a column, and you wanna know which datatype to use: VARCHAR or NVARCHAR?

Read more about Which Should You Use: VARCHAR or NVARCHAR? 30 comments — Join the discussion
Production DBA

Set MAXDOP in Azure SQL DB or You’ll Get This Cryptic Error.

Max Degrees of Parallelism (MAXDOP) tells the database engine, "If you decide to parallelize a query, go parallel with this many worker threads."

(It's a little more complex than that - there is also a coordinating thread, plus a single plan might have multiple parallel zones that each consume MAXDOP worker threads, but for the sake of this blog post, let's keep it simple.)

Read more about Set MAXDOP in Azure SQL DB or You’ll Get This Cryptic Error. 1 comment — Join the discussion
News & Opinion

We Hit 50,000 YouTube Subscribers! Let’s Run a Contest.

This is kinda amazing to me: our YouTube channel has broken the 50,000 subscriber mark!

That's wild to me because I don't put "please like and subscribe" type stuff in the videos, and I don't try to build viral content. I just show up every week and publish answers to y'all's questions from PollGab. And yet, our subscriber growth is slow and steady over time, growing by about 10% per year:

Read more about We Hit 50,000 YouTube Subscribers! Let’s Run a Contest. 176 comments — Join the discussion

Microsoft Now Recommends You Set Max Memory to 75% and Min Memory to 0%.

Your queries won’t tune themselves. My 2027 Live Class Season Pass is $995 (normally $4,395), with live Fundamentals and Mastering classes plus recordings. Register by October 31 to join Fundamentals Week, November 2–6. See the pass.

Somehow I missed this a few years ago, and I bet a lot of y'all did too. Note the new "Recommended" column in the memory settings documentation:

Read more about Microsoft Now Recommends You Set Max Memory to 75% and Min Memory to 0%. 20 comments — Join the discussion

[Video] Office Hours: Database Questions & Answers

In between clients, I hopped onto my Twitch channel to take your top-voted questions from https://pollgab.com/room/brento. If you'd like to get notified whenever I do one of those live streams, you can follow my channel for free and you'll get email notifications automatically. I do 'em whenever I have time, usually about once a week when I'm at home.

Read more about [Video] Office Hours: Database Questions & Answers 1 comment — 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