Partition Pruning

The Oracle database server explicitly recognizes partitions and subpartitions. It then
optimizes SQL statements to mark the partitions or subpartitions that need to be
accessed and eliminates (prunes) unnecessary partitions or subpartitions from access
by those SQL statements. In other words, partition pruning is the skipping of
unnecessary index and data partitions or subpartitions in a query.

For each SQL statement, depending on the selection criteria specified, unneeded
partitions or subpartitions can be eliminated. For example, if a query only involves
March sales data, then there is no need to retrieve data for the remaining eleven
months. Such intelligent pruning can dramatically reduce the data volume, resulting
in substantial improvements in query performance.

If the optimizer determines that the selection criteria used for pruning are satisfied by
all the rows in the accessed partition or subpartition, it removes those criteria from the
predicate list (WHERE clause) during evaluation in order to improve performance.
However, the optimizer cannot prune partitions if the SQL statement applies a
function to the partitioning column (with the exception of the TO_DATE function).
Similarly, the optimizer cannot use an index if the SQL statement applies a function to
the indexed column, unless it is a function-based index.

当对分区列进行函数运算时,优化器不能进行分区剪除。

Pruning can eliminate index partitions even when the underlying table's partitions
cannot be eliminated, but only when the index and table are partitioned on different
columns. You can often improve the performance of operations on large tables by
creating partitioned indexes that reduce the amount of data that your SQL statements
need to access or modify.

Equality, range, LIKE, and IN-list predicates are considered for partition pruning with
range or list partitioning, and equality and IN-list predicates are considered for
partition pruning with hash partitioning.

等于,范围,like,in list 都能进行分区剪除,其中等于和in list 进行哈希分区剪除。

Partition Pruning Example
We have a partitioned table called cust_orders. The partition key for cust_orders
is order_date. Let us assume that cust_orders has six months of data, January to
June, with a partition for each month of data. If the following query is run:
SELECT SUM(value)
FROM cust_orders
WHERE order_date BETWEEN '28-MAR-98' AND '23-APR-98';
Partition pruning is achieved by:
■ First, partition elimination of January, February, May, and June data partitions.
Then either:
■ An index scan of the March and April data partition due to high index selectivity
or
■ A full scan of the March and April data partition due to low index selectivity

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10599713/viewspace-1002503/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10599713/viewspace-1002503/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值