Press "Enter" to skip to content

Curated SQL Posts

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

Linear Regression with R in Excel

Adam Gladstone continues a series on working with R in Excel via the ExcelRAddIn component:

In the first part of this series, I looked at using R in Excel to obtain descriptive statistics. In this second part of the series I am going to look at using R in Excel to perform linear regression, specifically using the lm() functionlm() is a real workhorse function. It can be used to carry out both single and multiple regression and different types of analysis of variance. For this demonstration I will only focus on single and multiple regression.

The workbook for this part of the series is: “Part II – R in Excel – Linear Regression.xlsx”. As before, the ‘References’ worksheet lists links to external references. The ‘Libraries’ worksheet loads additional (non-default) packages. In this demonstration, I use the datarium and broom packages. The ‘Datasets’ worksheet contains the data referenced in the worksheets.

Click through to see how you can perform ordinary least squares regression, multiple linear regression, and even logistic regression in Excel with a bit of R code. H/T R-Bloggers.

Leave a Comment

Building a Vector Data Demo Database for SQL Server 2025

Andy Yun has a new demo database:

Today, I have the honor and pleasure of debuting a new presentation for MSSQLTips: A Practical Introduction to Vector Search in SQL Server 2025 (you can watch the recording here too). To accompany that new presentation, I opted to create a new demo database instead of retrofitting one of my existing demo databases. And I’m sharing it with you so you don’t have to go through the headache of taking an existing database and creating vector embeddings.

Click through for Andy’s demo database, which is approximately 16 GB in size, so not a tiny one.

Leave a Comment

Fabric Studio 2.0 Released

Gerhard Brueckl has an update:

7 months after the first official release of Fabric Studio, I am very happy to share the I just released the next major version with a lot of new features that make working with Microsoft Fabric from VSCode better and more intuitive than ever! The release includes some new capabilities that I wanted to get into the tool since the very beginning but back then the APIs just weren’t there yet. Finally they are and I integrated them into Fabric Studio v2.0!

Click through for a quick changelog, a link to the full changelog, and where you can grab a copy of the Visual Studio Code extension.

Leave a Comment