Press "Enter" to skip to content

Curated SQL Posts

Performing PostgreSQL Version Upgrades

Warda Bibi upgrades a server:

Upgrading to the latest version ensures long-term stability, access to new features, and better support. Recently, I worked on upgrading a critical production PostgreSQL environment from version 11 to 15. Version 15 was chosen because the client’s application had only been tested up to that release.  The system supported large batch workloads and live applications, so we had to be meticulous. While this article draws from that specific project, the steps are broadly applicable to anyone planning a major PostgreSQL upgrade, especially when crossing several versions.

This guide outlines a generalized, production-ready approach for performing major version upgrades using the pg_dump/pg_restore method.

Click through for two upgrade methods and some of the things to keep in mind during the process.

Leave a Comment

OneLake Security and Shortcuts

Aaron Merrill explains how OneLake security works when you introduce shortcuts:

OneLake allows for security to be defined once and enforced consistently across Microsoft Fabric. One of its standout features is its ability to work seamlessly with shortcuts, offering users the flexibility to access and organize data from different locations while maintaining robust security controls. In this blog post, we will look at how OneLake security is integrated with shortcuts, explain the distinction between passthrough and delegated auth modes for shortcuts, and look at an example use case.

Read on for an overview of OneLake shortcuts, as well as different security models around them.

Leave a Comment

Explaining Logins vs Users in SQL Server

Kevin Hill explains that there are two wolves inside your SQL Server:

“We added them to the database, but they still can’t connect.”

Sound familiar? That’s the kind of confusion SQL Server’s two-layer security model creates when people don’t understand the difference between a login and a user.

Let’s clear that up, because getting it wrong causes broken access, orphaned users, and frustrated help desk calls.

Click through for Kevin’s explanation.

Leave a Comment

Explaining Cost in Oracle

Kellyn Gorman knows the cost:

When you first begin your journey into Oracle performance tuning, you quickly discover that you’re not just working with databases, you’re deciphering a complex system of rules, statistics, and estimations.  I was reminded by Connor McDonald in a post he made on LinkedIn about one of the most influential turning points in my career as a database professional came when I encountered Wolfgang Breitling’s 2003 paper – A Look Under the Hood of the CBO: the 10053 Event. At a time when I was focused on tuning queries for speed, Breitling’s work redefined how I thought about cost, and more importantly, how Oracle thinks about cost.

Click through for more information. Although SQL Server’s cost estimation process is different, the underlying reasoning and many of the mechanisms involved are the same.

Leave a Comment

Top DAX Functions to Know

Annamarie Van Wyk builds a top 5 list:

If you’ve dipped your toes into Power BI, chances are you’ve come across DAX and thought, “Wait, what now?” You’re not alone. DAX (short for Data Analysis Expressions) is the formula language that makes Power BI so powerful—but it can be a bit intimidating when you’re just starting out.

The good news? You don’t need to master all of it to start seeing results. In fact, there are a few Power BI DAX functions that will do most of the heavy lifting in your reports. In this post, I’ll walk you through five essential DAX functions that every Power BI analyst should know. These aren’t just helpful—they’re game-changers once you get the hang of them.

Click through for that list, including simple examples of each.

Leave a Comment

Mirroring in Microsoft Fabric

Swetha Mannepalli explains how mirroring works in Microsoft Fabric:

Data is complex. It’s often scattered across multiple systems, stored in various formats, locked in silos and changing all the time — making it difficult to harness its full potential. Bringing this data together to power AI and BI workloads typically requires time-consuming ETL processes, custom pipelines, and deep technical expertise. There’s no simple way to get started…until now. 

Click through for more details. And I get the complaint that the term “mirroring” has a different meaning in SQL Server, and that Fabric mirroring from a SQL Server instance doesn’t actually use the mirroring technology that has been deprecated since 2012 but still remains in the product because reasons. But in fairness, there are only so many synonyms people can use. Which means, three years from now, marketing will rename the feature to “replication.”

Leave a Comment

Retrieving Child Records with APPLY

I have a new video:

In this video, I show how we can use the APPLY operator to find records associated with a “parent” table. We look at getting the latest record, as well as any arbitrary number of records. We also spend time digging into under what circumstances the APPLY operator out-performs other common options.

During the outro segment, I dig into under what circumstances APPLY is the best tool for the job, so stick around for the end.

1 Comment

Using Filtered Indexes in SQL Server

Stephen Planck explains the value (and limitations) of filtered indexes:

When a table holds millions of rows yet most queries touch only a small, well-defined subset, a traditional non-clustered index feels like using a searchlight to find something sitting under a desk lamp: the index still stores an entry for every row even though the workload rarely needs most of them. SQL Server’s answer is the filtered index—introduced in SQL Server 2008 and still under-used today—allowing you to index just the rows that match a predicate you supply in a WHERE clause.

I always thought I would get more value out of filtered indexes. Instead, they’re very useful for specific circumstances, but not the all-purpose performance dynamos you’d want them to be, particularly because of the limitations.

Leave a Comment