Author: way0utwest

  • T-SQL Tuesday #200: When I Look at a Query …

    This month is a milestone for T-SQL Tuesday. It’s number 200, which doesn’t sound big, but this is a monthly party (started by Adam Machanic). We have 12 blog party events a year. 200 means this has been running for almost 17 years (16 years and 8 months).

    I don’t care who you are, that’s impressive. Think about where you were, what you were doing, and what was happening in 2009.

    I haven’t been running it that long, but I am glad I took it over from Adam and have kept it going. Thanks to everyone who writes and reads the posts and especially the hosts.

    I tried to get Adam to host, but he declined. Fortunately Brent Ozar stepped up with a great initiation. My response below.

    At First Glance

    There are two things that immediately stand out to me when I see a query and create concern.

    1. cross joins
    2. functions in the where/on clause

    While there are other things I might see, these two stand out and usually I can guess there will be issues.

    For cross joins, I don’t see this as much when people use SQL Prompt or some other helper because they tend to use inner/left outer/right outer explicitly, or cross join. If you explicitly use a cross join, I might ask why, but these clauses require an ON clause, which means you’re deciding to join tables.

    Where I see people using old style joins, like this:

    select *
    
    from a, b
    
    where a.id > 23 and b.saledate > current_date
    
    or (a.id is null and b.saledate is null)

    I get worried. This happens in Oracle, and PostgreSQ, and it’s easy to forget to join a and b, especially when there are multiple tables. Usually cross joins happen with legacy join conditions.

    The other area is using functions in the WHERE clause. A common example is

    select *
    
    from customer
    
    where upper(customername) = ‘Steve’

    This function in the WHERE clause ruins the ability to see the data. The index is something like (‘Adam’, ‘bill’, ‘Steve’, ‘WILLIAM’). This can’t be used when the UPPER is applied. This often results in more reads, more scans than a system might otherwise take.

    There are plenty of other issues that can indicate performance issues, but these two are the ones I’ve often run into and the ones that would have helped 2004 Steve write and review better code.

  • Republish: Bad IT People

    I’m still on vacation in Napa Valley, at least for a few more hours. It’s a chance to get away for me, so you get to re-read Bad IT People.

    Hope you had a great weekend.

  • Independence Day 2026

    Tomorrow is the United States 250th Independence Day celebration. I’ve been hearing about this on the radio for weeks, and it’s struck me that I’ve been alive and lucky enough to experience both the 200th (1976) and the 250th (2026) milestones. I’m not sure either is more amazing than any other 4th of July, but the round numbers stand out.

    In 1976, I was an 8 year old, and I vaguely remember going to Mount Trashmore park in Virginia Beach. It was a fun day of a cook out with hot dogs and kool-aid, playing in playgrounds, and some few moments wading in the lake nearby. It felt like an amazing event to be a part of.

    As a 50+ year old, I’m less excited about the 4th of July, but I am excited this weekend. I’m flying this morning to San Francisco with my wife for a weekend in Napa Valley and a slightly better food and drink selection.

    While I’m away, I hope you have a quiet day, nothing goes wrong, and you ease into the weekend. Or if you’re in the US, I hope you also enjoy a day off.

    Steve Jones

    Listen to the podcast at Libsyn, Spotify, or iTunes.

    Note, podcasts are only available for a limited time online.

  • A Spread of Vacation

    I’m off on vacation today.

    Which is a little weird as I just got back from a week long vacation in May, cruising with my family. Usually my trips for personal stuff get a little more spread out, but I’m slowly learning to relax and try to take advantage of the benefits and balance out my life better.

    I travel a good bit for work, taking 13 trips for work, 2 as a coach, and 1 vacation in the first half of 2026. It was a busy time, and for the first time in a quite a few years, my wife didn’t come on any of the work trips. That made it a hard six months for both of us.

    It’s not one’s fault, but we decided to do better, both to enjoy our lives more, but also to ensure we’re recharging and refreshing. Our changes for H2 are to take these trips together:

    • Jul 3-6 vacation
    • Jul 17-20 Day of Data Baton Rouge + 2 nights in New Orleans
    • Aug 10-18 – Cambridge for a week for me and then 5 days at the Fringe Festival in Edinburgh
    • Oct 10-19 – Cruise in Europe
    • July TBD – Camping for a long weekend
    • Sept TBD – a long weekend in the mountains of Colorado

    It’s a nice set of things to look forward to, which will break up my work periods with something coming every month to look forward to. With Thanksgiving and Christmas, this feels like a relatively relaxed H2 for me, which is great.

    I’m learning to relax and work a little less, enjoying life more. Many of you do this better than I do already, so thanks for all the comments, ideas about trips, and sharing about things you enjoy outside of work.

    This also might be the first time I get to Q4 without any extra vacation that I have to start burning without plans.