A plan is developed by the Cost Based Optimizer. If it is making a mistake, you can give the CBO orders with (for example) hints or baselines. Or you make changes to the SQL, the data structures, the environment, the available statistics, many more things, that will let the CBO develop the best plans on its own.
How do I change an execution plan?
- How do I change an execution plan?