Changing CBO Optimizer Parameters
Another emergency situation involved an Oracle 9.0.2 client
from Phoenix who called complaining about steadily degrading
performance. A quick look into v$sql_plan view using my
plan9i.sql script revealed loads of suspected
unnecessary large-table, full-table scans.
In
this case, the top SQL was extracted from v$sql and
timed as-is and with an index hint. The query with the index
hint ran almost 20x faster, but it was unclear why the CBO was
not choosing the index. This was a production emergency, and I
did not have the luxury of investigating the root cause of the
CBO issue. I had to act fast, so I ran a script against
v$bh and user_indexes and discovered that
approximately 65 percent of the indexes were currently inside
the data buffer cache. Based on similar systems, I decided to
lower optimizer_index_cost_adj to a value of 20,
hopefully forcing the CBO to lower the relative costs of index
access.