我使用的是Oracle 11G。
我有下一个查询:
select *
from ARCH_KART H
join A_NABOR2 N
on H.LSK = N.LSK
and :B1 between N.MGFROM AND N.MGTO
where h.mg = :mg and h.lsk between :C1 and :C2
这是一个计划:
A_NABOR2是“lsk”列的散列分区表,它包含about 1亿条记录。
为什么Oracle使用PARTITION HASH ALL方法?
Upd1 我添加了本地索引: 在A_NABOR2(MGFROM,MGTO)上创建索引A_NABOR2_I 本地;
但是id没有帮助:
--------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes |
--------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 79 | 28203 |
| 1 | NESTED LOOPS | | | |
| 2 | NESTED LOOPS | | 79 | 28203 |
| 3 | PARTITION HASH ALL | | 79 | 4345 |
| 4 | TABLE ACCESS BY LOCAL INDEX ROWID| A_NABOR2 | 79 | 4345 |
| 5 | INDEX RANGE SCAN | A_NABOR2_I | 1024 | |
| 6 | PARTITION RANGE SINGLE | | 1 | |
| 7 | INDEX RANGE SCAN | ARCH_KART_I_LSK | 1 | |
| 8 | TABLE ACCESS BY LOCAL INDEX ROWID | ARCH_KART | 1 | 302 |
--------------------------------------------------------------------------------