Plansplaining part 32 – Keyset cursors

Welcome to plansplaining, part 32, where we once more look at cursors. We already discussed the basics, and looked at static cursors and dynamic cursors. It is now time to cast our gaze upon the keyset cursor. The keyset cursor is sort of in between the static cursor (which presents a snapshot of the data is at was when the cursor was opened and disregards future changes) and the dynamic cursor (that always shows the current data). To be precise, a keyset cursor sees changes made to already existing rows, but does not see new rows that were added after…
Read More

Execution plan training around the world

I sometimes hear that query performance tuning is a dying skill. But that is not true! Even in the modern day, with workloads moving to the cloud where you can increase performance by just moving a slider, where a lot of work is done by data analysts, using low-code or no-code solutions with an abstracted view of the data model, and where investments by Microsoft have taught SQL Server how to automatically improve performance in many ways, there is still a need for professionals who know how to investigate and fix a performance problem. Perhaps that need is even growing!…
Read More

Plansplaining part 31 – Dynamic cursors

We’re already at part 31 of the plansplaining series. And this is also the third part in my discussion of execution plans for cursors. After explaining the basics, and after diving into static cursors, it is now time to investigate dynamic cursors. As a quick reminder, recall that a static cursor presents data as it was when the cursor was opened (and does so by simply saving a snapshot of that data in tempdb), whereas a dynamic cursor is supposed to see all changes that are committed while the cursor is open. Let’s see how this change in semantics affects…
Read More

Plansplaining part 30 – Static cursors

In part 30 of the plansplaining series, we’ll continue our discussion of cursor processing. I recommend first reading the previous post, where I explain all the necessary basics. Sample query Throughout the series, I will keep using the same sample query, that grabs some sales and product data for sales of more than 10 units, within a specified range of sales orders. SELECT soh.SalesOrderID, soh.OrderDate, sod.SalesOrderDetailID, sod.OrderQty, sod.ProductID, p.ProductID, p.Name FROM Sales.SalesOrderHeader AS soh INNER JOIN Sales.SalesOrderDetail AS sod ON sod.SalesOrderID = soh.SalesOrderID INNER JOIN Production.Product AS p ON p.ProductID = sod.ProductID WHERE soh.SalesOrderID BETWEEN 69401 AND 69410 AND sod.OrderQty…
Read More

T-SQL Tuesday 174 – Job interview questions

For edition 174 T-SQL Tuesday, Kevin Feasel asks us to write about our favorite job interview questions. I don’t like job interviewing. Never have, never will. And while the process changed a lot once I shifted to contracting, my dislike for the interview process has remained. I am not hiring So I decided not to write about my favorite job interview questions as an interviewee, because I don’t like any of those questions. And I also could not really write a lot about my favorite questions as an interviewer, because I have never been in that role. But, thinking about…
Read More
People queueing at the airport

Plansplaining part 29 – Introduction to cursor processing

This is already the 29th part of the plansplaining series, where I look in detail at interesting examples of execution plans in SQL Server. With this part, I’ll kick off another mini-series, this time on cursor processing Don’t use cursors! And yes, I know the mantra. Do not use cursors. They are slow. There is (almost) always a faster set-based alternative available. So why would I even waste blog space on cursors, when the only smart thing to do is to rip them out and replace them with a set-based alternative? Well, there are, in fact, many reasons. The “almost”…
Read More

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?

3 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

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