Blog

[Video] Office Hours in Tokyo, Japan

Videos
0

For the last Office Hours of the year, I’m coming to you from Tokyo, the last stop on my 3-week tour of China and Japan. This was a big Epic Life Quest task for me, for sure, something I’ve wanted to do for decades. Let’s bring you along and go through your top-voted questions from https://pollgab.com/room/brento:

Here’s what we covered:

  • 00:00 Start
  • 00:43 VeryLost: Do I need to do something special to get your 6-Month DBA Training Plan? I sign up for it every time that I download the FRK at a new job, but I have never got one of the emails.
  • 01:19 MyTeaGotCold: Is it sensible to use query hints to stagger or test a migration to a newer compatibility level? It seems like a good idea but I don’t know anyone else who has had it.
  • 02:09 CuriousDBA: For a table with a 2-column PK and a query filtering IN lists on both columns, SQL is doing a CI seek on only the 1st column (reading 50k+ rows) and then a FILTER operation on the 2nd column afterwards. Is SQL capable of determining when UNION would be better for a query instead?
  • 04:07 AnonymousDBA: We have a heap table with more than 15 non-clustered indexes. No UPDATEs. Only SELECT and INSERT. It shows up at the top of the list with highest number of indexes fragmented. Will a clustered index reduce the fragmentation problem with the non-clustered indexes on this table?
  • 04:51 summer-fondness: Hi Brent, if I had a friend they might have asked, do you think this is the right time to take the risk and learn a db outside the norm, like Iceberg? They might think something like Iceberg has benefits in industries that make Big$ and they might like to stay close to Big$
  • 06:19 Tom: Do you have a process or ideas for creating your own hands-on projects when learning new tech like Postgresql beyond what’s in classes? It’s always a catch-22 at work when wanting to take on new projects but you need the hands-on experience before taking on new projects.
  • 07:02 midDBA: hi brent i have a non clustered index on a table that has 1 billion reads and 1.3 million writes do you think that is a problem?
  • 07:45 Stefan: After 11 years as an underpayed and overworked DBA, I’m leaving the company to do something completly different. I wanna thank you very much for all the things you do for this cummunity, and a big heart to this very lovely und helpful community. I’ll miss ya all.
  • 08:22 Dopinder: Trying to convince the developers to not send customer facing emails from SQL Server sp’s. What are your top supporting reasons for this? Any horror stories?
  • 08:59 Mark Simon: Hey Brent, Does your training cover how to use query store?
  • 10:14 CrookedDBA: Every now and then my CPU elevates and I see queries locking on TempDB 2:1:128. Once it starts the CPU stays elevated until I trigger the plan cache to clear. Can a bad plan flag as a TempDB 2:1:128 wait? SQL Server 2019.
  • 11:14 Pro: I’ve come across some tricky behavior: SELECT IIF(0x10 0x1, 1, 0); — 1 SELECT IIF(0x100 0x10, 1, 0); — 0 SELECT IIF(0x1000 0x100, 1, 0); — 1 and so on. The reason for this is clear (I won’t spoil it), but what would be the best way to compare rowversions?

Your Favorite Blog Posts & Videos from 2024

Company News
1 Comment

The year is coming to a close, so it’s time to look back on your favorite stuff from this year.

2024 Blog Posts with the Most Comments

  1. What’s Your Biggest Database Regret?
  2. Query Exercise: Fix This Computed Column
  3. Query Exercise: Find the Best Time for Database Maintenance
  4. Query Exercise: Find Recent Superstars
  5. Query Exercise: Find Long Values Faster

I started the new Query Exercises series this year and I was really tickled by the reception of it. I figured that if it caught on, I’d make an e-book out of it, so look for that in 2025 along with more Query Exercises posts.

Most-Watched 2024 YouTube Videos

  1. Using the Apple Vision Pro in My Office
  2. Debugging a Complex T-SQL Issue
  3. Availability Groups 101
  4. Automatic Tuning in Inaction
  5. Office Hours Aug 28, 2024

I’m not surprised about #1, and I’m not surprised that the topic-focused videos on debugging, AGs, and automatic tuning do better than Office Hours. They take a lot more work to put together though, so I tend to not do those as often.

On my recent China/Japan trip, I decided to sell the Apple Vision Pro. I was only using it when I traveled, and even then, it takes up a lot of space in my carryon. When I saw the Huawei Mate XT dual-fold, tri-pane phone/tablet thing, I thought, that would be a much better use of the same money. I’d actually carry that around instead when I travel, and it’d be much more practical. (I wouldn’t daily-drive it as a phone though – I’m too tied into Apple’s ecosystem.)

Most Popular 2024 TikTok Comment Responses

  1. You are not Amazon.
  2. Why relational databases don’t work well for large e-commerce shopping carts
  3. How to corrupt databases
  4. “Pretty sure nobody puts business logic in the db layer”
  5. “my applications don’t need time zones”

On TikTok, I have a lot of fun with the commenters – some of which have brilliant insight, and some of which just make for good comedic fun. I really hope TikTok doesn’t die off in 2025, because it’s been the source of a lot of laughs for me so far.

The 2024 Photos Y’all Liked the Most

Over on my Instagram feed, here are the top 9 photos:

Here’s to another fun year of solving database problems!


Updated First Responder Kit and Consultant Toolkit for December 2024

First Responder Kit Updates
0

If there was ever a release you could skip, this is probably the one, because you could count this release’s changes on just one hand! Well, assuming you were an alien with six fingers. I won’t even recap the most important changes – you can just scroll down and read ’em.

How I Use the First Responder Kit
Wanna watch me use it? Take the class.

To get the new version:

Consultant Toolkit Changes

Updated to this month’s First Responder Kit, but no changes to the spreadsheet template.

