For my second vlog, I decided to talk about rowgoals. First an explanation of what they are, then an overview of some obvious and some not so obvious cases where the optimizer will use a rowgoal, and finally a warning about cases where this normally beneficial feature might hurt instead of help.
And then, after recording and editing, I had a video of over 35 minutes. I felt that this might be too long for the format of these vlogs. But that is just my assumption. So I decided to verify, by opening this poll on LinkedIn (which, by the way, is still open at the time I write this).
The results so far are not really conclusive. About as many votes for less than 15 minutes as for 15 to 45 minutes. And perhaps I should have chosen the categories different, because there is still quite some difference between 20 or 40 minutes. (I tried to use more categories, but LinkedIn polls do not allow more than four answer options).
I’ll keep watching the poll for more votes, and for comments. But for now, my takeaway is that over 45 minutes is too long. Below that, it’s mixed. Some prefer shorter, others are okay with longer – although it’s unclear whether that is actually up to 45 minutes, or perhaps better to stay under half an hour.
In the case of the rowgoals video, though, I realized that there is a sort of natural way to split the subject matter across three videos, of 10 to 15 minutes each. So that is what I did.
Since I am a lazy bum, I did not re-record the entire video. I only recorded new openings and endings for each part of the video, and edited the individual parts together. So if you wonder about the very fast shirt changes in the video below – it’s not magic, it’s video editing!
What are rowgoals, and how do they work?
When you use a TOP clause (or FETCH, the ANSI standard equivalent, that optionally can also use OFFSET to skip the first few rows), the optimizer introduces a rowgoal in the execution plan. This video shows how that works.
More of me?
Was this useful to you? Do you want to learn more from me?
You can click here to see an overview of my scheduled conference visits. If you attend one of those, you get a lot of other presenters and sessions thrown in as well!
To learn really everything about SQL Server execution plans, check out my video training. Over 20 hours of super high quality video content (and more will be added when ready).
Or you can hire me, for instance for custom built in house training, or if you just want me to fix your performance problems now.



