Our prior Query Exercise introduced SQL Server’s 201 buckets problem: its inability to accurately estimate rows for more than 201 outliers in a table. I followed up with a solution using filtered statistics to help with the next 200 outliers, and I talked about how that’s really overkill for the simple problem we were facing in that initial challenge.
Let’s build upon that knowledge, but use a more complex query. I’m going to keep the filtered statistic in place, which gives me accurate estimates on the number of people in Lithuania, and I’m going to add an index on the