Home » RDBMS Server » Performance Tuning » Merge Cartesian Join in Plan and More Reads
Merge Cartesian Join in Plan and More Reads [message #165698] Fri, 31 March 2006 11:05 Go to next message
faiz_hyd
Messages: 294
Registered: February 2006
Senior Member
Hi All

This is the select statement and Plan for it from Production,
This statement is part of Procedure, Select statement is fast will work in 2-3 seconds , but DBA is telling is doing lot of Disk reads and Physical reads, so what can be done to it.
 SELECT ALRT_PYMT_TMP.BAT_ID
   FROM ALRT, LOCKBOX_ACL, USR, LOCKBOX, LOCKBOX_CUST, ALRT_PYMT_TMP
   WHERE ALRT.USR_ID = USR.USR_ID
   AND  USR.USR_ID = LOCKBOX_ACL.USR_ID
   AND  USR.CUST_ID =  LOCKBOX_CUST.CUST_ID
   AND  LOCKBOX_CUST.LOCKBOX_ID=ALRT_PYMT_TMP.LOCKBOX_ID
   AND  LOCKBOX_ACL.ALL_LOCKBOX_IN=1
   AND  ALRT.STS_CD=1
   AND  ALRT_PYMT_TMP.PROC_ID=P_PROCESS_ID
   AND  ALRT.ALRT_ID=P_ALERT_ID
   UNION
   SELECT ALRT_PYMT_TMP.BAT_ID
   FROM ALRT, LOCKBOX_ACL, ALRT_PYMT_TMP, LOCKBOX_CUST
   WHERE   ALRT.USR_ID = LOCKBOX_ACL.USR_ID
   AND  LOCKBOX_ACL.LOCKBOX_CUST_ID =  LOCKBOX_CUST.LOCKBOX_CUST_ID
   AND  LOCKBOX_CUST.LOCKBOX_ID=ALRT_PYMT_TMP.LOCKBOX_ID
   AND  ((ALL_LOCKBOX_IN <> 1) OR (ALL_LOCKBOX_IN IS NULL))
   AND  ALRT.STS_CD=1
   AND  ALRT_PYMT_TMP.PROC_ID=P_PROCESS_ID
   AND  ALRT.ALRT_ID=P_ALERT_ID;

SELECT STATEMENT CHOOSE Cost : 29 Bytes : 2,555 Cardinality : 32
 	32 SORT UNIQUE Cost : 29 Bytes : 2,555 Cardinality : 32
 	 	31 UNION-ALL 
 	 	 	17 MERGE JOIN CARTESIAN Cost : 14 Bytes : 2,480 Cardinality : 31
 	 	 	 	14 NESTED LOOPS Cost : 11 Bytes : 80 Cardinality : 1
 	 	 	 	 	12 MERGE JOIN CARTESIAN Cost : 11 Bytes : 576 Cardinality : 8
 	 	 	 	 	 	8 NESTED LOOPS Cost : 4 Bytes : 25 Cardinality : 1
 	 	 	 	 	 	 	5 NESTED LOOPS Cost : 2 Bytes : 18 Cardinality : 1
 	 	 	 	 	 	 	 	2 TABLE ACCESS BY INDEX ROWID R1APP.ALRT Cost : 1 Bytes : 10 Cardinality : 1
 	 	 	 	 	 	 	 	 	1 INDEX UNIQUE SCAN R1APP.XPK_ALR Cardinality : 1
 	 	 	 	 	 	 	 	4 TABLE ACCESS BY INDEX ROWID R1APP.USR Cost : 1 Bytes : 8 Cardinality : 1
 	 	 	 	 	 	 	 	 	3 INDEX UNIQUE SCAN R1APP.XPK_USR Cardinality : 1
 	 	 	 	 	 	 	7 TABLE ACCESS BY INDEX ROWID R1APP.LOCKBOX_ACL Cost : 2 Bytes : 7 Cardinality : 1
 	 	 	 	 	 	 	 	6 INDEX RANGE SCAN R1APP.XAK_LOCACL_USRID_LOCACLID Cost : 1 Cardinality : 1
 	 	 	 	 	 	11 BUFFER SORT Cost : 9 Bytes : 611 Cardinality : 13
 	 	 	 	 	 	 	10 TABLE ACCESS BY INDEX ROWID R1APP.ALRT_PYMT_TMP Cost : 7 Bytes : 611 Cardinality : 13
 	 	 	 	 	 	 	 	9 INDEX RANGE SCAN R1APP.XIE_ALRPYMTMP_PRCID Cost : 2 Cardinality : 13
 	 	 	 	 	13 INDEX UNIQUE SCAN R1APP.XAK_LOCCUS_LOCID_CUSID Bytes : 8 Cardinality : 1
 	 	 	 	16 BUFFER SORT Cost : 14 Cardinality : 5,772
 	 	 	 	 	15 INDEX FAST FULL SCAN R1APP.XIF_LOC_CRCID Cost : 3 Cardinality : 5,772
 	 	 	30 NESTED LOOPS Cost : 9 Bytes : 75 Cardinality : 1
 	 	 	 	25 NESTED LOOPS Cost : 4 Bytes : 28 Cardinality : 1
 	 	 	 	 	22 NESTED LOOPS Cost : 3 Bytes : 20 Cardinality : 1
 	 	 	 	 	 	19 TABLE ACCESS BY INDEX ROWID R1APP.ALRT Cost : 1 Bytes : 10 Cardinality : 1
 	 	 	 	 	 	 	18 INDEX UNIQUE SCAN R1APP.XPK_ALR Cardinality : 1
 	 	 	 	 	 	21 TABLE ACCESS BY INDEX ROWID R1APP.LOCKBOX_ACL Cost : 2 Bytes : 10 Cardinality : 1
 	 	 	 	 	 	 	20 INDEX RANGE SCAN R1APP.XAK_LOCACL_USRID_LOCACLID Cost : 1 Cardinality : 1
 	 	 	 	 	24 TABLE ACCESS BY INDEX ROWID R1APP.LOCKBOX_CUST Cost : 1 Bytes : 8 Cardinality : 1
 	 	 	 	 	 	23 INDEX UNIQUE SCAN R1APP.XPK_LOCCUS Cardinality : 1
 	 	 	 	29 TABLE ACCESS BY INDEX ROWID R1APP.ALRT_PYMT_TMP Cost : 9 Bytes : 47 Cardinality : 1
 	 	 	 	 	28 AND-EQUAL 
 	 	 	 	 	 	26 INDEX RANGE SCAN R1APP.XIE_ALRPYMTMP_LOCID Cost : 3 Cardinality : 13
 	 	 	 	 	 	27 INDEX RANGE SCAN R1APP.XIE_ALRPYMTMP_PRCID Cost : 3 Cardinality : 13


SQL Statistics
~~~~~~~~~~~~~~
-> CPU and Elapsed Time are in seconds (s) for Statement Total and in
   milliseconds (ms) for Per Execute
                                                       % Snap
                     Statement Total      Per Execute   Total
                     ---------------  ---------------  ------
        Buffer Gets:      60,504,640         11,671.4   15.40
         Disk Reads:      35,317,685          6,812.8   80.66
     Rows processed:           5,184              1.0
     CPU Time(s/ms):           4,688            904.3
 Elapsed Time(s/ms):          12,601          2,430.8
              Sorts:               0               .0
        Parse Calls:           5,184              1.0
      Invalidations:               0
      Version count:               1
    Sharable Mem(K):              15
         Executions:           5,184


Thanks

[Updated on: Fri, 31 March 2006 11:06]

Report message to a moderator

Re: Merge Cartesian Join in Plan and More Reads [message #165728 is a reply to message #165698] Fri, 31 March 2006 22:49 Go to previous message
rleishman
Messages: 3728
Registered: October 2005
Location: Melbourne, Australia
Senior Member
The cost attached to you plan does not tell us which steps are processing all that data.

Rather than AUTOTRACE, use SQL*Trace and TK*Prof. TK*Prof will tell you exactly how many rows are processed by each step in the plan. For instructions on these tools, see the Performance Tuning manual.

Ross Leishman
Previous Topic: generic SGA
Next Topic: Query Speed Slow.
Goto Forum:
  


Current Time: Fri Apr 19 20:50:37 CDT 2024