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…


