Press "Enter" to skip to content

Curated SQL Posts

Shape: A Tool for Data Generation

Jonathan Stewart has a new open-source tool:

Wait, what? Didn’t you already build one of these?

I built a data generator, yes. But when I realized what profiling the data could open up, the ideas just kept coming. “With this data I could do this.” Then something else. Then something else.

The generator was only half the picture. Before I could make data behave the way I needed, I had to understand how it behaved in the first place.

Your schema tells you column names and types. It doesn’t tell you that December might bring in nearly three times February’s orders, that a small group of customers might place most of them, or that a field’s null rate might jump between two captures.

Click through for the intro article and check out the GitHub repo as well as a playground where you can try it in your browser.

Leave a Comment

The Structure of Vector Indexes

Hugo Kornelis digs into another index variant:

Support for the vector data type, vector indexes, and vector search, was added as a preview feature in SQL Server 2025 and in Azure SQL Database. In the latter, the feature has then been developed further, and moved out of preview.

There have been significant changes between the original implementation, that is still available in SQL Server 2025 (as of CU9), and the current (mid October 2026) implementation in Azure SQL Database. These differences affect the available features, the syntax to use for some features, and the internals. Especially the latter is important for those who already created vector indexes with the original implementation on Azure SQL Database. Because the new version uses a different structure, these users are recommended to migrate from that earlier version to the new version. Click this link for more information.

In this post, I will look at both the original implementation, as still available in SQL Server 2025, and at the current implementation in Azure SQL Database, pointing out similarities and differences where needed.

Click through for a theoretical explanation of when vector operations are relevant as well as how SQL Server and Azure SQL DB actually store this information. Hugo may apologize for how long the post is, but on his behalf, I highly recommend giving it a read.

Leave a Comment

When ApproximateDistinctCount is Slower than DistinctCount in DAX

Chris Webb explains the paradox:

As a follow-on from last week’s post about the new ApproximateDistinctCount function in DAX, I want to share something I found out from my recent testing for this function: ApproximateDistinctCount is sometimes slower than DistinctCount. This sounds counter-intuitive, right? After all ApproximateDistinctCount is a performance optimisation for the sometimes slow, expensive DistinctCount function. But it turns out that there are certain engine optimisations for DistinctCount that can’t be replicated for ApproximateDistinctCount which mean that for low-cardinality columns using DistinctCount can be faster.

Click through for an example.

Leave a Comment

Using Managed Identities to Write Backups to Azure

Warwick Rudd continues a series:

In Part 1 we built somewhere safe to put the backups: a storage account with a delete lock and a container with a time-based retention policy.

The next problem is getting SQL Server to write to it without giving it a password. That’s what the Managed Identity is for. The VM gets an identity in Microsoft Entra ID, SQL Server uses it to authenticate to storage, and there’s no SAS token or storage key anywhere to steal, rotate or forget about.

There are a few moving parts to get there, and most of the time spent on this is in Entra ID and networking rather than SQL Server.

Read on to see what needs to happen.

Leave a Comment

Stories of Risk and Reward

Steve Jones shares a few stories:

Most of the time that I have had to consider risk and reward in the past relates to the effort to fix a problem. Not necessarily the time, or data loss, because those are factors that are secondary to me to the ability to get a fix in. Time can matter, but if the organization has a tolerance for time, then I can work with that.

This also goes to whether the organization is willing or likely to try to fix things, or even if they are willing to let me fix things. If not, then I am way more careful about how to approach a design decision.

Click through for those stories.

Leave a Comment

CI/CD for Report Development

Eugene Meidinger checks in some reports:

Continuous Integration / Continuous Delivery (CI/CD) is the software development practice of constantly having new features and changes be saved and brought into a shared environment (integration) and then built into a state for testing and review (delivery). This is in contrast to doing all of your report development in a single PBIX file, making a large batch of changes, and then deploying them all to production.

It’s tempting to assume that these practices are only for large enterprises or professional software companies. In this article, we argue that many CI/CD and related practices form a maturity ladder you can climb, incrementally. Even basic steps can be useful. This is true even if you are the only developer in an organization. To use an analogy, you should still wear a seatbelt even if you aren’t a professional racecar driver.

Click through for Eugene’s advice. Granted, the amount of applicable advice when you’re working with Power BI Report Server is…less.

Leave a Comment

Upgrading PostgreSQL on Debian Linux

Dualcore DBA uses pg_upgradecluster:

In my previous post, we upgraded a PostgreSQL 15 cluster to version 18 using pg_upgrade. In this post, we’ll contrast that with using pg_upgradecluster.

As before, the upgrade process is:

  • Install new version of PostgreSQL
  • Upgrade the existing cluster to the new version
  • Remove the old cluster

Note that we have one less step than the pg_upgrade version, that step being creating the new cluster.

Read on for some attempts and some pain points in the process.

Leave a Comment

Near-Zero Downtime Database Schema Changes in MySQL

Lukas Vileikis makes some changes:

Every growing application eventually faces the same challenge: your database schema needs to change, but your users can’t afford the downtime. Whether you’re adding a column, creating an index, or restructuring a table with billions of rows, schema changes can lock tables, strain server resources, and disrupt live traffic if handled carelessly.

The good news is that MySQL offers several ways to make these changes while keeping your database online and responsive. This guide breaks down the main causes of schema-change downtime and walks through the tools and techniques — from built-in online DDL to third-party utilities like Percona Toolkit and gh-ost — that let you evolve your database safely without taking your application offline.

Click through for some thoughts and recommendations.

Leave a Comment