Press "Enter" to skip to content

Curated SQL Posts

Optimizing Planned Availability Group Failover in SQL Server

Aaron Bertrand shares some advice:

Shaving even a handful of seconds from the process can improve the application and end user experience; it can also drastically reduce alert noise or, at least, how long alerts have to stay muted. There’s a lot of material out there about performing AG failovers correctly (no data loss), but far less that focuses on shortening the disruption window. The difference is usually some combination of redo volume, checkpoint behavior, open transactions, and secondary readiness.

I wanted to share some techniques I use to make planned failovers faster and more predictable. Some of these techniques are well documented, while others come from real-world patterns I’ve observed across many SQL Server environments. I’ll talk about what I do before, during, and after the failover to minimize disruption and increase the chance that end users are oblivious that anything happened.

Aaron provides several tips to help reduce the pain of failover.

Leave a Comment

An Overview of the Fabric Unified Admin Monitoring Tool

Rob Sewell lays out some information:

When you are responsible for a Microsoft Fabric tenant, it will not be very long before you are facing many questions.

Questions like:

  • How is my capacity being used?
  • Which workspaces are consuming the most resources?
  • What are my users actually doing?
  • When are my peak usage times?

You can scabble around in the Admin portal and try to piece together the answers, but it is a bit like trying to navigate a city with a paper map — you can get there eventually, but it is slow and painful, and you will probably miss some things along the way.

Read on to see how FUAM can help answer these sorts of questions.

Leave a Comment

An Introduction to Transactions in SQL Server

Paul Randal hits us with another blast from the past:

One of the most fundamental concepts in any relational database management system (RDBMS), such as SQL Server, is the transaction. During my consulting career, I’ve seen many instances of performance problems caused by developers not understanding how transactions work in SQL Server, so in this tutorial, I’ll explain what transactions are and why they’re necessary, plus some details of how they work in SQL Server. There are nuances to some of this when Accelerated Database Recovery (ADR) is in use – topics for future articles.

One thing that Paul does not point out here but has done in other places is just how bad the implementation is for nested transactions in SQL Server. They’re very limited in nature, so the best advice there would be not to use them at all.

Leave a Comment

Opening the VS Code Terminal in a New Window

Andrew Pruski splits things out:

A while back I wrote a quick post on setting up key mappings in Visual Studio Code…they make presenting (and generally working) in Visual Studio Code really smooth.

But one thing that kinda bugs me is the location of the terminal…I’ve always had it at the bottom, which is generally fine, and I know you can move it around (top, right, left)…however I’ve found that when presenting, space is at a premium. I bump up the font size and this can result in a lot of scrolling through results in the terminal, which ain’t great.

Read on to see how you can make the integrated terminal a separate tab.

Leave a Comment

Building a Graph for Its Takeaway

Cole Nussbaumer Knaflic reminds us that visuals should have purpose:

I was facilitating a workshop recently when someone asked one of my favorite questions about a graph on the screen: “So… what are we supposed to take away from this?”

Such a simple—and useful—question.

One challenge was that the graph was attempting to show multiple comparisons at once, so it wasn’t clear what mattered most. To further complicate things, the data in question spanned very different magnitudes, with one category dwarfing the rest.

Click through for a demonstration and how changing the visual layout can affect the message. The challenge I tend to run into is that, when I’m developing a visual for an application or a report, I don’t know what the precise message should be at that moment in time. I have to design with an idea of the data, but what actually emerges will depend upon what data is in there. Tailoring a visual for a specific message at a specific point in time is a lot easier when building a presentation, but it gets tricky when you’re building an application for the long haul.

Leave a Comment

The Makeup of an 8KB Page in PostgreSQL

Radim Marek takes us through the structure of a page:

If you read previous post about buffers, you already know PostgreSQL might not necessarily care about your rows. You might be inserting a user profile, or retrieving payment details, but all that Postgres works with are blocks of data. 8KB blocks, to be precise. You want to retrieve one tiny row? PostgreSQL hauls an entire 8,192-byte page off the disk just to give it to you. You update a single boolean flag? Same thing. The 8KB page is THE atomic unit of I/O.

But knowing those pages exist isn’t enough. To understand why the database behaves the way it does, you need to understand how it works. Every time you execute INSERT, PostgreSQL needs to figure out how to fit it into one of those 8,192-byte pages.

It is a little wild how three of the largest relational database systems use 8KB pages. I know that, on the SQL Server side, they’ve experimented with different page sizes internally and have repeatedly said that, even recently (the last time I heard this was maybe about 3 years ago at a SQL Saturday), there just isn’t a benefit from moving away from 8KB. But what’s in those 8KB differ, and Radim goes into details on what’s in PostgreSQL.

Leave a Comment

SQL Server Transaction Log Architecture

Paul Randal re-continues a series:

In the first part of this series I introduced basic terminology around logging so I recommend you read that before continuing with this post. Everything else I’ll cover in the series requires knowing some of the architecture of the transaction log, so that’s what I’m going to discuss this time. Even if you’re not going to follow the series, some of the concepts I’m going to explain below are worth knowing for everyday tasks that DBAs handle in production.

Note: as I progress through this series and talk about aspects of the log, there are often little edge-cases or weird behaviors in niche circumstances that have been added or changed over the years. I’ll ignore those unless I specifically want to call them out, otherwise the posts would be riddled with rat-holes and mazes of twisty-turny little passages (yes, I loved ’80s text-based adventure games 🙂 that would distract from the main things to learn about in each post.

Click through for a primer on virtual log files, log blocks, and log sequence numbers.

Leave a Comment

Official Support for fabric-cicd Tool

Yaron Pri Gal announces support for a library:

Today, we’re announcing that fabric‑cicd—the open‑source Python deployment library for Microsoft Fabric—is now an officially supported, Microsoft‑backed tool for CI/CD automation across Fabric workspaces.

Over the past year, fabric‑cicd has rapidly evolved through collaboration with engineering, CAT, MVPs, enterprise customers, and the community. Growing usage, strong sentiment across internal and external channels, and adoption by organizations building enterprise‑grade deployment pipelines helped solidify its value within the Fabric ecosystem.

Read on to learn what this means.

Leave a Comment

Comparing Techniques for Text Featurization in Classification Problems

Ivan Palomaras Carrascosa tries a few things:

In this article, you will learn how Bag-of-Words, TF-IDF, and LLM-generated embeddings compare when used as text features for classification and clustering in scikit-learn.

Topics we will cover include:

  • How to generate Bag-of-Words, TF-IDF, and LLM embeddings for the same dataset.
  • How these representations compare on text classification performance and training speed.
  • How they behave differently for unsupervised document clustering.

Click through for results. Granted, the specific embedding model can alter the quality of results, but even so, I do enjoy the comparison of techniques and the reminder that neural networks aren’t the ultimate solution to everything.

Leave a Comment

A Review of the Portmanteau Theorem

Ben Smith digs into a theorem:

The Portmanteau Theorem provides a set of equivalences of weak convergence that still remains relevant for establishing asymptotic results in probability and statistics. While the theory around weak convergence is well developed, I was inspired to put together a writeup proving all the equivalences in a self contained manner, by first presenting the relevant theorems applied (without proving them) along with along with a visual on the implication cycle created for the proof and some discussion about other presentations available in popular textbooks and some historical notes.

Click through for the PDF.

Leave a Comment