Press "Enter" to skip to content

Author: Kevin Feasel

Row Own-Goals

Hugo Kornelis didn’t come up with quite as good of a title:

In part 1 of this mini-series, I explained what a rowgoal is and how it works to optimize a query with a TOP or FETCH expression. Part 2 then showed a few less obvious other cases where the optimizer might introduce rowgoals. In all cases so far, those rowgoals were beneficial. They helped the optimizer come up with the best execution plan for the number of rows requested.

Click through for the video.

Leave a Comment

Thoughts on SELECT *

Louis Davidson defends a slighted bit of syntax:

I was about to walk out the door to take a flight, when my phone rang. Our major software system we had just released last week was returning weird data. FirstName and LastName was being reversed. I missed my flight because someone wrote SELECT * instead of SELECT FirstName, LastName and a table structure was reorganized.

Ok, the story was a fabrication, but I wanted to start out with a story that could resonate with the reader. In this post, I want to say a few things about the use of SELECT * and I wanted to make sure it was clear that I am not encouraging more use of SELECT *. Not at all.

I agree with Louis that SELECT * is fine for ad hoc querying. It’s not so great for application code because of the story Louis tells above, but if you’re just checking the contents of a table, whatever. The habit I’d much rather drill into somebody’s head is always have TOP in an ad hoc query. Condition yourself to write SELECT TOP(100) before you start a query. Or have your auto-completion tool of choice (e.g., SQL Prompt) do it for you.

As far as SELECT * or SELECT 1 in EXISTS clauses goes, I used to be in Louis’s camp, though I had a former manager who explained her preference for the latter: if you standardize on SELECT 1 in those clauses, it makes it a lot easier to find inappropriate uses of SELECT * in application code.

1 Comment

Data Series Colors in Microsoft Fabric

Michal Bar shows off a new capability:

A frequent request we receive from dashboard authors is the ability to have greater control over color settings.

Until now, color assignments in real-time dashboards were largely automatic. While this worked for basic scenarios, it often fell short in operational and reporting use cases where color isn’t decoration—it’s meaning. Data Series Colors is a new capability that gives authors direct control over how colors are applied to their visuals.

Read on to see how it works for real-time dashboards.

Leave a Comment

NYC Open Data R Package

Antoine Soetewey announces a package:

I am pleased to announce the release of nycOpenData, an R package providing convenient, tidy access to dozens of datasets from the New York City Open Data platform.

The package is designed as part of an open-science and reproducible-research effort, with the goal of lowering the friction between public data and statistical analysis—especially for teaching, exploratory research, and applied civic work.

It is available on CRAN, so it should be easy to grab. H/T R-Bloggers.

Leave a Comment

SIDs and Distributed Availability Groups

Evan Corbett troubleshoots an issue:

After building a contained availability group in SQL Server, a customer was experiencing intermittent issues connecting to their primary database. Our investigation revealed that the SQL Authentication login being used had been created both within the context of the contained AG as well as directly on the primary node but had different SIDs in each location.  

This is a pretty common issue when using SQL authentication, and it always seems to bite at the least opportune times.

Leave a Comment

TO_CHAR() in Oracle vs Postgres

Deepak Mahto diagnoses a tricky difference in behavior:

You migrate a perfectly stable Oracle application to PostgreSQL.

  • The SQL runs
  • The tests pass
  • The syntax looks correct
  • Nothing crashes

And yet… the numbers or query calculations are wrong.

Not obviously wrong. Not broken. Just different.
Those are the worst bugs the ones that quietly ship to production. This is a story about one such bug, hiding behind familiar operators, clean-looking conversions, and false confidence.

Read on for the story.

Leave a Comment

Building an Ubuntu VM from Powershell Script

Vlad Drumea has a script:

I needed a fresh Ubuntu VM in VirtualBox this weekend so I figured I can take this opportunity to refresh my PowerShell based process.

Prerequisites

For this VM I’m using the following:

  • Oracle VirtualBox 7.2.6 r172322 running on a Windows host.
  • The installation media (ISO file) for Ubuntu 24.04.3 LTS.
  • 51GB of available space on the drive where the VM will live.
    Note that the default Ubuntu install is ~10GB, but I want the extra space to be able to install other stuff later on.

Click through for the script and explanation of the process. It’s not entirely automated, but Vlad does get to the Ubuntu installation point via Powershell and then takes it up from there.

Leave a Comment