Press "Enter" to skip to content

Curated SQL Posts

sp_CheckActivity

Andrew Kelly announces a new version of an old tool:

I initially created the first version of this utility many years ago as an alternative to the immensely popular tool developed by Adam Machanic called sp_WhoIsActive. I wanted something that would suit most of my everyday needs for a snapshot type of view of the current activity on a SQL Server instance.

I know what you are thinking: why couldn’t I just use sp_WhoIsActive? 

Well, I have used it for many years and in some cases still do when a special need arises. The main motivator for creating sp_CheckActivity was not for lack of features but…it’s more like there can be too many.

Click through for more information about sp_CheckActivity and grab a copy from the GitHub repo if you’re so inclined.

Leave a Comment

Using Batch Mode on Rowstore Indexes in SQL Server

Mehdi Ghapanvari speeds things up:

SQL Server columnstore indexes can improve the performance of aggregation queries. However, there are many cases where they are not efficient. I discussed one of these scenarios in “When Using a Clustered Columnstore Index Does Not Make Sense.” In that article, I discussed that columnstore indexes have three main features, one of which is Batch Mode Processing. SQL Server 2019 introduced a new feature called Batch Mode on Rowstore, which enables batch mode processing on Rowstore tables. In this article, I will explore this feature and explain why it is valuable in real-world scenarios.

In Mehdi’s solution, the question comes up of “Who would run an aggregation query on an OLTP system?” The answer is “everybody.” I’ve never seen an OTLP system with zero aggregation work. Perhaps these systems really do exist but some level of hybrid operation is the default that I’ve experienced.

Leave a Comment

Installing SQL Server on Linux

Dualcore DBA performs an installation:

SQL Server on Linux – one of those things that you can’t believe actually exists – two worlds you never thought would collide. For years, Microsoft and Linux were very much apart, until the announcement in 2015 that Microsoft Loves Linux. SQL Server on Linux was launched in 2017 and whilst I won’t get into the differences between the closed and open source philosophies, being a fan of both Microsoft SQL Server and Linux, I felt like I had to see what SQL Server on Linux was like.

With this in mind, let’s walk through the install process.

I’ve found that I use containerized SQL Server way more often than directly installing it on Linux. But either way, I’m still glad that it’s possible.

Leave a Comment

Optimizing Power BI Semantic Models via Column Splitting

Phil Seamark provides some advice:

Column splitting is an idea worth testing when you are looking to reduce the size of a large semantic model to potentially reduce the SKU required to host the model. The good news is, the technique can also benefit the time to load data into a model and speed up your DAX queries.

Instead of storing each complete value in one column, split the column vertically and store it in smaller pieces. Then use a DAX measure to combine the pieces back together. Those pieces often repeat more frequently, which can help Power BI compress them.

What’s interesting is how similar this approach is to financial systems from back in the day, where all money was stored as two separate integers. In that case, it was for the sake of precision and correctness rather than performance, but it’s nice to see these techniques still kicking.

Leave a Comment

Running containerd as a Kubernetes Container Runtime

Anthony Nocentino tries out containerd:

This post shows you how to install containerd as the container runtime for Kubernetes and configure it to use the systemd cgroup driver. The commands below were tested on Ubuntu Server 24.04 with containerd 2.2.1 from the Ubuntu updates repository. The exact Ubuntu package revision can change as updates are published. See the Kubernetes container runtime documentation for more about runtime requirements.

The instructions are not as bad as I originally thought they would be.

Leave a Comment

Making TOAST Work Better in Postgres

Shaun Thomas shares a story:

The performance of this table initially confused and enraged me—until I remembered about TOAST. Postgres likes to innocuously dub this backronym “The Oversized-Attribute Storage Technique” but DBAs in the field maintain a love/hate relationship with the system. Whether that’s justified is a different question.

On the surface, it’s a way to store huge blocks of data elsewhere to keep tuples small and avoid exceeding the relatively petite 8KB data page size. Postgres creates a shadow table for the bulky content, splits it up into chunks, and stores a pointer in the original row. It’s an elegant solution to a pressing issue, but there are deep performance implications.

So let’s dig into precisely why DBAs secretly dread large text-based columns, shall we?

Read on for the story and several tips to make a Postgres table with a blob of data faster.

Leave a Comment

Azure SQL DB Hyperscale versus Distributed SQL Solutions

Anna Hoffman clarifies:

In my last post, I broke down the Socrates paper, the research that became Azure SQL Database Hyperscale. Writing it made me want to tackle a question I think trips a lot of people up when they’re choosing a database: is Azure SQL Database Hyperscale “distributed SQL”? 

It’s a fair question. “Distributed SQL” has become shorthand for “the relational database that scales in the cloud,” and anything outside that bucket tends to get filed under “the relational one my company already has.” I’d rather not leave that to assumption, so here’s how I think about it. 

Read on for Anna’s take.

Leave a Comment

Lakehouse Design and Direct Lake Performance

Nikola Ilic shares some numbers:

When a Direct Lake report is slow, people open the semantic model first. They check relationships, rewrite DAX, look at the capacity metrics. In my experience, the cause usually sits one layer down, in how the Delta tables under the model were written.

That sounds like a bold claim, so I wanted to test it properly. I took one dataset of 500 million rows and wrote it to seven Delta tables. Each table differs from a baseline in exactly one way: the number of files, the row group size, V-Order, or partitioning.

The performance matters more for cold data, though when you’re dealing with a data lake, that risk goes up considerably versus a relational database platform where we try to keep as much data in cache as possible.

Leave a Comment

Preparing a Domain Controller for a Home Lab

Lee Markum continues a series on building a SQL Server 2025 home lab on Linux-based hardware:

In part 1 I described laying the foundation for the lab. This post will describe building the Windows domain controller and other machines on my Linux Mint host.

My goal was to have a realistic, production-like configuration. As a result, I wanted a domain controller, two SQL Servers in a Windows cluster and an Availability Group.

Looking back through the ChatGpt thread, I apparently started cloning the Windows Server template for the SQL Servers before I made a domain controller. I don’t know why I did that, but I wouldn’t do it that way again. I’ll give you the instructions in a better order.

Please note that domain names (example.com), subdomain names (lab), and IP addresses shown in this article are examples. Some identifying details have been changed, but the configuration and procedures remain the same.

Click through for Lee’s notes.

Leave a Comment

Removing a 4TB Table in PostgreSQL

Radim Marek drops a table:

GitLab has a public story about deleting the wrong thing. In January 2017 an engineer who was trying to restore replication wiped a data directory they believed was on the secondary. It was on the primary. The postmortem they published afterwards is still one of the better things written about a database outage.

At PGConf.EU in Valencia last week a few people from GitLab came to me with the inverse problem. They have one table, 4 TB, on a primary with ten replicas, and they want it gone, on purpose, with as little impact as they can manage. It’s an archival table: nothing writes to it, and nothing is supposed to read it.

Read on for a variety of thoughts around different ways to get to the same end state at differing levels of user impact.

Leave a Comment