Query Hints and Estimated Plans

SQL Server
I'm working on an update to my Query Performance Tuning book for SQL Server 2025 and I found myself wondering, will a query hint be immediately apparent in an execution plan without runtime metrics (AKA, Estimated Plan)? My assumption was a resounding yes, but you have to check. Query Hint in Estimated Plan I've got a simple query that I wanted to test this with: SELECT p.Name, p.Class FROM Production.Product AS p WHERE p.Color = 'Red' AND p.DaysToManufacture > 15 OPTION (USE HINT ('FORCE_LEGACY_CARDINALITY_ESTIMATION')); This one is going to very subtle in it's behavior. The execution plan, estimated and actual, with or without the query hint, is going to be shaped like this: The devil as they say, is in the details. Let's look at the properties of the first…
Read More

Do Yourself a Favor, Check Out Woodler

Uncategorized
I recently was privileged to speak at SQLDay in Wroclaw Poland... man, I love visiting Poland... Anyway... Great event. Worth your time to attend, and if you're a speaker, oh, you don't want to miss this one. The data community there is just amazing. I always walk through the vendor floor to see what's what. I get recommended to look at the SQL Server monitoring tool from Woodler. I do. WOW! Look, I sell a monitoring tool (please, go here, look at Redgate Monitor), which means, technically, we're competitors. However, fact is, we're doing things they're never going to do, and, hoo boy, they're doing some stuff that we're never going to do. Plus, competition is a good thing. Now, they're primarily a consulting organization, but they use the tool…
Read More

Stack Overflow & AI

Professional Development
I won't try to pretend otherwise, I've had some mixed feelings about Stack Overflow for a long time. I think the concept of the place, ask a question, get an answer, is great. No question. How that was handled, tone of moderation, other stuff, maybe it wasn't all handled as well as it could have been. However, it was a model that proved itself. That is, until AI came along. First, go read this. It's a tough story. I see the same thing happening in a lot of places. Heck, I go to several different AI engines for answers more than I go to anyplace else (and then, yes, I validate those answers through other types of research, testing, experimentation, but critics might be surprised at how accurate AI answers…
Read More

SSMS 21

SQL Server
Just a quick one this morning. I'm on the road and haven't worked up a full blog post, apologies. I've been using the preview for SQL Server Management Studio 21 for a little over a week now. You should check it out. It's been mostly stable (I got a crash. I didn't report it because I couldn't replicate it). I think the most interesting thing has been how much it's largely the same. It's in a new home within Visual Studio. However, the majority of the behaviors I've hit so far have been normal. Heck, Redgate SQL Prompt is working for me and my team told me we don't support SSMS 21 yet. I've spent most of my time in Extended Events and the Live Data Window. So much of…
Read More

AI in the DBeaver Query Editor

PostgreSQL
You know I had to do it as soon as I found it was possible. Yes, I installed and enabled AI in the DBeaver Query Editor so I can use AI with my PostgreSQL database work. Let's face it. It was inevitable. However, the setup isn't intuitive. Setting Up in DBeaver I'm going to assume you're on the Community Edition of DBeaver. First, got to the "Help" menu and then "New Software". A window will open up. Right at the top is a drop down labeled "Work with." Select that and then select "DBeaver - AI support - https://dbeaver.io/update/ai/latest/." Next, select "DBeaver AI Support" down in the window and it should look like this: At the bottom of the screen you can pick finish, or hit next and review stuff.…
Read More

So You Think You Should Get a Radio

Misc
This is not database related, so if you're not interested in hearing about something besides SQL Server, PostgreSQL, DevOps, community or data management in general, time to move on. Figured I'd just let you know up front. In the last year there have been several very large scale emergency events, examples include Hurrican Helene in the US and yesterday's massive power outage in Spain, Portugal and France. There have been others as well. Before I go further, my heart goes out to all the people affected in Europe. I hope no one was too hurt by the outage and you all recover quickly. What's been somewhat unique in all these cases is that cel phone services have gone out, on a massive scale. Which means everyone is cut off, and…
Read More

Can AI Read Execution Plans?

SQL Server
Yeah, yeah, second AI post in a row. I promise not to make a habit of it. But I saw someone else mention that you can feed them XML and the AI will read the execution plan. I had to test it out and then overshare my results with all of you. We Need A Query Here's a query: SELECT c.CustomerID, a.City, s.Name, st.Name FROM Sales.Customer AS c JOIN Sales.Store AS s ON c.StoreID = s.BusinessEntityID JOIN Sales.SalesTerritory AS st ON c.TerritoryID = st.TerritoryID JOIN Person.BusinessEntityAddress AS bea ON c.CustomerID = bea.BusinessEntityID JOIN Person.Address AS a ON bea.AddressID = a.AddressID JOIN Person.StateProvince AS sp ON a.StateProvinceID = sp.StateProvinceID WHERE st.Name = 'Northeast' AND sp.Name = 'New York'; This query results in this execution plan: There are some tuning opportunities here.…
Read More

Using AI for Data Conversion

Tools
I'm sure I've never mentioned that I'm an amateur radio operator. Like Vegans and Cross Fitters, we tend to be shy and withdrawn about our predilections. BWA-HA-HA! Ok, like Vegans and Cross Fitters, you can't get a ham to shut up about playing radio. Anyhoo, I've been experimenting with a brand new, and somewhat buggy, radio, the Baofeng DM-32UV. I'm writing this blog post about how I am using an AI for data conversion to make it a little easier to use this radio. The Problem The DM-32 is a Digital Mobile Radio (DMR) as well as an analog radio. You can follow the link to understand all that DMR represents when talking radios. I want to focus on the fact that you have to program the behaviors into a…
Read More

How Do You Pick Events in Extended Events?

SQL Server
A while back I wrote about using AI to explore why people are not using Extended Events. You can read all about it here, but a short summary of the biggest blockers would be: Familiarity (more comfort in Trace or DMVs) Lack of Knowledge (just don't know how it works) XML (I agree) Event Overload (there are just too many) For this blog post I want to focus on the last one, Event Overload. There really are a lot of events in Extended Events. I don't just think that's a good thing. I think it's a GREAT thing. However, I get it. I hit the same problem, regularly. Which events do I use to do thing that I'm trying to do? Except for blogs like this one, there's not always…
Read More

Can You Tell Why a Plan Didn’t Go Parallel?

SQL Server
Let's face it, most of the time, you probably don't want your SQL Server execution plans to go parallel. After all, that's why, instead of adjusting the Cost Threshold for Parallelism (as you should have), you've set the Max Degree of Parallelism to 1 (I see you out there). However, some of you recognize that, in fact, some queries need to run in Parallel. Yet, sometimes, a query you think should run in parallel doesn't. Can you tell why a plan didn't go parallel? If It's Not Parallel, Why Not? The good news is, this question is really simple to answer. I'm sure you'll be shocked when I tell you that it's right there in the execution plan. The bad news is, you're going to have to open up the…
Read More