 |
|
Oracle Hash Partitioned IOT &
Sub-optimal SQL
Oracle Database Tips by Donald Burleson |
Question:
I have some large, hash-partitioned IOT's, and the
optimizer sometimes chooses to do fast-full scans rather than a range scan with
a nested-loop join.
I want to turn off (or at least make it look
expensive to the optimizer) both fast full scans and skip scans. Are there
still some hidden init params for these features (i.e. _fast_full_scan_enabled)?
Or is there a way to influence the use of these
access methods via the optimizer_index_cost_adj parameter?
Answer: First, more information is required:
- Does your SQL have function predicates on partition keys?
- Are your fast-full scans for the whole table, of just a partition?
I would try to adjust the CBO statistics first, before adjusting parameters.
David Aldridge has some great work on improving CBO stats for partitioned tables
with sub-optimal SQL
>>
I have some large, hash-partitioned IOT's
Dr. Hall notes a new 10g feature for global
indexes on hash partitioned IOT's:
"Support for hash partitioned global indexes
has been added in Oracle 10g which can improve performance when a small number
of leaf blocks are experiencing high levels of contention."
>>
optimizer sometimes chooses to do fast-full
scans rather than a range scan with a nested-loop join.
Is it the whole table, or just the relevant partition?
Here are some important issues with partitioned tables and bad stats.
>>
is there a way to influence the use of these
access methods via the optimizer_index_cost_adj parameter?
OICA
lets you tune the optimizer behavior for access path selection to be more or
less index friendly, and it is very useful when you feel that the default
behavior for the CBO favors full-table scans over index scans.
OICA
will effect the cost of index access in-general, no help there . . . .
>>
I want to turn off (or at least make it look
expensive to the optimizer) both fast full scans and skip scans.
As for skip scans, one approach is to create a duplicous index with the
high-order key first . . . .