Press "Enter" to skip to content

Curated SQL Posts

Three Years of PSBlitz

Vlad Drumea looks back:

In case you’re not familiar with it, PSBlitz is a PowerShell script that outputs SQL Server health and performance diagnostics data to either Excel or HTML, and saves execution plans and deadlock graphs as .sqlplan and .xdl files.

It’s based on modified non-stored procedure versions of Brent Ozar’s SQL Server First Responder Kit and Erik Darling’s sp_QuickieStore.
Along with some other custom scripts I’ve put together.

You can get more details about its capabilities and usage from my PSBlitz GitHub repo.

Read on to learn about the origin story of PSBlitz, some of the major changes that have taken place over the past three years, and a bit more on the tool.

Leave a Comment

Randomization of Personally Identifiable Information

Rich Benner tries out a couple of techniques:

The main issue we see in dev environments is that people take a nice little version of their database, a few hundred rows of data per table, and develop on that. This is great for checking that your logic is correct, but not good when it comes to actually deploying the code to production. Suddenly, your nice, pretty code has to deal with millions of rows of data and grinds to a halt because you didn’t write it for big data sets. No, you wrote it for your development system, and it was fast on your machine. We see this a lot.

Rich shows a couple of techniques for data randomization. My biggest challenge to this is that if you need a proper distribution of data, you lose it. Using the telephone number example, if you have lookups or data analysis by area code, randomly generating across every area code would be bad. Also, if your application is smart enough to deal with valid or invalid area codes and exchanges (the middle three digits of the three-three-four phone number style in the US), you generating arbitrary area codes or exchanges might prevent app developers from using the application in the proper way, perhaps requiring them to fix phone numbers after viewing a data entry screen.

In short, there are easier and harder ways to do this, and several factors may push you into the harder way.

Leave a Comment

Column Expansion and Compression

Ed Pollack goes big or goes home:

One of the most hassle-prone changes that can be made in a SQL Server database is to widen an existing column. Depending on the column’s use and data type, this process may involve hundreds of schema changes, app downtime, and a mountain of risk-prone code to review and deploy. 

This article dives into a fun (and interesting!) strategy for widening fixed-width columns in SQL Server, to reduce downtime, risk, and runtime at the time when a column’s data type needs to be changed. 

If you have ever suffered through a lengthy INT to BIGINT release, then this guide is for you! 

Read on for a step by step guide on expanding a column with minimum downtime, as well as a quick description of row- and page-level compression and how you can use those to ensure you’re using as few bytes as necessary when storing a smaller number in a larger data type.

Leave a Comment

Microsoft Fabric Features for July 2025

Patrick LeBlanc has an update for us:

Welcome to the July 2025 Fabric Feature Summary! This month’s update covers major events like the return of the Microsoft Fabric Community Conference in Vienna, and the 10th anniversary of Power BI. Key platform enhancements include new domain tags and updates to the default category in the OneLake catalog. You’ll also find highlights on data science developments, such as Fabric data agent integration with Microsoft Copilot Studio. Explore the innovations shaping the future of Fabric in this month’s edition.

Read on for a long list of new and updated features.

Leave a Comment

Using R for Forecasting in Excel

Adam Gladstone continues a series on using R in Excel:

We have already seen how to obtain descriptive statistics in Part I and how to use lm() in Part II. In this part (Part III) of the series we will look at using R in Excel to perform forecasting and time series analysis.

In the previous two parts we have seen different ways to handle the output from R function calls, unpacking and massaging the data as required. In this part we are going to focus on setting up and interacting with a number of models in the ‘forecast’ package (fpp2).

Read on for the demo. This is getting into territory that is by no means trivial to do natively in Excel.

Leave a Comment

Building a Snowflake Dashboard that Uses Filters

Kevin Wilkie does a bit of filtering:

Snowflake Dashboards can do a lot more than just show pretty numbers. Today, let’s focus on something that every data pro eventually has to deal with—filters that make navigating your dashboards less painful, especially when it comes to everyone’s favorite task: AUDITING.

Ah yes, auditing—because nothing says “data dream job” like tracing permissions. Whether it’s quarterly compliance checks or a sudden request from an overly curious auditor, somebody, at some point, will ask, “Who has access to what in Snowflake?” So let’s make that answer easy to deliver.

Click through for the process, using the development of a permissions auditing dashboard as the example.

Leave a Comment

A Setup for Powershell

Vlad Drumea shows off one way to get work done in Powershell:

This is a brief post containing my information about my PowerShell coding setup, IDE, extensions, etc.

I’m writing this mainly because, based on the reactions to my reddit comment, some people might not be aware of how helpful the VS Code + PS extension combo can be for PowerShell code writing.

This is the environment that I use to write PowerShell scripts such as PSBlitzDecode-AsusRouterConfig, and my SQL Server install script.

Click through to see how Vlad gets it done. Every time I see someone using the Powershell ISE, I feel the urge to stage an intervention, as the ISE does some really weird stuff with your Powershell environment that doesn’t make it amenable to writing good scripts. This is a much better way.

Leave a Comment

The Virtue of Pagination

Brent Ozar recommends a strategy:

When I’m tuning queries, the normal answer is to make the query perform better – either via changing the T-SQL, adding hints, or adding indexes so that the data’s better prepared for the query.

However, sometimes when I’m looking at the output of sp_BlitzCache, I scroll across to the Average Rows column and double-check that the query’s actually returning a reasonable number of rows out in the wild.

Click through for some horror stories and the benefits of pagination. Brent’s last case was a scenario in which people received 1000 rows and nobody ever complained. I’ve worked in systems where the customers did want and need every row. And in those cases, pagination still works. Because 85-90% of customers only need the first page or two.

Now, I wish that OFFSET/FETCH actually performed well. Sadly, it generally is a dog when you work with larger datasets and get past the first few pages. That’s because if you want to show rows 10,000-10,050, you first need to scan from rows 1-9999 and throw that data away, then grab the 50 rows you need. There are some clever sorting tricks you can use to reduce the pain level on repeated fetch operations, and I show one of them in this demo script (scroll down to the OFFSET/FETCH demo, number 6 in the list). The prior key approach is, in my experience, the best performer but it assumes you only move in one direction and don’t allow users to select arbitrary page numbers or go straight to the end.

1 Comment

JSON Lines Support in Microsoft Fabric

Jovan Popovic makes an announcement:

We’re happy to announce the preview of JSON Lines (JSONL) support in the OPENROWSET(BULK) function for Microsoft Fabric Data Warehouse and SQL endpoints for Lakehouses.

The OPENROWSET(BULK) function allows you to query external data stored in the lake using well-known T-SQL syntax. With this update, you can now also query files in JSON Lines format, expanding the range of supported formats and simplifying access to semi-structured data.

Click through to see it in action.

Leave a Comment

Power BI Performance Load Testing in VS Code

Gilbert Quevauvilliers wraps up a series on Power BI performance load testing:

This is the final part of my blog series for Power BI Performance testing, where I will finally run the Power BI Performance Load testing using Visual Studio Code.

In this blog post I will show you how I set up the test, run the test and view the outputs from the performance testing.

Read on for that, as well as links to the prior posts if you’re missing them.

Leave a Comment