Press "Enter" to skip to content

Day: October 23, 2025

TempDB Resource Governor in SQL Server 2025

Brent Ozar tries out an update to resource governor:

We’ve finally got a way to defend ourselves. We can configure Resource Governor to divide people into groups (something that seems to be trendy lately), and then cap how much TempDB space each group can consume. You don’t even have to divide them into groups, either (take note, politicians) – you can just cap how much resources everyone can use altogether.

To keep things simple for the sake of this blog post, let’s just assume we’re limiting everyone’s usage altogether. 

Click through to see how it works, as well as some of the caveats that are going to require foresight before this works the way you’ll want it to.

Leave a Comment

Temporary Stored Procedures in SQL Server

Louis Davidson is only here for a little while:

Pretty much every T-SQL programmer knows about temp tables very early in their journey with the language. They are generally wonderful tools that, when used properly, can be invaluable for storing data for a short amount of time. When used improperly they can be somewhat problematic, but certainly they are a tool we all use regularly.

But did you realize you can create a temporary stored procedure as well? It is not something I had ever used before, and while I remember hearing they existed a few times over the years, I had never tried them. The other day. I was creating an informal demo of some data, and once I had written the main query that listed rows that needed to be looked at, I needed a way to display the details of some rows.

I’ve worked with production code that included temporary stored procedures one time, I think. Otherwise, I’ve never used them either. But read on as Louis takes us through the utility of this concept.

Leave a Comment

Trace Flag 1448 and Replication

Garry Bargsley covers the behavior of a trace flag:

In SQL Server environments where transactional replication runs alongside Always On Availability Groups (AGs), DBAs sometimes face a frustrating scenario: replication stalls when a secondary replica or subscriber is offline for maintenance, patching, or unexpected downtime.

By default, SQL Server’s Log Reader Agent is cautious. It only marks transactions as ready for replication once they are hardened on both the primary and all replicas. This ensures consistency across the AG, but it can also cause replication to stall if an asynchronous replica or subscriber is unavailable for an extended period of time.

Click through to see how it works and what the consequences are.

Leave a Comment

Using Log Parser to Preprocess Data

Lucas Kartawidjaja gives us a blast from the past:

When dealing with data inside SQL Server, especially when it’s delimited by a clear separator character, earlier versions (before SQL Server 2016) required us to write custom parsing functions—either as T-SQL user-defined functions or CLR functions. Starting with SQL Server 2016, we can use the built-in STRING_SPLIT() function to handle most of these tasks.

However, more often than not, we need to parse data that resides outside SQL Server—for example, in log files, CSV data, or other data sources. For these cases, I often use Microsoft Log Parser, a free command-line tool available here.

Click through for a demonstration of how it works. Or a reminder, if you’ve been in the business for a long long time.

Leave a Comment

DAX: VALUES in SUMMARIZE

Marco Russo and Alberto Ferrari talk about values:

We discussed VALUES in previous articles: Choosing between DISTINCT and VALUES in DAX and Using VALUES in iterators. However, there is a third case where VALUES could be used with a table reference, which is when you use SUMMARIZE to group by columns you want to iterate. In this article, we describe this particular scenario to understand when VALUES is needed to retrieve the blank for an invalid relationship using SUMMARIZE and SUMMARIZECOLUMNS.

When you use SUMMARIZE, you may want to use VALUES over the aggregated table in case it could have an additional blank row for an invalid relationship, and you must ensure that this blank row is included. This condition is uncommon because SUMMARIZE often includes blank rows for invalid relationships that are implicitly included. For example, consider the following measure that uses SUMMARIZE over the Sales table, grouping by Customer[State] and Customer[City] to apply an adjustment to Columbus, Ohio (note that there are other cities with that name in other states):

Curated SQL tip number 17: if you want to show up here, use the best city in Ohio as a (positive) example.

Leave a Comment