Press "Enter" to skip to content

Curated SQL Posts

What Was New for T-SQL Developers in SQL Server 2016

Jeff Taylor hits us with a few things:

For background, 2016 is the release where SQL Server started meeting developers where they already were. JSON came in. Security moved closer to the data with Always Encrypted, Dynamic Data Masking, and Row-Level Security. And for the first time, we got a built-in flight recorder for query performance with Query Store.

There’s a lot here, so let’s get started.

Jeff points out DATEDIFF_BIG(), which I had not used and did not know existed. In return, I would like to point out FORMATMESSAGE(), a function that I believe more people should know about. The downside to FORMATMESSAGE() is that there is no native date translation, so you’d have to convert dates to strings. But the upside is that you get f-string style support for writing outputs in T-SQL

Leave a Comment

The Pricing Trade-Off of On-Demand Microsoft Fabric Billing

Nikola Ilic takes F0 for a spin:

Most Fabric projects start with the same question: which SKU? F2, F8, F64? Basically, you had to pick a capacity before you knew your workload, and then live with that guess (or scale up/down if you chose the pay-as-you-go model).

On-demand billing, announced at FabCon Barcelona a few weeks ago and now in preview, changes the order. You can create an F0 capacity with zero provisioned CUs and pay only for what runs! You can also keep your existing capacity and move a single workload, such as Data Warehouse, to on-demand.

Instead of paying for a capacity whether you use it or not, you pay for the CU-hours you consume, at a rate that depends on the workload.

Two things work differently from provisioned capacity: there is no smoothing, and the rate ranges from 1x to 3x the pay-as-you-go price. Below are the mechanics, four real-life examples, and where on-demand saves money and where it costs more.

Click through for those scenarios and what each means for your wallet.

Leave a Comment

Finding Which Connections You’re Using in Microsoft Fabric

Greg Low performs a test:

I work with a lot of connections in Microsoft Fabric and one of the operations that’s still surprisingly hard, is working out if you can delete a connection that you think is unused. Back in Azure Data Factory and tools like it, I can directly see how many places a given connection is configured. But Fabric doesn’t show that.

But Greg has a fix for that.

Leave a Comment

Managed Identity per Database in Azure SQL DB

Pratim Dasgupta announces a new preview feature:

Say you’re building an AI assistant that answers questions about your customers’ shipments. Each customer has a database in Azure SQL Database and a private blob container full of files. The assistant doesn’t follow a fixed code path: what it reads depends on the question it’s asked. You’d like the boundary between Customer A’s files and Customer B’s to hold even if something above the database goes wrong.

Azure SQL Database can now draw that boundary at the database level. In this public preview, CREATE DATABASE SCOPED CREDENTIAL can use a managed identity that belongs to a single database, with external tables and OPENROWSET as the first features that use it. Software providers and enterprises can keep many databases on a shared logical server and still give each one its own storage permissions.

Click through to learn what was there before, why it isn’t enough, and what this provides.

Leave a Comment

Questions to Ask before Ingesting from an API

Andy Brownsword has a few questions:

Approaching new data sources for ingestion provides a wealth of freedom in how we tackle them. I’m fond of iterative design from the trenches, but for complex APIs it can be the wrong move. I find it useful to take a step back and answer these 3 questions before designing the right approach.

Recently I’ve been toying with the API for Octopus Energy and like most APIs it had its quirks when you get under its skin, so I’ll show how these questions were answered in that context.

Click through for three such questions.

Leave a Comment

The Cost of T-SQL Snapshot Backups on AG Secondaries

Andrew Pruski issues a revision:

In a previous post I talked about how we can use T-SQL Snapshot Backups to take application consistent snapshots of secondary replica databases. This gets around having to freeze IO on the primary database and I finished the post by saying…

But there we have it, a way to take application consistent snapshots of databases without having to worry about the effects of a stun on our applications.

Hmmmm…but does stunning/freezing/quiescing IO on a secondary really have no effect on transactions on the primary?

Read on for the answer.

Leave a Comment

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.

1 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