How a row goal affects estimates
1 Comment
Most of our queries are intended to process a complete data set. But not all. There are cases where we restrict the number of rows. Or cases where SQL Server does this. In all such cases, and a few others, the query optimizer uses a mechanism called a “row goal” to ensure that the execution plan is optimized for a subset of the total result set, not all of it. Some examples Without trying to be complete, let’s list a few cases where a row goal would be set. Literal row limitation in the query The most simple is when…