Lots of events

No Comments
As I recently already wrote, I consider my leukemia diary closed now. And since today is exactly one year after my stem cell donation, I now officially have no restrictions on travel anymore. So let’s celebrate that by attending lots of in person events in the near future! SQLSaturday Austin My first trip is in two weeks, when I speak at SQL Saturday Austin, in Texas. On Friday March 8, I present a pre-con: Execution Plans in Depth. For the low price of just $125, you will receive a full day of expert teaching on execution plans, so that you,…
Read More

T-SQL Tuesday 171 – The end of a diary?

2 Comments
It’s February 2014, and it’s time to write a new T-SQL Tuesday post. Our host is Brent Ozar, and his chosen topic is the last ticket we closed. Well, sorry my friend. I’ve been ill. I have not been on active duty for well over a year now. And if you really think that I would still recall the last ticket I closed before getting my diagnosis and starting my long road to recovery, well, then I also have a bridge for sale! So I decided to do a less literal interpretation of Brent’s request. Isn’t life very much like…
Read More

Plansplaining part 28 – The curious case of the missing FIRST_VALUE function

1 Comment
In part twenty-eight of the plansplaining series, I’ll wrap up the six-part mini-series on window functions. After covering the basics, fast-track optimization, window frames ending at UNBOUNDED FOLLOWING, window frames specified with RANGE instead of ROWS, and LAG and LEAD, we will look at the LAST_VALUE and FIRST_VALUE analytical functions, and find that a function we would have expected to be available as an internal aggregate function does not exist at all! We’ll also find out how SQL Server works around that. LAST_VALUE We already encountered the LAST_VALUE internal aggregate function in the previous post, where it is used to…
Read More

T-SQL Tuesday 170 – Abandoned projects

Welcome to the new year! And welcome to my first T-SQL Tuesday contribution of 2024. Reitse Eskens is our host, and he invites us to think back of a project that failed or was abandoned, and reflect on lessons learned. I love learning from mistakes. I often say that it’s important to learn from mistakes, so that we can make exciting fresh new mistakes the next time. That is, after all, way more exciting than constantly repeating the same mistakes over and over again. In this blog, I will reflect on not one but two abandoned projects. In one case,…
Read More

Plansplaining part 27 – LAG and LEAD

This is part twenty-seven of the plansplaining series, and episode five in the mini-series on window functions. The previous parts covered the basics, fast-track optimization, window frames ending at UNBOUNDED FOLLOWING, and window frames specified with RANGE instead of ROWS. In this post, we will shift our attention to the LAG and LEAD functions. Two functions that do not even accept a window frame specification. So why are they in this series? Read on to find out! LAG LAG and LEAD were introduced in SQL Server 2012. They require an OVER clause, but it can only specify PARTITION BY and…
Read More

Plansplaining part 26 – Windows with a ranged frame

1 Comment
This is part twenty-six of the plansplaining series. And already the fourth episode about window functions. The first of those posts covered basic window functions; the second post focused on fast-track optimization for running aggregates, and the third post explained how the optimizer works around the lack of execution plan support for UNBOUNDED FOLLOWING. But all of those were about OVER specifications that use the ROWS keyword. Let’s now look at the alternative, the RANGE keyword. RANGE instead of ROWS When a RANGE specification is used, then number PRECEDING and number FOLLOWING are not allowed. So this leaves us with…
Read More

T-SQL Tuesday 169 – Thank you, community!

No Comments
It is December. And it is Tuesday. So I guess it’s time for T-SQL Tuesday again. Our host this month is Kay Sauter, and his seasonally inspired topic is to call out the gratitude that we often feel towards other, but fail to express. This is a very easy task for me. If you’re a regular reader of this blog, then you will know that, during the last year, my focus was more on being ill and getting better than on dissecting execution plans (although I never really fully stopped doing the latter 😉). During all that time, the support…
Read More

Plansplaining part 25 – Windows without upper bound

No Comments
This is part twenty-five of the plansplaining series, and the third part that covers window functions. I have already explained how basic window functions work, with or without a window frame. When a window frame is present, a Window Spool operator will, for each row, return first that row, and then all rows that are visible in its frame. A Stream Aggregate then computes the requested aggregations on those rows. In the previous part, I then explained how “fast-track optimization” severely reduces the amount of work in cases where the window frame starts at UNBOUNDED PRECEDING. I also showed that…
Read More

Execution Plan Video Training – pre-orders open

No Comments
I have been working hard, the past months, to complete the next series of videos for the Execution Plan Video Training. The advanced level of block 3, Combining Data, is now ready. And from now until the end of the year, you can benefit from a nice pre-order discount. Advanced joins The basics of each of the four join operators are covered in the basic level of block 3. But there is a lot more to be told about these operators, and that is what the advanced level covers. There are four videos (“chapters”) in this level. Only one of…
Read More

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

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