Press "Enter" to skip to content

Curated SQL Posts

A Look at Microsoft’s New Copilot Strategy

Teo Lachev takes a look:

Microsoft’s expanding family of Copilot experiences has caused plenty of confusion and frustration. For example, one enterprise customer recently complained that its users lost access to a Copilot experience they had been using under Microsoft 365 E5. The confusion has spread to Fabric, where copilots, agents, and other exotic creatures seem to multiply by the month.

I admit I’ve been skeptical about the value AI brings to data analytics beyond Q&A and automated insights, but clients are reporting useful results. One client, for example, values Copilot for executives who don’t have time to browse reports but can get quick answers by asking specific questions about their data.

It would appear that they are moving away from having 150 different Copilots, all of which suck, to having a small number of Copilots that might suck a bit less. Read on for Teo’s experience with Fabric IQ.

Leave a Comment

The QUALIFY Operator in Spark SQL

Koen Verbeeck looks at a bit of non-standard syntax:

Once upon a time I had a series about some cool stuff in Snowflake: features in their SQL dialect that were not available in the T-SQL dialect at the time (and some still aren’t). I followed up with some posts about interesting Fabric features (some of them are more “ironic” in nature as they describe extremely basic features who were originally missing in Fabric, like folders).

Recently I started working with Databricks on a project, and I mainly have to use the serverless SQL endpoint. Like Snowflake, Databricks also has a pretty amazing SQL dialect. In this blog post, I’m going to talk about one of my favorite new additions to the world of window functions: QUALIFY.

QUALIFY has been around since the Teradata days and it filters window functions in your SELECT statement. That makes it pretty useful, as it means you don’t need common table expressions or sub-queries to filter the results of a SQL query using a window function, like getting records where the RANK() is in the top 3.

Leave a Comment

Working with Latch Contention in SQL Server

M A A Mehedi Hasan gets into latches:

As a DBA, you are often vigilant to the common suspects like blocking, deadlocks, or long-running queries. Sometimes, performance issues creep in silently due to latch contention. When it overwhelms, even the most optimized queries may crawl. This article explores what SQL Server latch contention is, how latches differ from locks and how to detect latch issues. Then we will simulate a latch contention scenario and check best practices to minimize its impact on your SQL Server database.

Read on for notes around what latches are and how they differ from locks, why you might get latch contention, and a few ways you might be able to resolve contention issues if you have them. I will say that, in my own experience, latch contention typically wasn’t that big of a deal, in the sense that people make databases slow in other ways long before latch contention becomes the primary issue.

Leave a Comment

Digging into Microsoft Fabric Semantic Views

Eugene Meidinger and Ruben Van de Voorde lay out the purpose of semantic views:

Semantic views are a new type of object you can create in a Fabric lakehouse, where you specify business meaning in YAML. This YAML can identify the tables and relationships as well as contain the DAX for defining metrics. Semantic views are one way Microsoft is implementing the Apache Ossie format, which allows for greater portability for semantic modeling. This represents a shift in how Microsoft has traditionally handled semantic models, which is as self-contained units.

Read on to see what they are, how they work and what it means for Fabric developers.

Leave a Comment

Fuzzy Matching in SQL Server

Warwick Rudd looks at a few functions:

Every organisation I work with has the same customer in its database three times: “Jon Smith”, “John Smith” and “John Smiht”. Regex can tell you whether a value is well formed. It can’t tell you that two values are probably the same thing. That’s the job of fuzzy string matching, and SQL Server 2025 now has it built in.

I will say that I needed to turn on “preview features” for SQL Server 2025 CU11 in a container, though they did announce recently that these functions are GA. It might be a difference in the container versus other installations, or maybe it’ll be totally GA in CU12.

Warwick digs in a bit into the calculations and also points out that this is going to be fairly expensive because of the nature of the comparison. You likely won’t notice on a few thousand rows, but if you have millions of rows, performance will not be great at all.

Leave a Comment

Validating GPS Coordinates in SQL Server

