# From SQL Statement to Execution Plan
![`smart`](TiDBQueryToExecutionPlanOverview_aa_002_20230912.png)
------------------------------------------------------------------------------
In summary, the optimization of an SQL statement within the optimizer involves three primary stages: 
- Pre-Processing
- Logical Transformation
- Cost-based Optimization