A major goal of this chapter was not only to show you how a variety of queries execute, but also to demonstrate, using many examples, how to set up a query testing playground for exploring that yourself. You shouldn't just read this chapter. You should load the Dell Store 2 data into your system and experiment with the queries yourself.
Try to understand how the queries are actually executed in each of these cases, based on the statistics available. Adjust the statistics collected and see if anything changes. Write new queries and see if the plans you get match what you expected. Watch how the optimizer degrades as you take away its advanced features. That sort of practice is the only way to really become an expert at query optimization. Once you see how to read query plans and understand how each of the underlying node types work on this relatively simple database, then you should be armed to wrestle the queries on a production database. The variation between estimated and actual rows can cause major planning issues. Looking into the underlying statistics is one way to determine why that's happening; at a minimum, make sure you have recent statistics from an ANALYZE. Consider portions of the query that actually had the longest execution time, and see if they had an appropriate matching cost. If not, this may also suggest a statistics problem.
SQL Window queries can be extremely efficient in situations where knowing more about a row's context and data in surrounding rows simplifies the logic.
This chapter slightly touches the statistics, but the next chapter will cover the database activity and statistics in detail.