SQL Query Tuning(multiple execution plan) - How to force optimizer to use particular execution plan
When I attempt an issue with a particular SQL query found the below from awr report for that query.
example:
Plan Hash Total Elapsed 1st Capture Last Capture
# Value Time(ms) Executions Snap ID Snap ID
--- ---------------- ---------------- ------------- ------------- --------------
1 3911240405 516,514 1 359 359
2 229786669 0 0 359 359
Whenever it uses execution plan 2 querey never complete. When it picks up 1st plan it completes in milli seconds. Now if I want to force optimizer to use 1st plan always. how to do that? Let me know your thoughts and suggestions please