Query Exercise: Improving Cardinality Estimation
Your challenge for this week is to tune a query. Say Stack Overflow has a dashboard that shows the top-ranking users in their most popular location. It's even got an index to support it:
[crayon-6ab740ce9ec0c096659709/]
You can test it with any version of the Stack Overflow database. To test it, we'll turn on a couple of tuning options:
[crayon-6ab740ce9ec18575956886/]
The actual execution plan does use our index - not just once, but twice: