Concept Flow - Cost-based optimization
Receive SQL Query
Parse Query
Generate Possible Execution Plans
Estimate Cost for Each Plan
Compare Costs
Choose Lowest Cost Plan
Execute Chosen Plan
The database receives a query, creates many ways to run it, estimates the cost for each, and picks the cheapest plan to run.