The query optimizer's role is to transform SQL queries into efficient execution plans by: 1) Enumerating logically equivalent query plans through equivalence rules. 2) Enumerating physical execution plans for each logical plan. 3) Estimating the costs of each physical plan by estimating predicate selectivities and operator costs. 4) Selecting the physical plan with the lowest estimated cost to run the query.