Execution plan changes to HA join from NL after sub-partitioning
Hello,
I have a partitioned table with 771 partitions(daily) that is joined with a WITH clause query.
WITH DTES1 AS
(SELECT (TRUNC (SYSDATE) - 1) - 7 * LEVEL + 7 AS DTE1,
CASE (-7 * LEVEL + 7) WHEN 0 THEN 'Today'
WHEN -7 THEN '1WeekAgo'
WHEN -14 THEN '2WeeksAgo'
WHEN -21 THEN '3WeeksAgo'
WHEN -28 THEN '4WeeksAgo'
END AS DTE_DSC
FROM DUAL
CONNECT BY LEVEL <= 5)
SELECT
B3.*
FROM B3 , DTES1 D where B3.part_date=D.DTE1
;
B3 will be replaced by PART_TAB or SUB_PART_TAB. when it is only a partitioned table I get a NL plan that does pruning. The moment it is replaced with sub-partitioned table the plan goes to HA and no pruning.