An update on MERGE

The MERGE statement compares source and target data, and then inserts into, updates, and deletes from the target table, all in a single statement. This statement was introduced in SQL Server 2008. I liked it, because it allows you to replace a set of multiple queries with just one single query. And while a statement with that many options necessarily has a more complex syntax, I still believe that, in most cases, a single MERGE statement is easier to read, write, and maintain, than a combination of at least an INSERT and an UPDATE, often a DELETE, and sometimes first…
Read More

T-SQL Tuesday 165 – Job titles vs actual work

It’s the second Tuesday of the month again, so that means that it’s time for another T-SQL Tuesday. Our host is Josephine Bush, and she wants us to talk about the often confusing job titles in the data world. And while I will (of course) share my thoughts on that topic, I have decided to also include a short rant about a very much related topic: tracks on conferences. Those who have submitted conference talks before will probably immediately understand why I call that a very much related topic. The rest will have to read on! Job titles I advertise…
Read More

Plansplaining, part 22. SQL Graph (part 3)

Welcome to part twenty-two of the plansplaining series, where we will continue our look at execution plans for graph queries. We started this series by investigating the hidden columns in the internal structure of graph tables. In the second part, we looked at how those hidden columns are used in the execution plan for a relatively basic graph query. Time to up our game and tackle the SHORTEST_PATH function, introduced in SQL Server 2019, that can be used to make SQL Server search a graph iteratively or recursively to find the shortest possible path from one node to another. Sample…
Read More

T-SQL Tuesday 164 – Optimizing for readability or for performance

This month’s T-SQL Tuesday is hosted by Erik Darling. His challenge is to write about “Code That Made You Feel A Way”. I was unsure when I read this assignment. I don’t recall ever getting emotional over code. Sure, I can feel pretty smug when I have optimized a query to slash its execution time by 99%, or when I see that the program code to solve a complex issue actually is pretty clean. But in those cases, it’s my achievement that makes me proud, not the code. And, yes, I can also get quite upset when I encounter code…
Read More

SQL Graph indexing – I stand corrected

I made a mistake in my last blog post. This mistake was pointed out to me, in private, by a Microsoft Product Manager, with a request to correct that blog post. Because his correction gave me a lot of additional information, I decided to even write a full post about it. Graph tables and indexes In my post, I pointed out that SQL Server automatically creates a unique nonclustered index on the (internal and hidden) column graph_id, that you can delete, but can’t modify. I added that users cannot specify indexes on that column, nor on the other internal and…
Read More

Plansplaining, part 21. SQL Graph (part 2)

Welcome to part twenty-one of the plansplaining series, where we will continue our look at execution plans for graph queries. In the previous post, we looked at the internal structure of node and edge tables, and discovered that they have a few hidden columns. Now let’s look how those columns are used in graph queries. Sample data As mentioned in my previous post, I’m using sample tables and data from Microsoft’s documentation for these posts. You can find the script to create and populate the tables here, or in my first post on SQL Graph. Simple query Let’s start with…
Read More

T-SQL Tuesday 163 – Career advice

It’s that time of month again! Or rather, it’s one week later. But we’ll pretend it is the second Tuesday of the month, because that is T-SQL Tuesday day! The host for edition #163 is Gethyn Ellis (b|t), and he asks us to share the best career advice we have ever received. Nineties Let’s go back to the previous century. To the nineties, to be precise. I had been active as an IT professional for a few years already, but my lack of formal education held me back to get the promotions that I felt I deserved. And so, when…
Read More

Out with the old, in with the new

Two months ago, I asked a question: Which execution plan icons are relevant today? In that post, I talked about the operator icons shown in the SQL Server Execution Plan Reference. I explained my reasons to choose the four sets of icons displayed (SSMS 17.4 and up, SSMS up to 17.3; Azure Data Studio; and Plan Explorer). And I then also explained why I believe those choices should be reconsidered, and outlined my own thinking in this area. The short version of my ideas is that I would keep the icons for SSMS 17.4 and up but rename that column…
Read More

Donor lymphocyte infusion

(Warning: This blog post is non-technical but purely personal. I write openly about my current health issues. This blog might be triggering for people who struggle with, or lost dear ones to, cancer and other similar diseases.) This is the twelfth post in a series on my personal road from first signs of leukemia, through diagnosis and treatment, to, hopefully, full recovery. Click here to read all posts in this series. Doing fine I have not written any updates in a long time. The reason is simple. There simply was nothing to report. I go out to do my (almost)…
Read More

New videos ready!

It has taken a long time. Partly due to my health, but definitely also to a good extent as a result of my perfectionism. But I can now finally declare that the next set of videos for the Execution Plan Video Training is ready, and pre-order sales have opened, with an insane discount for early deciders! Joins (and more) The focus of block 3 of the SQLServerFast Execution Plan Video Training is on everything related to combining data from multiple sources. Most of the time, data is combined by using one of the four join operators, so they get the…
Read More

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.