Image

T-SQL Tuesday 195 – Code that aged well

No Comments
It’s the second Tuesday of the month again. Time for T-SQL Tuesday, edition 195. This edition is hosted by Pat Wright, who wants to know whether our code aged well. The timing of that question could not have been any better for me, because I am right now working on an assignment related to a database system that I first worked for over 10 years ago! The database system I started working for the company in summer 2013. This was on employment, with a one-year contract. They used a SQL Server database to support their subscription administration and invoicing process.…
Read More
Image

Rowgoals, part 3: When rowgoals backfire

No Comments
In part 1 of this mini-series, I explained what a rowgoal is and how it works to optimize a query with a TOP or FETCH expression. Part 2 then showed a few less obvious other cases where the optimizer might introduce rowgoals. In all cases so far, those rowgoals were beneficial. They helped the optimizer come up with the best execution plan for the number of rows requested. Things can go wrong! Unfortunately, there are cases where a plan that is optimized with a rowgoal turns out to be slower than without the rowgoal. The feature that is intended to…
Read More
Image

Storage structures 2 – Columnstore

No Comments
Update February 4, 2026: I have updated this post with new information, about deleted bitmaps, and about the delete buffer for nonclustered columnstore indexes. Update February 5, 2025: Another update, fairly small in this case. Ordered columnstore indexes were introduced in SQL Server 2022. In the first part of this series, I described the storage structure and access patterns for SQL Server’s traditional storage structure: on-disk rowstore indexes (heaps and B-trees). Columnstore indexes were introduced in SQL Server 2012. In that version only nonclustered columnstore indexes were supported (so they stored a copy of the data in the included columns,…
Read More
Image

Rowgoals, part 2: Rowgoals in unexpected places

No Comments
In my previous vlog, I showed how and why the optimizer uses a rowgoal in the execution plan when your query uses a TOP or FETCH expression. Those are the keywords where this rowgoal is very obvious. Unexpected rowgoals But it’s not always that obvious. There are several other situations where rowgoals can be used, and some of them can be very unexpected! https://youtu.be/QwgiPTDMGQM 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…
Read More
A picture that shows several soccer goals, aligned in rows.

Rowgoals, part 1: How do rowgoals work?

No Comments
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…
Read More
Image

Storage structures 1 – On-disk rowstore

No Comments
When a query is slow, it is often caused by inefficient access to the data. So our tuning work very frequently comes down to figuring out how data was read, and then massaging our queries or database structures to get SQL Server to access the data in a more efficient way. So we look at scans, seeks, and lookups. We know that scans are good when we access most of the data. Or, in the case of an ordered scan, to prevent having to sort the data. We know that seeks are preferred when there is a filter in the…
Read More
Image

Self-promo: Precon opportunities

No Comments
I am normally not very good at promoting myself. I always forget to use the social media banners that conference organizes helpfully send me. And while I do have a list of upcoming speaking engagements on this site, I don’t really push it in your face at every opportunity. But the organizers of SeaQL 2026 pushed me. They asked me to record a video, to explain what attendees can expect when they sign up for my precon. And then, the fantastic Tonie Huizer went one step further, and created a YouTube short out of my promo video! The obvious next…
Read More
Image

Problems purchasing videos?

No Comments
I started the SQLServerFast Execution Plan Video Training in 2020. At that time, I chose Vimeo as the platform to use for hosting and selling my videos. The major reason for this choice was their advertised ability to sell video access to customers across the world, so that everyone, regardless of location, can buy access to my videos and learn to read execution plans. Not in India! Two months ago, I received an email from someone who lives in India. When he tried to buy access to my videos, he received an error message: “This video is not for your…
Read More
A dark figure called "danger", armed with a knife, is chasing a running DBA.

A new experiment for 2026

1 Comment
It is January 1st, 2026. So let me first use this opportunity to wish all my readers a very good 2026, with lots of performance gains in your servers, lots of new insights into SQL Server, … but most of all, lots of love and happiness in your personal lives. Video blogging? It started when Erik Darling tempted me, even though I doubt he remembers. He has been vlogging for a long time already, and he basically dared me to try it too. I didn’t. Not at that time. But the seed was planted. During this year, I had several…
Read More
Image

A deep dive into hash tables, part 4

No Comments
This is the last part of my blog series about the internals of hash tables in SQL Server. In part 1, I introduced a trick to get data returned in the order of the hash table, that I used in part 2 to gain an understanding of its internals. I then built on that in part 3 to find examples of hash collisions. With that, the discussion of the in-memory structure of a hash table is over. But what if we run out of memory and have to spill to tempdb? How is the spilled data stored on disk? I…
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