Press "Enter" to skip to content

Curated SQL Posts

Reviewing Optimized Locking Results

Louis Tochon wants to know if optimized locking actually ran:

In the first case, SQL Server escalated the row locks to an X lock on the whole table. In the second, there is no escalation anymore, only one X lock on the transaction ID (XACT), next to the intent lock (IX) on the table (the IS lock in both results is on the small function I used to run this query).

That is nice in a demo, but on a real server nobody is looking at sys.dm_tran_locks at the right moment. I wanted to know how a DBA can check what optimized locking does once it is enabled. SQL Server 2025 has a few Extended Events for that, and I found some of their fields easy to misread and one of them reports LAQ as enabled on a database where it never ran once.

Click through to learn more.

Leave a Comment

Tips for Planning a Microsoft Fabric Solution

Paul Turley shares some tips around the various Microsoft Fabric workloads:

Fabric hands you an entire toolbox of analytics workloads. Using all of them isn’t the goal — using the right ones is.

Resist the shiny-object trap. Fabric packages Power BI, Data Factory, Data Engineering, Data Warehouse, Data Science, and Real-Time Intelligence into one platform, and it’s tempting to adopt all of them at once. Map each workload to a business problem you already have, and bring in only the pieces that solve something real today. Every workload you adopt without a real use case behind it is one more thing your team has to learn, maintain, and eventually explain to an auditor.

Click through for a half-dozen such tips.

Leave a Comment

The SQL Server Execution Plan Reference

Hugo Kornelis completes a magnum opus:

In 2017, I made the decision that SQL Server execution plans needed better documentation. I did not expect Microsoft to do this for me. And so I decided, heavily inspired by Paul Randall’s Wait Type Library, to write it myself. I purchased the domain sqlserverfast.com, migrated my blog there, and started to write the SQL Server Execution Plan Reference.

That part of the site went live on May 31, 2018, when I had finished the generic pages plus the pages on all join and aggregation operators. After that, I regularly added a page, sometimes even multiple at once, and I also frequently updated pages with new or corrected information.

Check out the amazing work Hugo has done through the years.

Leave a Comment

Things to Note for a SQL Server to Postgres Migration

Amy Abel has a list:

This week I went back through my PostgreSQL notes and listed what is different between SQL Server and Postgres. These are the things I would pay close attention to when doing a migration.

Most migration issues are not caused by the data. They come from assuming Postgres works the same way as SQL Server.

Click through for the list. Some of these things are fairly straightforward, but others can be a pretty big deal and necessitate significant rewrites of existing code bases.

Leave a Comment

Where the Business Logic Lives in Power BI

Teo Lachev answers a question:

A current engagement calls for migrating a rather elaborate financial dashboard from Qlik to Power BI. Just when we think there is light at the end of the tunnel, another business rule is unearthed in Qlik that we need to convert. These rules range from business calculations and dummy rows in dimension tables to allocation overrides.

This brings us to an important question: Where should all this business logic live?

Click through for Teo’s answer to this question.

Leave a Comment

Thoughts on Automatic Index Compaction

John Deardurff shares some thoughts:

Anyone who has managed SQL Server for a while probably recognizes the traditional 5% reorganize or 30% rebuild approach. But those Index Fragmentation Thresholds were completely made up. Primarily as they were simple values to baseline that made it easy to automate. But today we need to ask whether fragmentation percentage is really the best measurement for deciding when an index needs maintenance.

As storage has changed, Microsoft guidance around index maintenance has changed. The question should no longer be; How fragmented is my index? A better question is: How efficiently are the pages being used, and how much work is needed to access my data?

Click through for a demo of what automatic index compaction can do in Azure SQL Database. The two important notes I have are as follows. First, as John points out, automatic index compaction does not update statistics, so you’d still need to take care of that. Second, I don’t think there’s ever a good use case for REORGANIZE.

1 Comment

Building a Windows Lab Environment on Linux

Lee Markum builds an environment:

First of all, this will be a blog post series. There is simply too much to cover in one blog post and expect people to read it. This blog post is going to be about how I laid the foundation for what I was planning to build.

At the end of the process, I had a fully functional, four machine lab that looks like the below. I used Windows Server 2025 OS Evaluation Edition. I created a Windows Cluster and set up an Availability Group.

Lee points out some of the difficulties along the way, and I agree that it looks pretty frustrating.

Leave a Comment

Microsoft Fabric Tenant Settings and the Govern Tab

Heidi Hasting sees something new:

Hiya!

“Ooh, what’s this?”

That was me this week, poking around the OneLake catalog. It keeps getting better and better, and I spotted something that made my admin heart very happy. The Govern tab now has Configurations > Tenant settings, right there in the catalog.

Click through to see what’s there. It’s still not ideal for non-admin users, as Heidi points out, but it is a marginal improvement over what was there before.

Leave a Comment

Report Bursting with Fabric Dataflows Gen2

Chris Webb tries something out:

When the new Send Email action was announced for Fabric Dataflows Gen2 – which allows you to send an email from a dataflow when it refreshes – I was curious to know if you could use it to send multiple emails to multiple different people, and therefore do report bursting or something like it. There are already several different ways to do this in Power BI/Fabric, for example using Power BI report subscriptions or paginated reports, but there might some cases where using a dataflow is easier or more convenient. It turns out that is is possible but only in combination with another relatively new feature: Parameterised Dataflows.

Click through for an example that sends a batch of e-mails. Not all of the functionality is fully baked yet, but it does have the potential to be interesting.

Leave a Comment

Capturing Failed Logins in Microsoft SQL

Aleksey Vitsko keeps a list:

Our requirement is to record unsuccessful login attempts i.e. failed logins for security and compliance reasons. The database estate includes SQL Servers, Azure SQL Databases, and Azure SQL Managed Instances. How can I configure auditing for failed logins for each of these database environments?

Read on for the answer in SQL Server, Azure SQL Database, and Azure SQL Managed Instance.

Leave a Comment