When a request is invoked, the optimizer optimizes the logical plan and generates a physical plan for efficient execution.