Home » RDBMS Server » Performance Tuning » Pl Help To Tune Full table Scans.
Pl Help To Tune Full table Scans. [message #65666] |
Thu, 25 November 2004 23:01 |
BhavinShah
Messages: 105 Registered: February 2004
|
Senior Member |
|
|
Dear frends,
we r using ora 9.2. I have sql and execution plan for that.. I wanted to know that can I tu ne any more This sql..
sql:
EXPLAIN PLAN
SET STATEMENT_ID = '1'
FOR
select c.trans_id,c.cop_id, c.parent_id,
c.entry_date,
c.user_id,c.l1e1_id,c.l1e1_name,c.l2e1_id,c.l2e1_name,
c.l1e2_id,c.l1e2_name,c.l2e2_id,c.l2e2_name,c.l1e3_id,c.l1e3_name,
c.l2e3_id,c.l2e3_name,c.l1e4_id,c.l1e4_name,c.l2e4_id,c.l2e4_name, c.l1e5_id,c.l1e5_name,c.l2e5_id,c.l2e5_name,c.l1e7_id,c.l1e6_id,
c.l1e6_name, c.l1e8_id,c.l1e8_name,c.logentry,c.user_id as assignedTo
from (select rownum r,
main_trn1.trans_id,main_trn1.cop_id, main_trn1.parent_id,
to_char(main_trn1.entry_date,'MM/DD/YYYY HH:MM:SS') as entry_date,
main_trn1.user_id, main_trn1.l1e1_id,main_trn1.l1e1_name,main_trn1.l2e1_id,main_trn1.l2e1_name,
main_trn1.l1e2_id,main_trn1.l1e2_name,main_trn1.l2e2_id,main_trn1.l2e2_name, main_trn1.l1e3_id,main_trn1.l1e3_name,
main_trn1.l2e3_id,main_trn1.l2e3_name, main_trn1.l1e4_id,main_trn1.l1e4_name,main_trn1.l2e4_id,main_trn1.l2e4_name,
main_trn1.l1e5_id,main_trn1.l1e5_name,main_trn1.l2e5_id,main_trn1.l2e5_name, main_trn1.l1e7_id, main_trn1.l1e6_id,
main_trn1.l1e6_name, main_trn1.l1e8_id,main_trn1.l1e8_name, main_trn2.logentry, main_trn2.user_id as assignedTo
from
main_trn1,main_trn2
where
main_trn1.trans_id = main_trn2.trans_id
and main_trn1.cop_id =1
connect by prior main_trn1.trans_id = main_trn1.parent_id start with main_trn1.parent_id is null) c
where c.r between 5 and 10
Execution Plan :
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost
------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 3632 | 8519K| | 568
|* 1 | VIEW | | 3632 | 8519K| | 568
| 2 | COUNT | | | | |
|* 3 | FILTER | | | | |
|* 4 | CONNECT BY WITH FILTERING| | | | |
|* 5 | FILTER | | | | |
| 6 | COUNT | | | | |
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------
| 7 | MERGE JOIN | | 3632 | 1532K| | 568
| 8 | SORT JOIN | | 3632 | 1301K| 2916K| 473
| 9 | TABLE ACCESS FULL | MAIN_TRN2 | 3632 | 1301K| | 66
|* 10 | SORT JOIN | | 3634 | 230K| 980K| 95
| 11 | TABLE ACCESS FULL | MAIN_TRN1 | 3634 | 230K| | 13
| 12 | HASH JOIN | | | | |
| 13 | CONNECT BY PUMP | | | | |
| 14 | COUNT | | | | |
| 15 | MERGE JOIN | | 3632 | 1532K| | 568
| 16 | SORT JOIN | | 3632 | 1301K| 2916K| 473
| 17 | TABLE ACCESS FULL | MAIN_TRN2 | 3632 | 1301K| | 66
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------
|* 18 | SORT JOIN | | 3634 | 230K| 980K| 95
| 19 | TABLE ACCESS FULL | MAIN_TRN1 | 3634 | 230K| | 13
------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("C"."R"<=10 AND "C"."R">=5)
3 - filter("MAIN_TRN1"."COP_ID"=1)
4 - filter("MAIN_TRN1"."PARENT_ID" IS NULL)
5 - filter("MAIN_TRN1"."PARENT_ID" IS NULL)
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------
10 - access("MAIN_TRN1"."TRANS_ID"="MAIN_TRN2"."TRANS_ID")
filter("MAIN_TRN1"."TRANS_ID"="MAIN_TRN2"."TRANS_ID")
18 - access("MAIN_TRN1"."TRANS_ID"="MAIN_TRN2"."TRANS_ID")
filter("MAIN_TRN1"."TRANS_ID"="MAIN_TRN2"."TRANS_ID")
Note: cpu costing is off
39 rows selected.
Frends Here main_trn1.trans_id is primary key.
Bhavin.....
|
|
|
|
Goto Forum:
Current Time: Mon Dec 23 00:02:15 CST 2024
|