Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> subselect results in poor performance

subselect results in poor performance

From: Benny <benny.derous_at_gmail.com>
Date: 16 Jan 2007 07:11:30 -0800
Message-ID: <1168960290.001508.265930@q2g2000cwa.googlegroups.com>


Hi all,
Running query with partition pruning information in subselect but optimizer does not choose for partition pruning making query slow. If subselect is replaced with literal/string (which is result of subselect), query is fast.
Have tried many hints...without success. Anyone else an idea ? note : query below is part of big sql.

  1. no partition pruning on MV_RRP00010 => SLOW makes use of subselect (string in comment)

select VW_RRP00010.*,RRP0.TB_RRP00115.*
FROM RRP0.MV_RRP00010 VW_RRP00010,rrp0.TB_RRP00115 where VW_RRP00010.LOAD_DT = TB_RRP00115.LOAD_DT AND VW_RRP00010.LOAD_TYPE_CD = TB_RRP00115.LOAD_TYPE_CD AND VW_RRP00010.FUSE_CTY_ID = TB_RRP00115.FUSE_CTY_ID AND (VW_RRP00010.ISO2_CTY_CD = TB_RRP00115.ISO2_CTY_CD OR ' ' = TB_RRP00115.ISO2_CTY_CD)
and tb_rrp00115.load_dt = (SELECT TB_RRP00104.LOAD_DT COL1 FROM RRP0.TB_RRP00104 TB_RRP00104 WHERE '1' = TB_RRP00104.VSN_CD AND 'D' = TB_RRP00104.LOAD_TYPE_CD)
/* and tb_rrp00115.load_dt = '14/01/2007' */

Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop

SELECT STATEMENT Optimizer Mode=CHOOSE 64 K 2891 HASH JOIN 64 K 10 M 2891
PARTITION RANGE SINGLE KEY KEY
TABLE ACCESS FULL RRP0.TB_RRP00115 48 K 6 M 1290 KEY KEY PARTITION RANGE ALL 1 35
TABLE ACCESS FULL RRP0.TB_RRP00104 1 12 4 1 35 PARTITION RANGE ALL 1 35
TABLE ACCESS FULL RRP0.MV_RRP00010 1 M 33 M 754 1 35 2. partition pruning on MV_RRP00010 => FAST subselect in comment, makes use of string

select VW_RRP00010.*,RRP0.TB_RRP00115.*
FROM RRP0.MV_RRP00010 VW_RRP00010,rrp0.TB_RRP00115 where VW_RRP00010.LOAD_DT = TB_RRP00115.LOAD_DT AND VW_RRP00010.LOAD_TYPE_CD = TB_RRP00115.LOAD_TYPE_CD AND VW_RRP00010.FUSE_CTY_ID = TB_RRP00115.FUSE_CTY_ID AND (VW_RRP00010.ISO2_CTY_CD = TB_RRP00115.ISO2_CTY_CD OR ' ' = TB_RRP00115.ISO2_CTY_CD)
/* and tb_rrp00115.load_dt = (SELECT TB_RRP00104.LOAD_DT COL1 FROM
RRP0.TB_RRP00104 TB_RRP00104 WHERE '1' = TB_RRP00104.VSN_CD AND 'D' = TB_RRP00104.LOAD_TYPE_CD) */
and tb_rrp00115.load_dt = '14/01/2007'

Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop

SELECT STATEMENT Optimizer Mode=CHOOSE 63 K 2851 HASH JOIN 63 K 10 M 2851
PARTITION RANGE SINGLE KEY KEY
TABLE ACCESS FULL RRP0.MV_RRP00010 91 K 2 M 1389 KEY KEY PARTITION RANGE SINGLE KEY KEY
TABLE ACCESS FULL RRP0.TB_RRP00115 48 K 6 M 1290 KEY KEY Received on Tue Jan 16 2007 - 09:11:30 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US