Muhammed Imran prevents errors:

TL;DR: To validate GPS coordinates in SQL Server, stage the raw latitude and longitude as text, check each value’s format and range, log failures with a rejection reason, and only then pass the accepted pairs to geography::Point().

This stops malformed values, such as the word “north”, a blank longitude or a latitude of 95, from breaking your load, and it lets you run distance queries on clean spatial data.

This article follows 12 fictional service locations from raw input to a “within 10 km” search. It also shows the one thing numeric validation can’t catch: a swapped latitude and longitude that passes every check.

Click through for the demo.

Leave a Comment

Using S3 Object Locks for Write-Once Read-Many Storage

James Gallagher takes advantage of immutable storage:

Write Once, Read Many. WORM storage used to mean a physical appliance, usually expensive, usually managed by a vendor, often a pain to integrate with anything. S3 Object Lock gives you the same guarantee natively on objects stored in S3, backed by the same durability story as the rest of S3, and configurable down to individual object retention periods.

It’s one of the more useful compliance features AWS has shipped, and despite it being announced at AWS re:Invent 2018, it is still very much underutilized. Maybe that’s because people don’t quite understand the two modes and when to use each.

Click through for an explanation of how it works, where you can get yourself in trouble, and the benefits you can gain from this. Microsoft is making a push for immutable backups in Azure, and they have similar types of object locks, making this a solid plan for ransomware-proofing your backup strategy, even if your systems are on-premises. Just make sure to do the math on how much it’ll cost you, as any mistakes you make are permanent until the files roll off.

Leave a Comment

The Death of the DBA, Again

Daniel Calbimonte adheres to Betteridge’s Law of Headlines:

So, what is the impact to DBAs?

Here are several questions about how AI could impact the DBA profession:

  • Is the DBA career dead?
  • Is it safe to study a DBA career?
  • Is the cloud affecting the DBA jobs?
  • What can AI do for the DBAs?
  • What is AI unable to do yet?
  • What does the US bureau of labor statistics say about the DBAs and Database architects?

The way I describe things is, what DBAs do today is not a perfect match for what DBAs did 10, 20, or 30 years ago. The specific mechanisms change, the expectations around the role change, and even the tooling and database platforms change. But what doesn’t change is the need for availability, resiliency, disaster recovery, and responsiveness. All of these things are what good database administrators support, whether that’s in SQL Server, Postgres, Databricks, Snowflake, Firebase, or wherever else. What you can control will depend on the underlying platforms, but the big picture is that there are a lot of companies with a lot of data and, as long as access to data retains some amount of business value, there will be room for people to manage where the data gets stored.

“Is the role of DBA dead?” is a different question from “Will I have a job as a DBA?” That answer has a bit more nuance because the opportunity cost of maintaining you (or someone you know) as a DBA.

Leave a Comment

Availability Groups with a Local Service Account

Dualcore DBA doesn’t need your Active Directory trees:

This post is a follow-on from my previous post where we set up a SQL Server Availability Group on a Windows domain. In this post, we’ll run through the process again but this time, our instances will be running under local service accounts and so the process is slightly different. As in the previous post, both instances I will work on are SQL Server 2022 Developer Edition and so benefit from Enterprise Edition features.

Read on to see how the process differs from a scenario with Active Directory.

Leave a Comment

The Importance of Blocking in Databases

Louis Davidson explains why we suffer:

Nope, this is not a clickbait title (ok, well sort of). Blocking is good….otherwise SQL Server (and all the other database platforms would eliminate it for good. And before you say something about a pure MVCC implementation like SQL Server implemented with in-memory OLTP… there is no blocking, but in place of blocking you can do a lot of work, perhaps hours, and when you go to commit, it fails… blocking is better than that in any case where you are doing large transactions.

Read on for the nuance. I fully agree with Louis on this, with the caveat that SQL Server, by default, does too much blocking due to its Read Committed isolation level. A default of Read Committed Snapshot Isolation would have been a good switch about 15 years ago.

2 Comments