Live registration reopens October 1, 2026, in 1d 20h 50m — Notify me

4.2 Tuning usp_SearchPostsByPostType

In usp_SearchPostsByPostType, people can query for PostTypeIds that have dramatically different numbers of rows in the Posts table. What makes matters even worse is that they’re passing in the name of the PostType, not the ID, so SQL Server doesn’t stand a chance of cardinality estimation.