# SQL Server Query Optimizer: Phases and Framework > [!Note] > `The Query Optimizer rewrites and evaluates query plans in multiple stages—parsing, simplification, alternative generation, and cost-based selection—using the Cascades Framework and heuristics to balance quality and compilation time.` **Parse and Bind:** In the initial **parsing** phase the optimizer analyzes the SQL syntax and constructs an internal representation, then performs **binding** by resolving object names, data types, and schema references against catalog metadata to ensure the query is semantically valid. **Simplification:** During **simplification**, the optimizer applies algebraic transformations to the bound query tree, such as predicate push-down and view unfolding, to restructure and reduce complexity, improving the potential for efficient execution without altering the logical result. **Alternative Generation:** Leveraging the **Cascades Framework**, the optimizer systematically generates multiple **alternative plans** by applying transformation rules (e.g., join reordering, join method substitution) to the simplified query tree, collecting these alternatives in groups for cost comparison. **Cost-Based Optimization:** Each candidate plan is evaluated using a **cost model** that estimates resource usage—**I/O**, **CPU**, and **memory**—and computes an **overall cost**. The optimizer then selects the plan with the lowest estimated cost, while **heuristics** guide search pruning to prevent exponential plan explosion in complex queries. --- ## References - Korotkevitch, D. (2022). _SQL Server advanced troubleshooting and performance tuning: Best practices and techniques_. O’Reilly Media. - Nevarez, B. (2022). _SQL Server query tuning and optimization: Optimize Microsoft SQL Server 2022 queries and applications_. Packt Publishing.