Posts by Brent Ozar

[Video] Office Hours From the Future

Videos
4 Comments
To answer today’s questions from https://pollgab.com/room/brento, I strapped on my Apple Vision Pro and recorded my persona as if we were on a FaceTime or Zoom call together. It’s delightfully creepy, as if I’m AI Brent from the Future. Here’s what we covered: 00:00 Start 00:44 Rushabh Shah: I have a question regarding the DBCCSHRINKFILE…
Read More

Updated First Responder Kit and Consultant Toolkit for February 2024

First Responder Kit Updates
0
New this month: better sp_BlitzIndex performance on databases with tens of thousands of objects, sp_DatabaseRestore can run test scripts, and David Wiseman and Sean Killeen implemented basic automated testing for the First Responder Kit. Wanna watch me use it? Take the class. To get the new version: Download the updated FirstResponderKit.zip Azure Data Studio users…
Read More

Query Exercise: Finding Sister Locations to Help Each Other

Query Exercises
12 Comments
For this week’s query exercise, let’s start with a brief query to get a quick preview of what we’re dealing with: Transact-SQL SELECT TOP 100 Location, COUNT(*) AS Population, AVG(Reputation) AS AvgReputation FROM dbo.Users GROUP BY Location ORDER BY COUNT(*) DESC; 123456 SELECT TOP 100 Location, COUNT(*) AS Population, AVG(Reputation) AS AvgReputationFROM dbo.UsersGROUP BY LocationORDER…
Read More

Sessions You Should Attend at SQLBits Online 2024

SQLBits
1 Comment
SQLBits 2024 is next month, and the session agenda is out, including the Microsoft-led sessions. If you’re going to get the boss to buy you an online or in-person ticket, it’ll help if you have a specific list of sessions you wanna attend. Managers love it when you can point at each session and say,…
Read More

[Video] Office Hours: Hot Tub Edition

Videos
1 Comment
Today’s Office Hours comes from a very different office! I climbed into the hot tub to review your top-voted questions from https://pollgab.com/room/brento. Don’t worry, the webcast is completely safe for work. Here’s what we covered: 00:00 Start 00:32 MooneyFlyer: Hey Brent, what are your thoughts on functions like PIVOT and window functions (last_value, first_value, etc).…
Read More

Query Exercise: Find Recent Superstars

Query Exercises
44 Comments
For this week’s Query Exercise, we’re working with the Stack Overflow database, and our business users have asked us to find the new superstars. They’re looking for the top 1000 users who were created in the last 90 days, who have a reputation higher than 50 points, from highest reputation to lowest. In your Stack…
Read More

Finding Long Values Faster: Answers & Discussion

Query Exercise Answers
8 Comments
In last week’s Query Exercise, our developers had a query that wasn’t going as fast as they’d like: Transact-SQL CREATE INDEX DisplayName ON dbo.Users(DisplayName); GO SELECT * FROM dbo.Users WHERE LEN(DisplayName) > 35; 12345 CREATE INDEX DisplayName ON dbo.Users(DisplayName);GOSELECT *  FROM dbo.Users  WHERE LEN(DisplayName) > 35; The query had an index, but SQL Server was refusing to…
Read More

[Video] Office Hours: Ask Me Anything About Microsoft Databases

Videos
0
Post your database questions at https://pollgab.com/room/brento and upvote the ones you’d like to see me discuss on the stream. If you’d like to be alerted when I live stream these, follow me on Twitch. Here’s what we discussed today: 00:00 Start 00:38 Steve E: Hi Brent, Have you ever come across any environment using Application…
Read More

Query Exercise: Finding Long Values Faster

Query Exercises
43 Comments
Our developers have come to us with a problem query that isn’t as fast as they’d like. Using any Stack Overflow database: Transact-SQL CREATE INDEX DisplayName ON dbo.Users(DisplayName); GO SELECT * FROM dbo.Users WHERE LEN(DisplayName) > 35; 12345 CREATE INDEX DisplayName ON dbo.Users(DisplayName);GOSELECT *  FROM dbo.Users  WHERE LEN(DisplayName) > 35; It has an index, but SQL Server…
Read More

Improving Cardinality Estimation: Answers & Discussion

Query Exercise Answers
12 Comments
Your challenge for last week was to take this Stack Overflow database query to show the top-ranking users in the most popular location: Transact-SQL CREATE INDEX Location ON dbo.Users(Location); GO CREATE OR ALTER PROC dbo.GetTopUsersInTopLocation AS SELECT TOP 200 u.Reputation, u.Id, u.DisplayName, u.WebsiteUrl, u.CreationDate FROM dbo.Users u WHERE u.Location = (SELECT TOP 1 Location FROM…
Read More

The Last Ticket/Issue I Closed #TSQL2sday

T-SQL
19 Comments
For this month’s T-SQL Tuesday, I asked y’all to write about the most recent ticket or issue that you closed. (If you want to see other peoples’ posts, you can check out the comments on that invite post, or wait til next week and I’ll publish a wrap-up of everyone’s answers.) A past client emailed…
Read More

SQL ConstantCare® Population Report: Winter 2023

SQL Server
4 Comments
The short story: SQL Server 2019 continues its utter domination of the Microsoft data platform landscape this quarter. The long story: ever wonder how fast people are adopting new versions of SQL Server, or what’s “normal” out there for SQL Server adoption rates? Let’s find out in the winter 2023 version of our SQL ConstantCare®…
Read More

[Video] Office Hours: Lumberjack Edition

Videos
0
On a chilly January day, I went through your top-voted questions from https://pollgab.com/room/brento. Yes, it actually gets cold in Vegas! It’s sub-freezing overnight before the sun comes out each day. Here’s what we covered: 00:00 Start 02:53 MyTeaGotCold: Is BCP dead for both exporting and importing? When exporting, people seem to prefer not using SQL.…
Read More

Query Exercise: Improving Cardinality Estimation

Query Exercises
33 Comments
Your challenge for this week is to tune a query. Say Stack Overflow has a dashboard that shows the top-ranking users in their most popular location. It’s even got an index to support it: Transact-SQL CREATE INDEX Location ON dbo.Users(Location); GO CREATE OR ALTER PROC dbo.GetTopUsersInTopLocation AS SELECT TOP 200 u.Reputation, u.Id, u.DisplayName, u.WebsiteUrl, u.CreationDate…
Read More