Plansplaining part 24 – Windows on the fast track

No Comments
This is part twenty-four of the plansplaining series. In the previous part, I explained the execution plans for basic window functions, with and without a window frame. Especially the latter group performed quite poorly in the examples. So let’s now look at an optimization that SQL Server can apply to most cases, that prevents this rather bad scaling. Running totals The examples in the previous post all used a window frame that started at (some number) PRECEDING. And as long as (some number) is quite low (and the end of the frame is not defined as (huge number) FOLLOWING), the…
Read More

Plansplaining part 23 / T-SQL Tuesday 168 – Window functions

8 Comments
I skipped the last two T-SQL Tuesdays. But this month, I will participate again. The monthly blog party is once more hosted by Steve Jones. His chosen topic is: Window Functions. In his invitation, Steve specifically asks for examples where Window functions provided a neat solution to a real world problem. Well, sorry Steve, but I am not going to do that. But your invitation did inspire to me write about the execution plans for these window functions. And there is, in fact, so much to write about it, that this is just the first part. So that makes this…
Read More

Black Friday returns!

No Comments
November approaches again. For Europeans, that is a month like any other, for Americans, November means: Black Friday, with huge discounts! Two years ago, I decided to try an experiment. All of November 2021, I offered a 50% discount on all prices for the SQLServerFast Execution Plan Video Training – both individual videos, as well as the already cheaper full-block purchase. The results were better than expected, and certainly reason to repeat this. Last year, I tried something else: a Black Friday Charity, where the 50% discount was not offered to you, as the customer, but donated to charity. Though…
Read More

An update on MERGE

8 Comments
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

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.

Close