sp_Blitz Changes

  • Enhancement: when @CheckServerInfo = 1, we now return target & total memory counter outputs for easier troubleshooting of memory pressure. (#3586)
  • Fix: when @OutputType = ‘markdown’, a recently added check could return an invalid XML character, breaking the output. (#3593, thanks Igor Galiney.)
  • Fix: if you ran sp_Blitz with VIEW SERVER STATE permissions, and you were the db_owner of master, but you didn’t have ALTER TRACE permissions, you would have gotten an error. (#3581, thanks Tisit.)
  • Fix: if you had really, really, really big data files, you could get an arithmetic overflow. (#3599, thanks songomajk.)

sp_BlitzIndex Changes

  • Enhancement: new first parameter @Object Name, so you can now call it even faster by putting an object’s name as the only parameter, like ‘schema.tablename’, for the current database. No need for separate @SchemaName and @TableName parameters, although we kept those to avoid breaking changes. (#3587, thanks Goran Schwarz.)
  • Fix: when @Debug = 1, we were returning the #BlitzIndexResult set twice instead of once. (#3590, thanks Vincenzo Marchese.)

For Support

When you have questions about how the tools work, talk with the community in the #FirstResponderKit Slack channel. Be patient: it’s staffed by volunteers with day jobs. If it’s your first time in the community Slack, get started here.

When you find a bug or want something changed, read the contributing.md file.

When you have a question about what the scripts found, first make sure you read the “More Details” URL for any warning you find. We put a lot of work into documentation, and we wouldn’t want someone to yell at you to go read the fine manual. After that, when you’ve still got questions about how something works in SQL Server, post a question at DBA.StackExchange.com and the community (that includes me!) will help. Include exact errors and any applicable screenshots, your SQL Server version number (including the build #), and the version of the tool you’re working with.


Working Today? Take a Break to Fill Out the Annual Salary Survey.

Salary
2 Comments

Working today? You’re not alone. As a small business person, I tend to find myself working on emails, catching up with stuff on quiet days like today.

Let’s take a second for your professional development though. Every year, I run a salary survey to help folks have better discussions with their managers about salaries, benefits, and career progression.

Take the survey now here.

The anonymous survey closes Sunday, January 12th. On Tuesday the 14th, I’ll publish the overall responses on the blog in Excel format so you can do slicing & dicing. The results are completely open source, and shared with the community for your analysis. You can analyze ’em now mid-flight – do not email me asking for edit permissions, buddy – but I’d wait until the final results come in. I’ll combine them into a single spreadsheet with the past results, and publish those here.

Thanks for your help in giving everybody in the community a better chance to talk honestly with their managers about salary.


[Video] Office Hours in Kyoto, Japan

Videos
0

My Asian vacation continues in Kyoto, the City of a Thousand Temples. They’re not playing around – the town is chock full of gorgeous historic temples, and it was tough to pick a scene for today’s Office Hours. Let’s go through your top-voted questions from https://pollgab.com/room/brento:

Here’s what we covered:

  • 00:00 Start
  • 01:35 SQL_Linux: Brent! I have a server that has many tables using nvarchar(MAX) columns. Most of the nvarchar(MAX) cols contain a max datalength of 80 or less. Will i see performance boost by changing size of nvarchar cols to 100? E.G. will this prevent data being written to off-row pages?
  • 02:58 Josef: Using sp_DatabaseRestore, is there a way to restore all databases from a backup location at once, instead of handling them one by one?
  • 03:34 Vineet: Have you considered changing office hours YouTube into a paid membership channel?
  • 04:41 Vishnu: We have developers that continue to run SSMS directly on the production SQL server despite being asked not to. Do you see any downsides to uninstalling SSMS from that VM?
  • 05:30 Bandhu: What’s your opinion of the new features in SQL 2025? Anything to get excited about?
  • 06:46 JRL: What advice do you give to clients who ask about running graph queries? For example, do you suggest the use of recursive SQL, specialized graph search features, or a specialized graph database?
  • 08:29 Rondel: What’s your opinion of Azure SQL DB’s ability to auto create / drop indexes? Does it make mistakes similar to SQL VM suggested indexes?
  • 09:32 Rennie: What’s the best time series database?
  • 10:00 Double Dragon: What’s your opinion of the pending TikTok divestiture / US ban?
  • 10:37 chris: I queried dm_db_index_physical_stats on the readable replica of a CloudSQL SQL Server instance. It took over an half an hour to run at which time the primary started performing poorly. Since the replica is in asynchronous mode is it possible the query could impact the primary?
  • 11:30 JRL: I recently attended AWS re:Invent and was disappointed that a majority of the talks seemed superficial and marketing-driven, in contrast to my experiences with the SQL community. Which tech conferences have you found rewarding in terms of technical depth and networking?

The Ebb and Flow of AI

Processes and Practices
10 Comments

It’s the end of the year. Everybody’s coasting and looking back. Let’s kick our heels up, get comfortable, and talk big picture industry stuff.

"Sir, this is a Wendy's"You and me, our weirdo jobs involve:

  • Databases – which is already unusual, and most people you run into on the street have never heard of it, even though it touches every aspect of their lives
  • One specific kind of database in particular – Microsoft SQL Server (and its various flavors, like Azure SQL DB and Amazon RDS), which isn’t even the biggest database out there, not by a long shot, so we’re a niche in a niche
  • A few particular database tasks – writing new code, performance tuning existing code, and server maintenance – we’re not even the biggest job in our industry, which would probably be database developer or report author

When you think about the entire population of Earth, our specific job is extremely small. There just aren’t that many people who do what we do.

Because we’re so niche, companies don’t really make all that much money building products to help us do our jobs, or eliminate our jobs altogether. Sure, there are definitely companies out there that are spending tens of millions of dollars a year to automate our job out of existence – but are they going to be successful? Should we worry about that? To find out, let’s zoom out and look at the bigger picture.

A More Lucrative AI Target: Self-Driving Taxis

If you zoom out to the population of Earth, an example of a larger industry would be transportation – getting people and goods from one place to another. If companies can make that easier, or eliminate human labor involved with that, then companies would make muuuuuch more money.

So when new golden hammers like artificial intelligence and machine learning come around, companies wielding those hammers look for the most money they can make, and they apply the hammers there. Go where the money is.

Google, Apple, Tesla, and General Motors all threw billions and billions of dollars trying to make self-driving taxis happen. Whoever figures that out first, and successfully scales it, could not only be the next Uber, but simply blow Uber out of the water altogether. When Uber’s worth over $100b, and General Motors is worth half of that, GM’s gotta look over at Uber and go, “I wanna take you down, buddy, and if I spend $50b doing it, I’ll still make money.”

And boy, would they make money. Not only would they cut expenses, but they’d offer a better product. I travel a lot, and I abhor today’s taxi experience. Uber is a step up from what taxis used to be, but I can’t Uber everywhere. For example, when I touch down at a busy urban airport, it’s usually much more convenient to just hop into a waiting taxi as opposed to getting an Uber, then waiting 15-20 minutes in a manic ride share area. Taxis are a throwback to a different era – disgusting back seats, no air conditioning, and bad drivers with terrible driving skills and even worse conversation topics. I would love to get into a well-maintained driverless taxi, especially at the end of a long exhausting day of travel.

However, as surefire as the business model sounds, competitors are dropping out of the AI-driven taxi business. Very smart, very wealthy companies have learned (the very expensive way) that you can’t just rub some AI on taxis and take humans out of the equation:

Self-Driving Taxis Aren’t Impossible.
They’re Just Expensive and Hard.

It’d be easy to look at the list of company failures above, then write a blog post titled something like “The Rise and Fall of AI.” Thing is, I just don’t think that’s correct. I don’t think AI is “falling” in the same sense that, say, the Roman empire fell. It’s just ebbing and flowing like the tide.

Companies invested tens of billions of dollars in self-driving taxis, and while we haven’t crossed the finish line yet, we (consumers) have seen a return on that investment. It just wasn’t the return that companies had been hoping for – instead, much smaller. Rather than eliminating the humans altogether, AI and ML are turning out to be tools that help humans be better drivers.

GM’s SuperCruise gets rave reviews, Mercedes’ new Drive Pilot system even lets you stop paying attention to the car altogether, and Tesla’s “full self driving” – well, it provides for plenty of YouTube comedy.

So How Will AI Reshape Databases? Slowly.

Using the knowledge of what happens when companies spend a decade and billions of dollars trying to improve complex tasks, let’s turn our attention to our own tiny niche industry – just as companies are. Companies are now spending time and money here, too, and some talking heads are saying humans will no longer be needed to build, tune, and troubleshoot databases.

One of the first companies to try it, OtterTune, got about $14M in funding across the span of 4 years to make MySQL and Postgres self-tuning. Richie and I tried it with SQL ConstantCare®’s database, and we had pretty abysmal results, but we chalked that up to it being an early product iteration. I worked with Andy Pavlo & his team on feedback, and I didn’t blog about our experience because I didn’t want to curse the product with bad early publicity. I guessed that given enough time & money, they’d solve the problem, and the world would be a better place for it.

Other companies will try the same thing. Most of them will burn through their investments without getting enough market traction, just as most self-driving taxi companies are setting billions of dollars on fire to be the next Uber. The self-driving database dream will be smaller, involving less research spending, because the end reward isn’t as big as self-driving taxis.

Along the way, over the next several years, those investments will result in better tooling for us humans to use, and I’m genuinely excited for that. We’re already seeing the earliest hints of it with things like SSMS Copilot and AWS DMS, but don’t let the sketchy quality of the early stuff scare you away from it permanently. The early versions of these tools will be just like the early versions of Tesla’s “full self driving” – only for the, uh, “brave.”

But before you panic about your job going away altogether, go take a ride in a taxi.


[Video] Office Hours in Osaka, Japan

Videos
9 Comments

Kon’nichiwa! My vacation tour continues in Osaka, Japan, a city famous for its street food, nightlife, and host and hostess clubs. I’m usually the kinda guy who does classy dinners at 5PM and then hits the sack by 9PM at the latest, so you might wonder how I got here. The answer is that Yves planned this trip out, hahaha, so here we are. As long as we’re here, let’s go through your top-voted questions from https://pollgab.com/room/brento.

Here’s what we covered:

  • 00:00 Start
  • 00:58 Craig: Should you start your procs with BEGIN, so all the proc code is inside a BEGIN…END block?
  • 02:18 MyTeaGotCold: 75% of my skills seem worthless after moving from being the boss of a 1 TB server to the boss of many 10-20 TB servers. Is such a big loss normal?
  • 03:19 Josef: Restoring a large database from a native SQL backup can take a long time. Would you recommend using log shipping to another server and switching over in case of failure instead of a full restore from backups?
  • 04:07 Craig: I see that you use temp tables to pass sets of data from one proc to another. What are your thoughts on serializing data as JSON and passing that into a proc via a parameter?
  • 05:05 BobTheDeveloper: I have a customer that claims his SQL Server is slow. He doesn’t want to pay for a bunch of my time to dig deep with the First Responder Kit. None of CPU, Memory, Disk and Network are being hammered. Even simple queries are taking too long. Is locking the likely problem?
  • 06:04 DogsBarkingAngrily: hi Brent! What is your learning process, how do you learn new things? I started watching your PostgreSQL series and am amazed how you know so much, so I’m curious where do you learn from? (emphasis on you … because I learnt so much from you, but where do you learn from?)
  • 07:10 Dopinder: How do you like to troubleshoot Connection Timeout errors at the client? We originally thought ours was a server side issue but turns out the VM / Client had a CPU pressure issue.
  • 07:36 Craig: If you want to find out what procs get called when a user does something on an application, what tools do you use? Profiler, Extended Events, or something else?
  • 08:26 ayed: Hello Brent, thanks for providing free content! Throughout your career, what is the maximum number of CPU cores and the largest amount of memory you’ve encountered in an operational SQL Server VM?
  • 09:11 Mary Puppins: What’s your opinion of the new copilot support in azure SQL DB for generating queries from English prompts? Seems like this could generate some inefficient queries.
  • 10:29 SQL_Linux: Hey Brent, I recently enabled the setting Optimize for Ad Hoc Workloads to resolve an issue with many single-use plans. Anyway, do you disable this setting when you do consulting if you find it enabled?

How to Explain What We Do

SQL Server
9 Comments

One of my favorite uses for AI is to ask it to explain a concept using wildly unusual points of view.

Well, we’re going to be seeing various family members and friends for the holidays, and we’ll get endless questions of, “So, what is it that you do?” I figured ChatGPT would be the perfect source for answers.

In limerick form, explain what database administrators do.

A database chief, quite astute,
Keeps information in route.
They fix every glitch,
Without any hitch,
Making data’s pursuit absolute.

While accurate and an interesting use of the limerick format, it’s not at all funny. I suppose I should clarify my prompt by adding, “Can you try examples with humor?”

In servers where data would roam,
A DBA made every byte home.
With indexes tight,
And storage just right,
He kept hackers far far from their dome.

That’s… pretty good actually! I don’t think I could explain what we do any better in limerick format. It’s hard to concisely explain this kind of thing – although bytes probably don’t make sense to folks who don’t use computers. Let’s refine our prompt: “Using a limerick format including humor, explain what database administrators do to people who have never heard of databases.”

A guardian of info’s grand hall,
Ensured nothing would stumble or fall.
When chaos would near,
They’d bring in good cheer,
And tidy up records for all.

That’s good, but it feels like the limerick format isn’t going to cut it. Let’s try another famous form of communication…

In haiku form, explain what DBAs do.

Let’s try this: Explain what a database administrator does, in haiku form, to someone who’s never heard of a database.

Keeper of records,
Organizing endless files,
Data safe and clear.

That’s… actually pretty accurate, but it doesn’t include the typical haiku references to nature and the seasons. Let’s ask for that by adding, “Can you include the traditional haiku style of referencing nature and seasons?”

Summer sun shines bright,
Maintaining databases,
Fields of data thrive.

Hmm. That’s actually the best one I got out of the batch, and even that one isn’t great. On the other hand, it’s better than anything I’d come up with in haiku format. Let’s try the longer form of haikus: “Using the humorous tanka form, explain what a database administrator does to someone who’s never heard of databases.”

Digital tidy,
Nerd with endless spreadsheets jokes,
Backups never fail,
Fixing errors with a grin,
Keeping secrets safe with flair.

Alright, I give up. Let’s try something much simpler.

Cutting right to the chase

Prompt: “I’m a professional database administrator. I’m about to meet up with my friends and family for the holidays, and I need to quickly explain what I do. Most of them have never heard of a database before. When someone asks what I do, what do I say?”


Absolutely, here are a few simple and relatable ways you can explain your role as a database administrator to friends and family who might not be familiar with databases:

1. The Digital Librarian – “I manage and organize the company’s digital information, kind of like how a librarian handles books in a library. I make sure all the data is stored safely and can be easily found when needed.”

2. Information Organizer – “Think of me as an information organizer. I keep all of our company’s data neat and accessible, ensuring everything runs smoothly and securely.”

3. Data Gardener – “I’m like a gardener for our company’s data. I plant, nurture, and protect information, making sure it grows well and stays healthy for everyone to use.”

4. Technology Troubleshooter – “I ensure that all our digital information systems are working properly. If something goes wrong with the data, I fix it so everything stays up and running.”

5. Digital Storage Manager – “I oversee how our company stores its information digitally. It’s my job to keep everything organized, backed up, and secure, so we can always access what we need.”

6. Information Security Guard – “I protect our company’s important data from being lost or accessed by the wrong people. It’s like being a security guard, but for digital information.”

7. Efficiency Expert – “I make sure our data systems are efficient and fast. This helps the company run smoothly by ensuring everyone can get the information they need quickly and reliably.”

8. Data Problem Solver – “When there are issues with our information systems, I troubleshoot and solve them. I ensure that our data is always available and functioning correctly.”


Wow! No matter what your background is, I bet you’ll find an answer in there that works for you. Happy holidays!


Are You Underpaid? Let’s Find Out! My Annual Salary Survey is Open.

Salary
1 Comment

Every year, I run a salary survey to help folks have better discussions with their managers about salaries, benefits, and career progression.

Take the survey now here.

The anonymous survey closes Sunday, January 12th. On Tuesday the 14th, I’ll publish the overall responses on the blog in Excel format so you can do slicing & dicing. The results are completely open source, and shared with the community for your analysis. You can analyze ’em now mid-flight – do not email me asking for edit permissions, buddy – but I’d wait until the final results come in. I’ll combine them into a single spreadsheet with the past results, and publish those here.

Thanks for your help in giving everybody in the community a better chance to talk honestly with their managers about salary.


How to Use Github in SSMS v21

SQL Server Management Studio v21 added native Git support, making it easier to use source control natively inside SSMS.

This feature is for developers who are already used to working with Github to manage specific object changes as they work, and who are already accustomed to Git terminologies like branches, commits, pushes, and pulls. This feature is not for DBAs who think it’s going to automatically keep your SQL Server’s object definitions inside source control for you. I totally understand why you’d want that, for sure, and I do as well, but our princess is in another castle.

So back to developers – let’s set it up. To use Github in SSMS v21, we’re going to:

  1. Sign into SSMS using our Github account with permissions on the repo
  2. Clone the repo locally
  3. Add a branch to make our changes
  4. Commit the branch, push it, and open a pull request

Let’s walk through the specifics with screenshots. When you first open SSMS v21, you’re prompted to sign in:

Logging into SSMS

For the sake of simplicity, I’m going to sign in with my Github account.

Cloning a Repo Locally

After SSMS starts, click File, Clone Repository:

Clone Repository

SSMS will ask for which Github repo you want to clone, and what path you want to clone it to:

Picking a repository and folder

The repository location is a little picky – it has to be the exact root folder of the repo, without subfolders like /tree or /tree/main. I’ll be working with the First Responder Kit, so the main URL for that is: https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/

Cloning the FRK

Click Clone at the bottom of the window, and SSMS will clone the repository locally. After it finishes, you’ll have lots of options in the Git menu:

Git menu

If you click Git, Manage Branches, you get an overview of what’s happening in the repo at the moment:

Managing Git branches

Click View, Solution Explorer, and you can go into the folder where the Github repo has been cloned (downloaded) locally – it’s on the right hand side of my window:

Solution Explorer

This is a little bit tricky. What SSMS did was create a completely isolated, standalone local repository. I’m not actually working with the origin repository directly, even though:

  • I’m signed into SSMS with my Github account
  • I’m the maintainer for the First Responder Kit repo

Those two things are unrelated. When SSMS cloned the repo, it acted as an anonymous member of the public. You kinda get a hint of this when you look at the settings & changes for this repo – it says things like you need to configure a username & email address for this repo:

Configure your repo

To set a global default for all of your repos, go into Git, Settings, Git Global Settings, and the first two entries are user name and email:

Git global settings

Just be aware that when you’re working with SSMS, you’re dealing with a completely standalone local set of repositories, even if you’re a project maintainer. (This is different than how Github Desktop works for project maintainers.)

Making a New Branch for Changes

I’ve got an issue I need to work on, so let’s create a new local branch of my repo to hold my changes. In the list of branches on the left, right-click on the default development branch for your remote repo – in this case, remotes/origin, dev – and choose New Local Branch From:

New Local Branch from remote

This is important. If you create a branch any other way, like clicking Git in the File menu, then the origin of your branch is going to be based off whatever local repo line happens to be highlighted in the background. You probably don’t want your code based off your local code – you wanna stick with the current remote repo that you’re working with. I’ll name my branch with my Github issue number and a brief description:

New local branch name

Then in the list of branches on the left, click my newly created branch, and click View, Solutions Explorer to get the list of files on the right hand side:

Local project

I’ll make some code changes to fix my particular issue, and after saving my changes and closing the files, I’ll click Git, Commit or Stash:

Git Commit or Stash

Whenever I make changes, I like to double-click on each of the files that have been changed, then take a look at the diff to make sure that I’m only committing changes I really want. Sounds crazy, but I’ve just left so many accidental things inside my commits, like testing queries. In the example here, I’ll double-click on the sp_Blitz_Checks_by_Priority.md file (Markdown), and the diff viewer pops up, highlighting my changes:

Diff viewer

After poking around in my changes, satisfied that I’m only committing good stuff, I’ll write my change description:

Change description

And click “Commit All”. This commits the change locally in my C drive, but not at the origin (Github), as shown in the confirmation message at the top after I clicked Commit All:

Committed locally

To push it to the origin, I’ll click Git, Push, and I’ll get a confirmation that my changes were pushed up to Github:

Push confirmation

Now I need to do a pull request to get the maintainers (me) to accept my code. There’s a “Pull” option in the Git file menu, but that’s just for your local repo. You have to click Git, Github, New Pull Request.

New pull request

Note that at the top of the screen, it shows “Merge into” and “From”. We’re requesting that our pull get merged into origin/dev, from origin/3586_sp_Blitz_memory_counters. If you were working from a purely local repo (because you weren’t the project maintainer), then the “from” would show your local repo instead.

I’ll make sure my commit notes and my changes look right, then click the Create button at the top left, and I get a confirmation:

Pull request confirmation

Click on the pull request link to go to Github.com, set milestones, assign people, check the results of your continuous integration tests, and merge the PR.

If, like me, you have Github set up to automatically delete branches after they’re successfully merged, you’ll need to update SSMS’s list of branches. Click Git, Manage Branches, then Git, Sync, and you’ll get a warning saying that your branch was not found in the remote repo, as shown at the top here:

Remote branch deleted

That’s totally okay! It’s just your sign that you wanna switch to another branch, or make a new branch to work on your next issue, and the process starts all over again.


[Video] Office Hours in Zhengzhou, China

Videos
0

For the rest of December, I’m out vacationing in China and Japan. For this episode, I’m coming to you from the People’s Park in Zhengzhou, China, which is kinda like the Chicago of China. It’s in the middle of the US, bigger than people think (13 million people), and has beautiful parks.

Here’s what we covered:

  • 00:00 Start
  • 01:50 Uno: What’s the easiest way to setup a secondary server for failover? My friend runs a app on a single virtual server. We take nightly backups, but would like a better option to avoid losing an entire day’s worth of data. Any suggestions?
  • 03:55 GoingAnonymousThisTime :D: I’ve setup an XE using sp_HumanEvents in order to track queries over 5s in a db. After a few minutes, I see high LATCH_UP on tempdb GAM and queries pile ups, blocking the entire server. Everything goes back to normal as soon as I stop the XE session. Any idea why this could happen?
  • 05:22 Josef: What are some good books for beginners learning SQL? Is ‘SQL in a Nutshell’ by Kevin Kline a good choice? Any other recommendations?
  • 06:09 Juan Pablo Gallardo: With the current hardware capabilities, SSD’s,huge RAM availability, do you think SQL would be replaced by solutions that do not require relational dbs, like Cosmos db? Why would you need a relational database datamodel if you can store all in one big table?
  • 06:53 MyTeaGotCold: Has the lack of columnstore on Postgres bothered you?
  • 07:21 Dogpool: What is your opinion of the new MSSQL extension for VSCode? Is the query plan display as good as SSMS?
  • 08:17 Josef: Should data, logs, tempdb, and backups be placed on separate partitions when installing SQL on a local machine with local storage?
  • 09:20 Mary Puppins: Found a SQL VM query that is suffering from parameter sniffing but can’t refactor it because it’s embedded in C#. Any tips?
  • 10:05 Josef: Do you have any plans to visit India in the future? Just curious since I saw you’re visiting China and Japan this December!
  • 11:07 Ricardo: Hi Brent, On a new customers prod server I can see everything coming from the VB sql-generator has isolation level ReadUncomitted. Can this slow performance?
  • 12:22 Vishnu: What are your pros / cons of having your SQL Data warehouse VM and SQL OLTP VM on a single VM vs two separate VMs? Which do you see more of?
  • 13:21 Ricardo: How should I handle my manager who insists on changing production data himself to fix immediate application issues. When all my advice and coaching is ignored.
  • 20:02 KyleDevDBA: How do you go about trying new skills/concepts that you are learning? When trying to learn something, I often get stuck at the “I have a hammer, where can I find a meaningful nail to hit” stage.

How to Send Email with SQL Server’s sp_send_dbmail

Development
12 Comments

So you’re writing T-SQL code and you’ve decided that you want to send emails to customers, employees, or the general public. Perhaps you need to send order updates or low stock notifications.

Stop right there. You don’t really wanna do that with SQL Server. Let’s talk about why.

It’s not easy to troubleshoot. SQL Server’s database mail doesn’t have the kind of robust troubleshooting tools necessary to understand why specific emails are delayed or non-deliverable. This is a really important task for customer-facing emails: your customers are gonna say, “I’m not getting your emails,” and your manager is gonna ask why, and you’re not going to have good answers.

Email deliverability is hard. These days, anti-spam and antivirus vendors are doing all kinds of tricks to suss out which emails are sent by humans versus which ones are automated. It’s very easy for your SQL Server’s IP address to end up on blacklists, and depending on how the blacklist is managed, your outgoing emails can also affect the deliverability of your company’s human emails, too. You don’t want your company’s email admins to say, “Well, folks, looks like our emails are all getting marked as spam because one of our developers messed up our sending reputation.”

There are legal requirements on commercial emails. You need to comply with things like the CAN-SPAM Act, giving recipients a clear unsubscribe link that actually works. If users don’t see that, they’ll simply mark your email as spam – and boom, your deliverability rates get shot. Malicious users (like me) simply block any email that doesn’t comply with the CAN-SPAM Act. I don’t give a damn about your company’s email deliverability problems – if you don’t care enough to comply with the law, I’m blocking all further emails from your company.

SQL Server doesn’t make any of that easy. Instead, build your emails in app code like C# or Java, and use transactional email providers like Sendgrid or Postmark to make sure the emails are legal and they get delivered to the right inboxes. You’re cursing me right now because I just made your job a little bit harder, but trust me, you’re going to thank me a year from now.


SQLBits is Coming Back to London in June 2025!

SQLBits
5 Comments

I used to feel bad saying that any one conference is “my favorite” because I worried that other database conference organizers might feel slighted. However, I’ve talked to many of ’em, and they feel the same way I do, hahaha, so I don’t feel guilty about it anymore.

SQLBits is my favorite database conference.

They try new stuff to push the industry forward. In the past, they’ve continuously led the way on event enhancements like childcare, onsite mental health support, a prayer room, and pronoun badges. This year, one of their experiments is to change how pre-conference workshops work. Instead of having days before the conference dedicated to pre-cons, they’re actually running all-day sessions throughout the conference, at the same time as general sessions!

They embrace a different fun theme each year like D&D, arcades, disco, superheroes, and space. Speakers & attendees are encouraged to dress up – and we do! – and speakers are encouraged to integrate the theme into their presentation. I’m excited for when they announce this year’s theme. It’s always wild to figure out how I’m gonna get a costume together in a way that I can bring it across the pond without too much hassle. (This year, I think I’m gonna ship my costume over there ahead of time, because before Bits, I’m on a European cruise, then speaking at Data Saturday Croatia.)

They throw an awesome Friday night party, an extravagant costumed get-together focused on the theme. I have so many fond memories of SQLBits parties, costumes, games, rides, and food. Its a great way for everybody to let off steam and relax after working so hard to put on a great event.

The next SQLBits conference is June 18-21, Wednesday-Saturday at Excel London on the River Thames, and I’ll be there. I’m excited to see everybody again!


[Video] Office Hours at the Petit Ermitage in LA

Videos
4 Comments

I went to LA for the opening week of Somni, a gorgeous restaurant in LA, and took your questions from the rooftop deck of the adorable Petit Ermitage hotel.

 

Here’s what we covered:

  • 00:00 Start
  • 00:37 MyTeaGotCold: When was the last time you did something interesting with Extended Events?
  • 01:25 Josef: Our app slows under heavy load, but Task Manager shows no high CPU/memory on the DB server. Suspect network issues or heavy disk reads by SQL Server. How can I identify the root cause? Which First Responder Kit stored procedures should I use first?
  • 02:17 Josef: When I have a SQL-related doubt, should I post it on the First Responder Kit Slack channel first, or directly on Pollgab? What’s the preferred approach?
  • 03:12 Dopinder: What is your opinion of the GIT support added to SSMS 21? Will this finally open the SQL source control flood gates?
  • 04:27 Jerry Mathers: What is your favorite query editor / management tool for PostgreSQL? How does it compare with SSMS?
  • 05:28 Venkat: Once SQL Server is out of support but still used, is there any incentive to pay for licensing?
  • 06:09 da5fx: Hi Brent, recently I was reviewing several SQL Server that have non critical (Dev and Test) users database on aws network file share servers. https://aws.amazon.com/blogs/moderniz…. What’s your opinion?
  • 06:50 TeaBA: You recently talked about what a bad idea it was to have linked servers pointing to themselves.Is the memory used by a linked server query part of the buffer pool or does it use another pool? If so, which pool is it? Trying to prove with metrics to customer what a bad idea it is.
  • 08:05 Josef: You often say not to RDP into the SQL Server machine. What’s the best alternative? Do you use SSMS from another machine to connect? Are there any valid reasons to RDP into the SQL Server machine?
  • 09:10 Juan Pablo Gallardo: Im usually listening to your videos using a headphone, while doing something else. I have heard so many things that now I need to go back and have no clue where to search. Please, could there be just a page with a transcript and a video reference so that we can search? please!?
  • 10:35 Bandhu: Will we see an office hours from scenic China in the near future?
  • 11:29 AutofileDAB: Experiencing performance issues on a SQL instance with way too many indexes, unused indexes, redundant indexes, bad database design, bad query design, etc. How do you handle customers who insist that the instance needs to be tuned but won’t change the database design or queries?

Who’s Hiring in the Microsoft Data Platform Community? December 2024 Edition

Who's Hiring
1 Comment

Is your company hiring for a database position as of December 2024? Do you wanna work with the kinds of people who read this blog? Let’s set up some rapid networking here.

If your company is hiring, leave a comment. The rules:

  • Your comment must include the job title, and either a link to the full job description, or the text of it. It doesn’t have to be a SQL Server DBA job, but it does have to be related to databases. (We get a pretty broad readership here – it can be any database.)
  • An email address to send resumes, or a link to the application process – if I were you, I’d put an email address because you may want to know that applicants are readers here, because they might be more qualified than the applicants you regularly get.
  • Please state the location and include REMOTE and/or VISA when that sort of candidate is welcome. When remote work is not an option, include ONSITE.
  • Please only post if you personally are part of the hiring company—no recruiting firms or job boards. Only one post per company. If it isn’t a household name, please explain what your company does.
  • Commenters: please don’t reply to job posts to complain about something. It’s off topic here.
  • Readers: please only email if you are personally interested in the job.

If your comment isn’t relevant or smells fishy, I’ll delete it. If you have questions about why your comment got deleted, or how to maximize the effectiveness of your comment, contact me.

Each month, I publish a new post in the Who’s Hiring category here so y’all can get the latest opportunities.


[Video] Office Hours: Car in the Dining Room Edition

Videos
0

What, doesn’t everyone park a convertible in their dining room? I address the pink elephant in the room, and then take your top-voted questions from https://pollgab.com/room/brento.

Here’s what we covered:

  • 00:00 Start
  • 01:03 MyTeaGotCold: Have you ever had a client turn off RCSI?
  • 01:31 SportsFan101: Hi! My company uses vmware for production(on-prem). Current wait time for new VM is about 1 month(from request to SQL Server installed/configured). How are enterprise companies deploying new SQL Server VMs? Docker images? Vmware Vapp?
  • 02:23 Blue Falcon: Should new SQL tables always be built with compression enabled? What are your pros / cons for compression?
  • 03:33 Sierra117: Ever had a client make you take their security courses (spam email, don’t click on links you don’t know, how to spot generative AI, etc.)? I hate them. But I do bill the clients 5x time it takes to complete them. If you make me go through hell… Least I’m getting paid.
  • 04:28 DataGuy: You work for a large company and are doing all greenfield development on brand new, isolated SQL clusters. What are you putting your foot down with devs to promote scalability? No ORDER BYs? No triggers (with business logic)? No long running queries? No SQL Agent jobs?
  • 06:03 DavDBA: Hi Brent, My app’s not parameterizing queries, leading to duplicate plans in cache and Forced parameterization worries me due to sniffing. If I fix some queries to use params, will it cut duplicates, or will other unparametrized queries still clog cache? Thanks!
  • 06:55 JC: Hey Brent – what are your thoughts about hosting an enterprise SQL Server environment on Citrix XenServer as the VM Hypervisor host?
  • 08:15 VegasDBA: Hey Brent! I set up a distributed AG to a reporting server and when I change a certain proc on that reporting server from linked server to cross DB connections, the query runs forever. A single table with 1.7m rows is the culprit. LS: 6s. XDB: never finishes. No errors.
  • 08:52 Dynomutt: How does PostgreSQL query tuning compare with SQL Server query tuning?
  • 09:39 Josef: Should backups be stored on a separate network drive rather than the SAN used for the databases in an SQL Server failover cluster? What are the pros and cons of this approach?
  • 10:54 chris: Hi Brent. For setting max mem you suggest leaving 4GB or 10% (whichever is more) for the OS. Can you help me understand why more memory is needed for the OS as you scale up the RAM? For example, with 200GB of RAM why would one need 20GB reserved for the OS instead of just 4GB?
  • 12:21 MustangKirby: Loading a table with 93M records. There is a check constraint enforced by a UDF which includes data access so it’s slow. I can disable the constraint but then it takes forever to make it trusted again. Is there a way to directly update is_not_trusted in sys.check_constraints?
  • 13:43 SportsFan101: Just wanted to say, that I’m a big fan of your training courses! Anyone on the fence about purchasing them should just treat themselves to an early Christmas present!
  • 14:14 Josef: Is it safe to change a database’s compatibility level from SQL Server 2008 (100) to SQL Server 2022 (160)? Could this change improve performance, or should I be cautious about potential issues with queries or features?
  • 14:58 Dopinder: Currently on Azure SQL 2019 VM. What are your pros / cons of upgrading to SQL 2022 vs waiting for SQL 2025?
  • 16:23 SQL_Linux: Do you cover how to use extended events to find low performance or problematic queries in your courses?

Making Your Learning Plan for 2025

Conferences and Classes
2 Comments

This week is my annual Black Friday sale, and over and over, folks buy the Fundamentals & Mastering Bundle because it’s such a good deal.

But then they let it sit in their accounts.

Time flies by, and next thing you know, an entire year has gone by and they haven’t watched any of the videos. So, with that in mind, here’s a planning guide to help you understand what you need to budget for time, and what you’re going to learn month by month.

That’s 11 straight months of training, without a month off or a break. Honestly, it’s hard to knock out 98 hours of videos in a single year while you’re still doing your job. That’s over 8 hours of videos per month on average, not including bio breaks or time for you to do the labs!

Now you start to see why
you gotta make a plan.

Every year – every single year – I get a flood of emails in October and November that all say, “Brent, life got in the way, and I just need another week to finish all of the classes. Can you extend my training by a week?” And that’s simply not realistic, because if you mainline Red Bull and prop your eyelids open with toothpicks, you’re not really going to absorb the training material. It’s just too hard.

So you either gotta make a plan and set aside a couple of afternoons every month, or plan ahead and buy the Lifetime bundle for $1,795. That way you can take your time, and if life interrupts you for a month or two, you don’t fall too far behind. Plus, you can revisit the material over and over for years – and trust me, you will. I hear from students all the time that they jump back to a particular module when they’re facing an unusual problem at work.

Let’s make 2025 the year that you really amp your skills up.


[Video] Office Hours: Ask Me Database Questions

Videos
0

I took your top-voted questions from https://pollgab.com/room/brento. At one point, my camera overheats – hang in there, I get it fixed in a few seconds.

Here’s what we discussed:

  • 00:00 Start
  • 01:59 MyTeaGotCold: Your HA/DR worksheet mentions a $1,000,000 option for 0/0 RTO/RPO. Where can I learn more about how this?
  • 04:43 Trushit: It was good to see you at PASS. What is one things that you learned at PASS that made you go “that sounds cool!”? Anything interesting you want to share about PASS?
  • 05:19 UserName Fabricated: Hi Brent, Have you done much performance work with the Fabric Data Warehouse? I’ve seen some articles that suggest you cannot create indexes and cannot see execution plans. Does this mean performance is so good that they are not required?
  • 06:15 Jack: Hi Brent, I’ve changed the fill factor on a 40m row table from 90% to 100%. After rebuilding the indexes, the table size got bigger when I was expecting it to be smaller. Is there a reason for this? Thanks
  • 07:18 Bandhu: We don’t have a dev SQL Server (Azure SQL VM) with customer data so the engineers code and test on production SQL server with live customer data. Customer data not allowed outside of production. What bad stuff have you seen from this scenario? Any recommendations?
  • 08:14 Luis C.: Hi Brent. In what scenario is it recommended to deploy more than one instance of SQL Server in a production environment? How are resource conflicts such as CPU, I/O access, and network bottlenecks handled? Regards.
  • 09:15 Elijah: There are hundreds to thousands of applicants for the positions I find on LinkedIn. How would you recommend getting a new role in this market? I have 5 years of MSSQL experience, 2 of those include Aurora work, and am looking for development (not production DBA) related roles.
  • 11:23 Lewis Hamilton: Hi Brent, have you considered doing a podcast for office hours?
  • 12:21 Jessica: When you were in Iceland on the Digital Nomad Visa, did you have any issues with language barriers?
  • 13:49 rlidzydba: Hello Brent. I have an extended event to capture information about failed login attempts. I want to have an alert fire a job, but I am finding the data isn’t in the extended event file when the job runs. What is the expected delay after a failed login occurs?
  • 14:47 DBA_Veil: Hey, Brent. Wondering about linked servers to created to themselves. SrvA would have linked server SrvA. If the local linked server does exist and someone queries it, does that process go out the network and back or is SQL smart enough to stay local? Asking for a developer…
  • 16:03 Yoga_Blocks: Hey Brent, I’m a new hire (Dev role) at a medium sized company. We don’t anonymize customer data for our dev server. Does the push to do some come from or from security, or compliance? Is it my responsibility to bring this to management’s attention?
  • 23:16 SportsFan101: Whats the current best practice for creating a dev environment or getting dev’s access to test data? Our Dev’s laptops have more resources than our current dev server.
  • 25:14 I’m a potato ?: Hi Brent. I’m trying to reduce disk latency, specifically, tempdb files are 255 Avg Write Stall (ms). I’ve seen that you can move tempdb to a local SSD/ephemeral disk. Can you use it in a virtualize envelopment with Live migration/vMotion enabled?

Updated Training Modules for SQL Server 2019 & 2022

Execution Plans
2 Comments

At the PASS Summit this month, I presented a 1-day workshop called T-SQL Tuning for SQL Server 2019 & 2022. I just took that material and refactored it into a few different modules for various classes:

  • Mastering Server Tuning – Why Query Monitoring is Hard Now – because I see so many people making bad decisions based on the output of sp_BlitzCache, Query Store, and 3rd party monitoring tools.
  • Mastering Query Tuning – T-SQL Tuning Speed Hacks for the Year 2025 – simple default options to use for databases that you’re actively tuning.
  • Fundamentals of Query Tuning – Using AI for Query Tuning – in the year 2025, this won’t work as well as it looks in the ads, and I explain why, plus show how ways that I successfully use it today.
  • Fundamentals of Query Tuning – Recap & Next Steps – I often refer to my work as being like a carpenter with a bunch of tools laid out in front of me. I cover the different tools at a very high level, including the order in which you should use ’em.

There are more modules to come, but I wanted to get these out the door quickly so that folks whose memberships expire this month can still sneak in. Those of y’all whose Black Friday bundles are renewing will get even more over the next couple of months. Enjoy!


3 Legit Signs It’s Time for Enterprise Edition

SQL Server
7 Comments

Your app is happily humming along on SQL Server Standard Edition. Things are quiet – too quiet. You’re wondering what you’re missing, and whether you should be on SQL Server Enterprise Edition. Here are 3 warning signs to watch out for.

Developers say, “Any downtime is unacceptable.”

Sure, everybody loves to say that before they realize the cost involved, but some databases really are mission-critical. If your devs say things like, “We need to add an index, but we can’t because that process locks the table for too long,” then it’s time to start leveling up your infrastructure.

The first line of defense is to schedule maintenance tasks after hours and weekends, and for most businesses, that’s enough. Eventually, if your workload becomes 24/7, then the next task is to amp up your hardware to knock out maintenance tasks in less time. The next resort is to start peeling back the level of index maintenance tasks – after all, you probably don’t need to be rebuilding them as often.

But when all else fails, Enterprise Edition adds the ability to perform a lot of index operations (mostly) online. If you’re only going to Enterprise for this, though, think of it as a $5,000 per CPU core tax in order to do operations (mostly) online. (Standard is $2,000 per core, Enterprise is $7,000 per core.)

You need more than 24 CPU cores.

Standard Edition handles a whopping 24 CPU cores – and if you’re on bare metal, that’s 24 physical, 48 with hyperthreading on. That is a lot of CPU power for a database server, because after all, the database server isn’t supposed to be the place where you’re doing CPU-intensive operations. That’s what app servers are for.

As you approach 50-60% CPU usage on a 24-core box, it’s time to look at which queries are using the most CPU resources, and figure out how to tune them. You can do a lot of query & index tuning for less costs than an Enterprise Edition license, for sure. Going from 24 cores of Standard to 32 cores of Enterprise is a $176,000 jump in cost just for the licensing alone! Before you even consider that, you owe it to yourself to run sp_BlitzCache @SortOrder = ‘cpu’ and start questioning what you’re doing on the SQL Server.

I’ve had tons of SQL Critical Care® engagements where folks were considering going to Enterprise Edition, only for us to find obvious easy wins in the most CPU-intensive queries. For example, the client situation that prompted this very blog post: the top CPU-intensive queries were all focused on a small set of configuration tables.

  • Short-term fix: index the tables using computed columns to make CPU-intensive queries suddenly faster and sargable
  • Mid-term fix: move those tables to a separate 24-core Standard Edition SQL Server dedicated exclusively to that task, with the fastest CPU cores available
  • Long-term fix: implement a caching layer in the application to avoid re-querying data that hadn’t changed recently

However, if we hadn’t been able to do that work quickly enough, we’d have had to upgrade the main SQL Server to Enterprise Edition and add more cores.

You need more than 1 Availability Group replica.

Your business comes up with RPO and RTO goals that the common failover clustered instance (FCI) + log shipping solution won’t cover, and you decide that the best way to meet those goals is Availability Groups. In that scenario, you’re probably going to want at least 1 replica in your primary site, and another replica in your disaster recovery site.

Enterprise Edition allows for more than 1 replica, and honestly, I think that’s a good compromise on Microsoft’s part. You can go a really, really long way with FCI + log shipping on Standard Edition. If the business wants near-zero data loss across multiple data centers, well, that’s most likely an Enterprise-grade application.

Those 3 don’t happen often, and they’re completely fair.

I think the above 3 limitations are fair delineators between the wildly-expensive Enterprise Edition and the still-pretty-expensive Standard Edition. Microsoft needs profitable products like SQL Server so they can make speculative investments in stuff like OpenAI.

However, most of the time when I’m working with a company on Enterprise Edition, they didn’t really need to buy Enterprise for any of those reasons.

It’s just that they wanted their SQL Server to handle more memory than a $2,700 laptop.

I think it’s shameful that Microsoft still gatekeeps decent memory behind Enterprise Edition, while simultaneously adding memory-hungry features like In-Memory OLTP, columnstore, and batch mode. With every release, SQL Server needs more memory – but Microsoft still caps Standard at just 128GB.

I’ve said it before and I’ll say it again: SQL Server’s biggest licensing problem isn’t that it’s too expensive – it’s that good hardware has gotten too cheap. If the next release of SQL Server continues to add more memory-hungry features while crippling Standard at 128GB, then the SQL Server marketing team is just digging its own grave.