Press "Enter" to skip to content

Curated SQL Posts

What’s New in R 4.6.0

Russ Hyde has a summary:

R 4.6.0 (“Because it was There”) is set for release on April 24th 2026. Here we summarise some of the more interesting changes that have been introduced. In previous blog posts, we have discussed the new features introduced in R 4.5.0 and earlier versions (see the links at the end of this post).

Once R 4.6.0 is released, the full changelog will be available at the r-release ‘NEWS’ page. If you want to keep up to date with developments in base R, have a look at the r-devel ‘NEWS’ page.

Click through for the highlights.

Leave a Comment

Applying the Pareto Principle to Query Store

Erik Darling channels an Italian economist:

In this video, I dive into an old-school approach to identifying SQL Server performance issues using SP Quickie Store and a novel method inspired by the Pomodoro [“Pareto” – ed] technique. Traditionally, Query Store surfaces queries that consumed a lot of CPU over the last seven days, but often these results are too broad for practical use. To address this, I’ve developed a multi-dimensional scoring system that evaluates queries based on their impact across several key metrics: CPU usage, duration, physical reads, writes, and executions. This approach helps pinpoint the most problematic queries more accurately, even when they run outside of typical working hours or are unparameterized. By sharing these insights, I hope to provide a practical tool for SQL Server administrators looking to optimize their databases without relying solely on modern monitoring tools.

The AI generated summary reminds me that I’ve been working for 25 minutes, so time to take a break.

I like the idea of calculating and calculating & displaying impact scores, as well as breaking it down into core components.

Leave a Comment

Preventing SQL Injection in Stored Procedures

Vlad Drumea fixes a procedure:

In the past few years, I’ve seen quite a few stored procedures that rely on dynamic T-SQL without properly guarding for SQL injection.

Some cases were reporting stored procedures, while others were maintenance type stored procedures (e.g. stats updates) that could be kicked off from the app, or even stored procedures that handled app upgrades/patching.

In all these cases, certain portions of the dynamic T-SQL relied on input provided by users via input parameters.

Read on for an example. The solution is still the classic combination of QUOTENAME() and sp_execute_sql whenever you have user input.

Leave a Comment

When Fabric Mirroring Doesn’t Copy Rows

Koen Verbeeck troubleshoots an issue:

A short blog post about an issue with Fabric Mirroring (with Azure SQL DB as the source) that I’ve managed to run into, twice. I’ve set up mirroring by creating a connection using a service principal and this principal has the proper permissions on the source database. Configuring the replication was without issues, and the replication status went from “starting” to “running”. However, no rows were being copied. The tables were all listed in the monitoring pane, but the counters of “rows replicated” remained at zero. There were no errors in the logs (in OneLake) and nothing suspicious was mentioned in the monitoring.

This was a rather pernicious issue. Based on Koen’s explanation, it sounds like there’s no way to know what the actual problem was.

Leave a Comment

Tracking Changes in Power BI Semantic Models

Jens Vestergaard wants to know who moved his cheese:

Semantic models do not have version control. Not really. You can store .pbip files in Git, and Tabular Editor gives you a .bim file you can diff, but neither of those workflows answers the simplest question a team asks after an update cycle: what changed?

I do not mean “which file was touched.” I mean: which measures were modified, which columns were added, which relationships were removed, and what exactly is different in the DAX expression that someone edited last Tuesday. That is the question I kept running into, and the one I built this notebook to answer.

Click through to learn how.

Leave a Comment

Splitting to Table via STRING_SPLIT() and REGEX_SPLIT_TO_TABLE()

Greg Low might have violated Betteridge’s Law of Headlines:

Using T-SQL it’s quite easy to build a table-valued function that can step through a string, character-by-character, and (based on a delimiter) output the delimited strings. The problem is that the performance of these functions is appalling.

When XML support appeared in SQL Server 2005, there were many attempts to create more efficient string-splitting functions. For many strings, these work quite well, but do have a few oddities that you need to cope with. Plus, most have limitations on the strings that you can split.

Ultimately, what was really needed was an efficient and native built-in function.  

Greg points out two mechanisms and contrasts them.

Leave a Comment

Improving Line and Trend Charts in Power BI Reports

Ruben Van de Voorde shares some tips:

Line charts plot a metric along an ordered axis. Usually that axis is time, which is why they’re the first thing most people reach for when the X axis is a date. They show direction, speed and rhythm in a way that tables and bar charts don’t. That ordering is the key requirement: for unordered categories like regions or product types, connecting the points implies a sequence that isn’t there, and a bar chart is the clearer choice.

Power BI makes line charts easy to build: pick a date column, pick a measure, maybe split by a category, and you are done. The result is technically correct, but maybe not as clear as it could be. This article walks through the most common ways a line chart falls short and how to fix them.

There’s a lot of solid advice and good examples in here.

Leave a Comment

“Analyze data with” Updates in Microsoft Fabric

Tzvia Gitlin Troyna shows off some new functionality:

As Microsoft Fabric continues to converge analytics experiences across workloads, one of the most important steps forward is reducing friction in how users move from raw data to insights. With the latest integrations, the Eventhouse Endpoint is now deeply embedded into the “Analyze data with” entry points across LakehouseData Warehouse, and Eventhouse, bringing a consistent, discoverable, and powerful way to analyze data using SQL Endpoint and Notebooks, both new and existing.

Click through to see what this means. This is a preview feature, but it does help tell the story a bit better around Fabric being a coherent entity rather than a bunch of products slapped together.

Leave a Comment

Vertical Partitioning for Performance

Eran Golan splits out a table:

Not long ago, I worked with a customer who was experiencing persistent blocking and occasional deadlocks in one of their core systems. The application itself wasn’t new, but over the years it had grown significantly. New features had been added, more processes were interacting with the database, and naturally the schema had evolved along the way.

One table in particular stood out. It had gradually grown to contain well over a hundred columns. Originally it had been designed to represent a single business entity in one place, which made the model easy to understand and query. But as more attributes were added over time, the table became increasingly wide.

Frankly, based off of Eran’s description, this sounds like a failure in normalizing the table appropriately. Normalization is not just about “There are many of X to one Y, so make two separate tables for X and Y.” In particular, 5th normal form (keys imply join dependencies) tells us that, if we can break out a table X into X1 and X2, and then join X1 and X2 together without losing any information or generating spurious new information, then 5NF requires we break it out. Eran is describing in narrative exactly that concept, though the description of how the customer broke that data out may or may not have satisfied 5NF.

Leave a Comment

PDF Storage via FILESTREAM and FileTable

Garry Bargsley hits us with a blast from the past:

Hello, dear blog reader. Today’s post is coming to you straight from the home office, ready to talk about a topic that comes up more than you’d think: storing PDF documents inside SQL Server.

Whether it’s invoices, reports, scanned forms, or contracts, applications often need somewhere to park files. You could store them on a network share and hope nothing breaks the link, or you could pull them fully into SQL Server where they live alongside your data. In this post, I’m going to walk you through setting up FILESTREAM and FileTable in SQL Server, a feature set that gives you the best of both worlds: transactional integrity from SQL Server and file system performance from NTFS.

I really liked FileTable when it came out, though I don’t believe we ever saw much in the way of additional functionality around FileTable post-2012.

The main challenge I have with FILESTREAM today is that there are too many better places to put documents. There are very few and specific circumstances in which the technology makes sense in a world where block storage in a cloud is cheap and document storage applications are plentiful if you actually need them.

Leave a Comment