This post is not long enough to be a fully-fleshed out post on my technical blog, so I’m putting it here.
Understanding Optimizer Timeout and how Complex queries can be Affected in SQL Server by Joseph Pilov is a worthy read if you’re at all interested in how query plans are built.