PT Quirk

网友投稿 843 2022-10-12

本站部分文章、图片属于网络上可搜索到的公开信息,均用于学习和交流用途,不能代表睿象云的观点、立场或意见。我们接受网民的监督,如发现任何违法内容或侵犯了您的权益,请第一时间联系小编邮箱jiasou666@gmail.com 处理。

PT Quirk

JL Computer Consultancy

A quirk in partition elimination

Pre- Aug 1997

This note is an addendum to an article published in Relate (the magazine ofthe UK Oracle User Group) in Summer 1998. If you want to see the article, theintroduction is an html located at PVsor PTs.

If you execute query against a partitioned table with a predicate asfollows, then ALL the partitions between A and B are examined,and proper partition elimination does not take place. (This is a 'bug' thatshould be fixed in 8.1 apparently, and is not a problem with partition views inOracle 7).

where    partition_column = A

or       partition_column = B

On the other hand, in my original article comparing partition views andpartition tables, I had pointed out the need in retail-based data warehousesfor query that, say, compared the 7 days before Christmas this year with the 7days before Christmas last year - which would require a predicate of the form:

where    sale_date between A and B

or       sale_date between C and D

Now, after checking it again very carefully both with and without theparallel query option running , I can confirm that partitioned tables CANcope with this query despite the fact that it isapparently more complex that the first one.

Partition Views, on the other hand fail completelyto elimate any partitions at all on this query unlessit is re-written as:

where    sale_date between A and D

and      (sale_date <= B or sale_date >= C)

In which case elimination takes place for partitions outside the extreme Aand D values. Don't expect this to be fast though, the amount of datacomparison that takes place is large, and Oracle wastes a lot of CPU with datecomparisons (I have heard that 8.1 or 8.2 will be introducing a 'native date'type that will make date comparisons much faster)..

Workaround for the first case - instead of writing:

where    partition_column = A

or       partition_column = B

change it to read

where    partition_column between A and A

or       partition_column between B and B

上一篇:The Clustering Factor
下一篇:2019年运维那些事儿
相关文章

 发表评论

暂时没有评论,来抢沙发吧~