|
|
最初由 alexzeng 发布
[B]从这个语句, 我想到一个问题:
========== 语句 ==========
insert into t_2(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)
values
(:b1,:b2,:b3,:b4,:b5,:b6,:b7,:b8,:b9,:b10,:b11,:b12)
就是, 对于分区表不应该用绑定变量, 这样Oracle不知道该用哪个分区. 看看执行计划就知道, 本来不同分区插入的执行计划应该是不一样的,
参考下面这段, from http://www.ixora.com.au/tips/design/partitioning.htm
Partition Elimination
Another benefit of range partitioning, is automatic partition elimination during the formulation of query execution plans. The optimizer compares the WHERE clause predicates with the partitioning range for each partition and eliminates from the execution plan those partitions which can be guaranteed not to contain rows satisfying the query. Of course, partition elimination normally relies on not using bind variables, so that the optimizer can determine which partitions can be eliminated. However, in the case of equality predicates on the partitioning key, the optimizer is content in the knowledge that at most one partition will be required. [/B]
这应该才是问题的所在。 |
|