Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Having up-to-date stats on a partition makes query slower

f9smskJan 4 2017 — edited Jan 7 2017

Hi everyone,

I have a query containing a parent-child pair partitioned tables and some filtering. you can consider the following psudo-code as the query template:

SELECT <clause containing fields from both tables>

FROM PARENT PARTITION(P_2017_01_01) PP,

   CHILD  PARTITION(P\_2017\_01\_01) PC

WHERE <Join tables on FK>

AND <Some filtering>

the tables are partitioned based a date column on daily manner. the stats gathering is done until partition P_2017_01_01. in other word, the partitions beyond this partition (P_2017_01_02 and next partitions) don't have stats gathered. when I run the query for stats gathered partitions it takes 7-8 minutes to complete while non-stats-gathered ones will finish in 20-30 seconds.

the explain plan for stats gathered partitions:

1.png

the explain plan for non-stats-gathered partitions:

2.png

As usual child table partitions contain considerable more records than their corresponding partition in parent table.

I want to know why this is happening?

Is there any hint to force the former plan to choose better plan?

Regards

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 4 2017
Added on Jan 4 2017
21 comments
864 views