Exactly how bad is this explain plan?
Hi,
I'm on Oracle 9i - 9.2.0.6.0.
First, please excuse my question, I'm not that good at reading explain plans.
I have this explain plan:
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
| 0 | SELECT STATEMENT | | 70057 | 20M| | 114K (12)|
|* 1 | FILTER | | | | | |
| 2 | TABLE ACCESS FULL | DUAL | 82 | | | 3 (34)|
|* 3 | INDEX RANGE SCAN | CHANGELOG_1 | 1 | 44 | | 2217 (3)|
| 4 | NESTED LOOPS OUTER | | 70057 | 20M| | 114K (12)|
| 5 | NESTED LOOPS OUTER | | 67062 | 18M| | 113K (11)|
| 6 | NESTED LOOPS OUTER | | 64194 | 16M| | 111K (10)|
| 7 | NESTED LOOPS OUTER | | 61450 | 14M| | 110K (9)|
| 8 | NESTED LOOPS OUTER | | 58823 | 13M| | 109K (8)|
| 9 | NESTED LOOPS OUTER | | 56308 | 12M| | 107K (6)|
| 10 | NESTED LOOPS OUTER | | 53900 | 11M| | 106K (5)|
| 11 | NESTED LOOPS OUTER | | 51596 | 10M| | 105K (4)|
| 12 | NESTED LOOPS OUTER | | 49390 | 9212K| | 104K (3)|
| 13 | NESTED LOOPS OUTER | | 47278 | 8310K| | 102K (2)|
|* 14 | HASH JOIN | | 31639 | 5067K| 4576K| 7331 (13)|
|* 15 | HASH JOIN | | 31639 | 4202K| 1936K| 1372 (9)|
| 16 | TABLE ACCESS FULL | COMPANY | 76111 | 1040K| | 335 (15)|
|* 17 | HASH JOIN | | 31649 | 3770K| | 933 (7)|
| 18 | TABLE ACCESS FULL | AGREEMENT | 149 | 3129 | | 3 (34)|
|* 19 | HASH JOIN | | 31649 | 3121K| | 928 (6)|
| 20 | TABLE ACCESS FULL | CONCRETEAGREEMENT | 34172 | 333K| | 55 (24)|
|* 21 | TABLE ACCESS BY INDEX ROWID| SPECIFICATION | 31649 | 2812K| | 866 (4)|
|* 22 | INDEX RANGE SCAN | SPECIFICATION_DATE | 37437 | | | 143 (5)|
| 23 | TABLE ACCESS FULL | PERSON | 1786K| 47M| | 4584 (11)|
|* 24 | TABLE ACCESS BY INDEX ROWID | INFORMATION | 1 | 16 | | 4 (25)|
|* 25 | INDEX RANGE SCAN | INFORMATION_SPECIFICATION | 2 | | | 3 (34)|
|* 26 | TABLE ACCESS BY INDEX ROWID | INFORMATION | 1 | 11 | | |
|* 27 | INDEX RANGE SCAN | INFORMATION_SPECIFICATION | 2 | | | 3 (34)|
|* 28 | TABLE ACCESS BY INDEX ROWID | INFORMATION | 1 | 14 | | |
|* 29 | INDEX RANGE SCAN | INFORMATION_SPECIFICATION | 2 | | | 3 (34)|
|* 30 | TABLE ACCESS BY INDEX ROWID | INFORMATION | 1 | 14 | | |
|* 31 | INDEX RANGE SCAN | INFORMATION_SPECIFICATION | 2 | | | 3 (34)|
|* 32 | TABLE ACCESS BY INDEX ROWID | INFORMATION | 1 | 11 | | |
|* 33 | INDEX RANGE SCAN | INFORMATION_SPECIFICATION | 2 | | | 3 (34)|
|* 34 | TABLE ACCESS BY INDEX ROWID | INFORMATION | 1 | 13 | | |
|* 35 | INDEX RANGE SCAN | INFORMATION_SPECIFICATION | 2 | | | 3 (34)|
|* 36 | TABLE ACCESS BY INDEX ROWID | INFORMATION | 1 | 12 | | |
|* 37 | INDEX RANGE SCAN | INFORMATION_SPECIFICATION | 2 | | | 3 (34)|
|* 38 | TABLE ACCESS BY INDEX ROWID | INFORMATION | 1 | 15 | | |
|* 39 | INDEX RANGE SCAN | INFORMATION_SPECIFICATION | 2 | | | 3 (34)|
|* 40 | TABLE ACCESS BY INDEX ROWID | INFORMATION | 1 | 17 | | |
|* 41 | INDEX RANGE SCAN | INFORMATION_SPECIFICATION | 2 | | | 3 (34)|
|* 42 | TABLE ACCESS BY INDEX ROWID | INFORMATION | 1 | 17 | | |
|* 43 | INDEX RANGE SCAN | INFORMATION_SPECIFICATION | 2 | | | 3 (34)|
--------------------------------------------------------------------------------------------------------------------- I can see that there are some FULL TABLE SCAN, but this may be OK. What worries me is the combination with numerous NESTED LOOPS.
A CTAS for approx 500.000 records out of 14.000.000 runs in about 180 mins. This is too much. My guess is that it should/could be brought down to something like 20 min.
For completeness, the query in question:
SELECT *
FROM stik_spec_inf_v
WHERE spdate >= to_date('15-03-2008', 'dd-mm-yyyy')
AND spdate < to_date('15-04-2008', 'dd-mm-yyyy');Wher eview is created as
CREATE OR REPLACE FORCE VIEW stik_spec_inf_v
AS
SELECT CAST(1 AS NUMBER(3)) dataversion
,sp.ID AS spid
,sp."DATE" AS spdate
,sp.valuedate
,sp.amount
,sp.amountcode
,sp.periodstart
,sp.periodend
,sp.ambcode
,sp.state AS spstate
,sp."TYPE" AS sptype
,sp.respitedate
,sp.stopcode
,sp.validcode
,sp.person
,sp.company
,sp.concreteagreement
,sp.reconciliation
,sp.partialscheme
,(SELECT 1
FROM dual
WHERE EXISTS(
SELECT 1
FROM changelog
WHERE targetclass = 'com.csc.jpay.voucher.Specification'
AND targetid = sp.ID)) spchanged
,i1.startdate AS daekgagedato
,i1.amount AS daekgage
,i2.startdate AS prmgagedato
,i2.amount AS prmgage
,i3.employerpercent
,i3.employeepercent
,i3.voluntarypercent
,i5.salaryperiod
,i6.groupcontractcode
,i7.workinghourspercent
,i9.startdate AS hiringdate
,i10.startdate AS resignationdate
,i21.policenumber
,ix."TYPE" AS leavecode
,ix.startdate AS leavestartdate
,ix.enddate AS leaveenddate
,pe.cpr
,pe.ksdid
,co.opkr_number
,a.NAME AS agreement_name
FROM SPECIFICATION sp
,information i1
,information i2
,information i3
,information i5
,information i6
,information i7
,information i9
,information i10
,information i21
,information ix
,person pe
,company co
,concreteagreement ca
,agreement a
WHERE 1 = 1
AND i1.SPECIFICATION(+) = sp.ID
AND i1."TYPE"(+) = 1
AND i2.SPECIFICATION(+) = sp.ID
AND i2."TYPE"(+) = 2
AND i3.SPECIFICATION(+) = sp.ID
AND i3."TYPE"(+) = 3
AND i5.SPECIFICATION(+) = sp.ID
AND i5."TYPE"(+) = 5
AND i6.SPECIFICATION(+) = sp.ID
AND i6."TYPE"(+) = 6
AND i7.SPECIFICATION(+) = sp.ID
AND i7."TYPE"(+) = 7
AND i9.SPECIFICATION(+) = sp.ID
AND i9."TYPE"(+) = 9
AND i10.SPECIFICATION(+) = sp.ID
AND i10."TYPE"(+) = 10
AND i21.SPECIFICATION(+) = sp.ID
AND i21."TYPE"(+) = 21
AND ix.SPECIFICATION(+) = sp.ID
AND ix."TYPE"(+) > 10
AND ix."TYPE"(+) < 21
AND pe.ID = sp.person
AND co.ID = sp.company
AND ca.ID = sp.concreteagreement
AND a.ID = ca.agreement;Please excuse my lengthy post. I still hope for some valuable input.
Thanks
Peter
Hi,
I have tried with an in-line view as John suggested. This give a FULL TABLE SCAN on information.
SELECT /*+ RULE */ * FROM (
SELECT sp.id spid, sp."DATE" spdate
FROM (SELECT SPECIFICATION
,max(decode("TYPE", 1, startdate)) daekgagedato
,max(decode("TYPE", 1, amount)) daekgage
,max(decode("TYPE", 2, startdate)) prmgagedato
,max(decode("TYPE", 2, amount)) prmgage
,max(decode("TYPE", 3, employerpercent)) employerpercent
,max(decode("TYPE", 3, employeepercent)) employeepercent
,max(decode("TYPE", 3, voluntarypercent)) voluntarypercent
,max(decode("TYPE", 5, salaryperiod)) salaryperiod
,max(decode("TYPE", 6, groupcontractcode)) groupcontractcode
,max(decode("TYPE", 7, workinghourspercent)) workinghourspercent
,max(decode("TYPE", 9, startdate)) hiringdate
,max(decode("TYPE", 10, startdate)) resignationdate
,max(decode("TYPE", 21, policenumber)) policenumber
,max(decode(sign("TYPE" - 10),1, decode(sign("TYPE" - 21), -1, "TYPE"))) leavecode
,max(decode(sign("TYPE" - 10),1, decode(sign("TYPE" - 21), -1, startdate))) leavestartdate
,max(decode(sign("TYPE" - 10),1, decode(sign("TYPE" - 21), -1, enddate))) leaveenddate
FROM information
WHERE TYPE BETWEEN 1 AND 21
GROUP BY SPECIFICATION) i
,SPECIFICATION sp
WHERE 1 = 1
AND sp.ID = i.SPECIFICATION)
WHERE spid = 1Any ideas on how to get around that?
Regards
Peter
Similar Messages
-
1. How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?
When multiple tables are involved , and the actual number of rows returned is more than what the explain plan tells. How can I find out what change is needed in the stat plan ?
2. Does rowsource statistics gives some kind of understanding of Extended stats ?You can get Row Source Statistics only *after* the SQL has been executed. An Explain Plan midway cannot give you row source statistics.
To get row source statistics either set STATISTICS_LEVEL='ALL' in the session that executes theSQL OR use the Hint "gather_plan_statistics" in the SQL being executed.
Then use dbms_xplan.display_cursor
Hemant K Chitale -
I have a 3GS. Am trying to sync a plantronics explorer 232 Bluetooth headset and can't figure it out. I have Bluetooth turned on but it searches for devices and the headset never shows up. Anyone know exactly how to do this? My tech skills are lacking
I have the same blueparrott headset headset with the directions. Actually reading them just fixed my iphone pairing issue.
Here they are in case u still need them along with what I needed to do to get mine to work with iphone 4
Pair Headset with Phone
Turn off headset off
Hold down headset's MFB (large top button) until red & blue lights flash and you hear 2 rising tones, followed by 4 more tones. Must wait for all before you release the MFB button!! (I had my hubby hold the MFB while I waited for the tones since both come from the headset
Release the MFB and follow your phone's instructions to place it in 'bluetooth' discoverable mode. With the iphone4, go to "General" and then "Bluetooth" and turn indicator to "ON".
This is where my issue occurred as the phone could not find the bluetooth, although it worked with my LG phone. So after trying it several times thinking I was nuts and that the issue was with the iphone, I looked further in the blueparrot's directions and found this step that fixed the issue.
Reset Paired Devices List
On the bluetooth, press and hold down both the volume up & volume down buttons for 5-6 seconds. A double beep will be heard and the list will be reset. Pairing info for devices previously paired will be lost.
The bluetooth directions provide this as step 4 but that did not work for my phone (see below)
4. Once the phone discovers the headset, select "pair" and enter "0000" code and that when pairing is complete the blue light on the headset will stop flashing and phone will prompt you to 'connect'.
This is what I had to do after resetting the device list on my bluetooth
4. My iphone instanting discovered the headset and displayed it under 'Devices" but showed a message that it was 'not connected'. Once I selected the device on the iphone by pressing on it then it changed to "connected".
Even when I turn the bluetooth on and off the device remains on the list and alll I do is select it to connect and disconnect after I turn on my blueparrott bluetooth
I hope this helps others! -
How to change the explain plan for currently running query?
Hi All,
I am using Oracle enterprise 9i edition. I have a query which frames dynamically and running in the database. I noticed a table with 31147758 rows
in the query which has no indexes and taking more time to process. I tried to create an INdex on that table. I know the query is already running with a FULL table scan. Is it possible to change the explain plan for the current running query to consider the INDEX?
[code]
SELECT /*+ USE_HASH (c,e,b,a) */
d.att_fcc extrt_prod_dim_id,
d.att_fcc compr_prod_dim_id,
a.glbl_uniq_id glbl_uniq_id,
to_date(c.dit_code,'RRRRMMDD')STRT_DT,
(to_date(c.dit_code,'RRRRMMDD')+150)END_DT,
a.pat_nbr pat_id,
a.rxer_id rxer_id,
e.rxer_geog_id rxer_geog_id,
a.pharmy_id pharmy_id,
a.pscr_pack_id pscr_pack_id,
a.dspnsd_pack_id dspnsd_pack_id,
DENSE_RANK () OVER (PARTITION BY a.pat_nbr ORDER BY c.dit_code) daterank,
COUNT( DISTINCT d.att_fcc ) OVER (PARTITION BY a.pat_nbr, c.dit_code) event_cnt
DENSE_RANK () OVER (PARTITION BY a.pat_nbr,
d.att_fcc
ORDER BY c.dit_code) prodrank,
DENSE_RANK () OVER (PARTITION BY a.pat_nbr,
d.att_fcc
ORDER BY c.dit_code DESC) stoprank
FROM
pd_dimitems c,
pd_pack_attribs d ,
lrx_tmp_rxer_geog e,
lrx_tmp_pat_daterank p,
lrx_tmp_valid_fact_link a
WHERE c.dit_id = a.tm_id
AND e.rxer_id = a.rxer_id
AND a.glbl_uniq_id = p.glbl_uniq_id
AND p.daterank > 1
AND a.pscr_pack_id = d.att_dit_id
[/code]
The table lrx_tmp_pat_daterank is having that 31147758 rows. So I am wondering how to make the query to use the newly created index on the table?Why do you think using Indexes will improve the performance of the query? How many rows this query is returning? Optimizer might chose a Full table scan when it finds out that Index plan might not be useful. Why are you using /*+ USE_HASH (c,e,b,a) */ hint? This Hint will force oracle to use Full table scan instead of using the index. Try removing it and see if the plan changes.
Regards, -
How to see an explain plan?
Hi all,
I'm looking to tune one sql sentence of my application. To do it, I've used the sqltune package. When I see the report, I obtain the actual explain plan and, finally the suggestion to use an SQL Profile.
How can I see the new explain plan of this option before apply it?
I attach the report result for your information:
SELECT DBMS_SQLTUNE.report_tuning_task('analisis_matriculation_view') AS recommendations FROM dual;SQL> SQL> SQL>
RECOMMENDATIONS
GENERAL INFORMATION SECTION
Tuning Task Name : analisis_matriculation_view
Tuning Task Owner : A9
Scope : COMPREHENSIVE
Time Limit(seconds) : 3600
Completion Status : COMPLETED
Started at : 08/11/2010 09:33:18
Completed at : 08/11/2010 10:23:16
Number of SQL Profile Findings : 1
Schema Name: A9
SQL ID : gd8b5pwyj0yu8
SQL Text : SELECT PO.ID POID, BO.ID BOID, MAT.AGENT_ID AGENTID,
MAT.AGENCY_ID AGENCYID, MAT.ID MATID,MAT.PARTNERBRANCH_ID
PBRANCHID, MAT.DOSSIERNUMBER, MAT.DOSSIERVERSION,
MAT.FILINGDATE,MAT.TELEMATIC, MAT.MANUALDGTTAXCODE,
MAT.ASSIGNDGTTAX, MAT.STATUS, MAT.PLATENUMBER,MAT.REJECTIONCAUSE,
MAT.REJECTIONNOTES, MAT.COLOR, MAT.CREATEDON, MAT.MODIFIEDON,
FO.COLOR,AG.MEMBERID, US.NAME AGENTNAME, US.SURNAME
AGENTSURNAME, US.SURNAME2 AGENTSURNAME2, US.NIF AGENTNIF,AY.NAME
AGENCYNAME, VD.SERIALNUMBER, VOWN.NAME OWNERNAME, VOWN.SURNAME
OWNERSURNAME,VOWN.SURNAME2 OWNERSURNAME2, UPPER(VOWN.NAME) || '
' || UPPER(VOWN.SURNAME) || ' ' || UPPER(VOWN.SURNAME2)
OWNERFULLNAME,VOWN.FISCALID OWNERNIF, FO.ID FOLDERID, FO.NAME
FOLDERNAME, FO.STATUS FOLDERSTATUS, IVTM.ID IVTMID,IVTM.STATUS
IVTMSTATUS, IVTM.FINALAMOUNT IVTMAMOUNT, IVTM.IVTMCOLLECTOR,
F576.ID F576ID,F576.PAYMENTCOMPLETEREFNUMBER NRC576,
F576.MATRICULATIONCODE CEM576, F576.AEATELECTRONICCODEMANUAL
CEM576MANUAL,F576.NRCMANUAL NRC576MANUAL, F06.ID F06ID,
F06.MATRICULATIONCODE CEM06, F06.AEATELECTRONICCODEMANUAL
CEM06MANUAL,F06.NRE NRE06, F06.NREMANUAL NRE06MANUAL, F05.ID
F05ID, F05.MATRICULATIONCODE CEM05, F05.AEATELECTRONICCODEMANUAL
CEM05MANUAL FROM A9_MATRICULATION MAT INNER JOIN A9_AGENT AG ON
(MAT.AGENT_ID = AG.ID) INNER JOIN A9_USER US ON (AG.ID = US.ID)
INNER JOIN A9_BRANCHOFFICE BO ON (AG.BRANCHOFFICE_ID = BO.ID)
INNER JOIN A9_PROFESSIONALORDER PO ON (BO.PROFESSIONALORDER_ID =
PO.ID) INNER JOIN A9_AGENCY AY ON (MAT.AGENCY_ID = AY.ID) INNER
JOIN A9_VEHICLEDATA VD ON (MAT.VEHICLEDATA_ID = VD.ID) INNER
JOIN A9_VEHICLEOWNER VOWN ON (VOWN.MATRICULATION_ID = MAT.ID)
LEFT JOIN A9_MATRICULATIONFOLDER FO ON
(MAT.MATRICULATIONFOLDER_ID = FO.ID) LEFT JOIN A9_IVTM IVTM ON
(MAT.IVTM_ID = IVTM.ID)LEFT JOIN A9_FORM576 F576 ON
(MAT.FORM576_ID = F576.ID) LEFT JOIN A9_FORM05 F05 ON
(MAT.FORM05_ID = F05.ID) LEFT JOIN A9_FORM06 F06 ON
(MAT.FORM06_ID = F06.ID) WHERE VOWN.MAINOWNER = 1 AND MAT.VALID
= 1 AND US.DELETEDON IS NULL AND PO.DELETEDON IS NULL AND
BO.DELETEDON IS NULL AND AY.DELETEDON IS NULL AND VOWN.DELETEDON
IS NULL AND FO.DELETEDON IS NULL AND IVTM.DELETEDON IS NULL AND
VD.DELETEDON IS NULL AND F576.DELETEDON IS NULL AND
F05.DELETEDON IS NULL AND F06.DELETEDON IS NULL AND
MAT.DELETEDON IS NULL ORDER BY DOSSIERNUMBER DESC
FINDINGS SECTION (1 finding)
1- SQL Profile Finding (see explain plans section below)
Se ha encontrado un plan de ejecucion potencialmente mejor para esta
sentencia.
Recommendation (estimated benefit: 35,82%)
- Puede aceptar el perfil SQL recomendado.
execute dbms_sqltune.accept_sql_profile(task_name =>
'analisis_matriculation_view', replace => TRUE);
EXPLAIN PLANS SECTION
1- Original With Adjusted Cost
Plan hash value: 1271206505
Id Operation Name Rows Bytes TempSpc Cost (%CPU) Time
0 SELECT STATEMENT 4728K 2015M 783K (1) 02:36:41
1 SORT ORDER BY 4728K 2015M 4346M 783K (1) 02:36:41
* 2 HASH JOIN 4728K 2015M 1857M 333K (1) 01:06:48
* 3 HASH JOIN 4728K 1803M 1736M 231K (1) 00:46:14
* 4 HASH JOIN 4728K 1682M 133K (1) 00:26:42
* 5 TABLE ACCESS FULL A9_AGENCY 1076 34432 8 (0) 00:00:01
* 6 FILTER
* 7 HASH JOIN OUTER 5029K 1635M 1568M 133K (1) 00:26:42
* 8 FILTER
* 9 HASH JOIN OUTER 5029K 1510M 235M 45724 (2) 00:09:09
* 10 FILTER
* 11 HASH JOIN RIGHT OUTER 846K 226M 7792K 23780 (2) 00:04:46
12 TABLE ACCESS FULL A9_MATRICULATIONFOLDER 185K 5613K 731 (2) 00:00:09
* 13 FILTER
* 14 HASH JOIN RIGHT OUTER 846K 201M 6784K 12190 (2) 00:02:27
15 TABLE ACCESS FULL A9_FORM06 192K 4517K 1340 (3) 00:00:17
* 16 FILTER
* 17 HASH JOIN RIGHT OUTER 65680 14M 2784K 9769 (2) 00:01:58
18 TABLE ACCESS FULL A9_FORM05 91913 1705K 592 (2) 00:00:08
* 19 HASH JOIN 65680 12M 8360 (2) 00:01:41
* 20 HASH JOIN 560 37520 25 (8) 00:00:01
* 21 HASH JOIN 560 14560 10 (10) 00:00:01
* 22 HASH JOIN 8 112 7 (15) 00:00:01
* 23 TABLE ACCESS FULL A9_PROFESSIONALORDER 6 30 3 (0) 00:00:01
* 24 TABLE ACCESS FULL A9_BRANCHOFFICE 16 144 3 (0) 00:00:01
25 TABLE ACCESS FULL A9_AGENT 1053 12636 3 (0) 00:00:01
* 26 TABLE ACCESS FULL A9_USER 2245 92045 14 (0) 00:00:01
* 27 TABLE ACCESS FULL A9_MATRICULATION 123K 16M 8333 (2) 00:01:41
28 TABLE ACCESS FULL A9_FORM576 899K 30M 8158 (2) 00:01:38
29 TABLE ACCESS FULL A9_IVTM 1207K 29M 7562 (3) 00:01:31
* 30 TABLE ACCESS FULL A9_VEHICLEDATA 979K 25M 9552 (1) 00:01:55
* 31 TABLE ACCESS FULL A9_VEHICLEOWNER 983K 44M 7771 (2) 00:01:34
Predicate Information (identified by operation id):
2 - access("VOWN"."MATRICULATION_ID"="MAT"."ID")
3 - access("MAT"."VEHICLEDATA_ID"="VD"."ID")
4 - access("MAT"."AGENCY_ID"="AY"."ID")
5 - filter("AY"."DELETEDON" IS NULL)
6 - filter("IVTM"."DELETEDON" IS NULL)
7 - access("MAT"."IVTM_ID"="IVTM"."ID"(+))
8 - filter("F576"."DELETEDON" IS NULL)
9 - access("MAT"."FORM576_ID"="F576"."ID"(+))
10 - filter("FO"."DELETEDON" IS NULL)
11 - access("MAT"."MATRICULATIONFOLDER_ID"="FO"."ID"(+))
13 - filter("F06"."DELETEDON" IS NULL)
14 - access("MAT"."FORM06_ID"="F06"."ID"(+))
16 - filter("F05"."DELETEDON" IS NULL)
17 - access("MAT"."FORM05_ID"="F05"."ID"(+))
19 - access("MAT"."AGENT_ID"="AG"."ID")
20 - access("AG"."ID"="US"."ID")
21 - access("AG"."BRANCHOFFICE_ID"="BO"."ID")
22 - access("BO"."PROFESSIONALORDER_ID"="PO"."ID")
23 - filter("PO"."DELETEDON" IS NULL)
24 - filter("BO"."DELETEDON" IS NULL)
26 - filter("US"."DELETEDON" IS NULL)
27 - filter("MAT"."VALID"=1 AND "MAT"."DELETEDON" IS NULL)
30 - filter("VD"."DELETEDON" IS NULL)
31 - filter("VOWN"."DELETEDON" IS NULL AND "VOWN"."MAINOWNER"=1)
2- Using SQL Profile
Plan hash value: 1408211821
Best regards,
dbajug
Edited by: dbajug on Aug 11, 2010 6:31 AMHi all,
the aswer is on this post:
Re: Explain plan
Regards,
dbajug -
*** Interpreting this explain plan ***
Hi,
Please find the explain plan for following: I dont understand why rows = 1 in step 4 and 5 of explain plan?? There are 6 rows corresponding to the condition in join that is satisfied in service def table. Still it shows 1??
explain plan for SELECT costpools.cost_pool_id, servicedef.service_name,
costpools.special_calc
FROM cost_pools costpools, service_definitions servicedef
WHERE costpools.service_def_id = servicedef.service_def_id
AND costpools.special_calc = 'Y'
ORDER BY servicedef.service_name;
PLAN_TABLE_OUTPUT
Plan hash value: 3404549211
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 6 | 270 | 15 (7)| 00:00:01 |
| 1 | SORT ORDER BY | | 6 | 270 | 15 (7)| 00:00:01 |
| 2 | NESTED LOOPS | | 6 | 270 | 14 (0)| 00:00:01 |
|* 3 | TABLE ACCESS FULL | COST_POOLS | 6 | 60 | 8 (0)| 00:00:01 |
| 4 | TABLE ACCESS BY INDEX ROWID| SERVICE_DEFINITIONS | 1 | 35 | 1 (0)| 00:00:0
|* 5 | INDEX UNIQUE SCAN | SERVICE_DEFINITIONS_PK | 1 | | 0 (0)| 00:00:01
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
3 - filter("COSTPOOLS"."SPECIAL_CALC"='Y')
5 - access("COSTPOOLS"."SERVICE_DEF_ID"="SERVICEDEF"."SERVICE_DEF_ID")
18 rows selected.
regds,
sI mean how is it executed.....there are 6 rows in the
service_def table that satisfies the join condition
right.....so the cardinlity shud be 6 instead of 1
..isnt it??That's not the way it works in an explain plan. It works as SomeoneElse said: an index unique scan as the second step inside a nested loop will retrieve 1 row (index unique scan) but 6 times (nested loop). In the plan you'll see a "1". However, if you look at the row source operation in tkprof, it will tell you how many rows were flowing through this step in total, so here it reports 6.
SQL> create table cost_pools
2 as
3 select level cost_pool_id
4 , 'Y' special_calc
5 , level service_def_id
6 from dual
7 connect by level <= 6
8 /
Tabel is aangemaakt.
SQL> create table service_definitions
2 as
3 select 'A' service_name
4 , level service_def_id
5 from dual
6 connect by level <= 10000
7 /
Tabel is aangemaakt.
SQL> alter table service_definitions add constraint service_definitions_pk primary key (service_def_id)
2 /
Tabel is gewijzigd.
SQL> exec dbms_stats.gather_table_stats(user,'cost_pools')
PL/SQL-procedure is geslaagd.
SQL> exec dbms_stats.gather_table_stats(user,'service_definitions',cascade=>true)
PL/SQL-procedure is geslaagd.
SQL> explain plan
2 for
3 SELECT costpools.cost_pool_id, servicedef.service_name,
4 costpools.special_calc
5 FROM cost_pools costpools, service_definitions servicedef
6 WHERE costpools.service_def_id = servicedef.service_def_id
7 AND costpools.special_calc = 'Y'
8 ORDER BY servicedef.service_name
9 /
Uitleg is gegeven.
SQL> select * from table(dbms_xplan.display)
2 /
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 6 | 78 | 5 (20)|
| 1 | SORT ORDER BY | | 6 | 78 | 5 (20)|
| 2 | NESTED LOOPS | | 6 | 78 | 4 (0)|
|* 3 | TABLE ACCESS FULL | COST_POOLS | 6 | 48 | 3 (34)|
| 4 | TABLE ACCESS BY INDEX ROWID| SERVICE_DEFINITIONS | 1 | 5 | 2 (50)|
|* 5 | INDEX UNIQUE SCAN | SERVICE_DEFINITIONS_PK | 1 | | |
Predicate Information (identified by operation id):
3 - filter("COSTPOOLS"."SPECIAL_CALC"='Y')
5 - access("COSTPOOLS"."SERVICE_DEF_ID"="SERVICEDEF"."SERVICE_DEF_ID")
17 rijen zijn geselecteerd.
SQL> alter session set sql_trace true
2 /
Sessie is gewijzigd.
SQL> SELECT costpools.cost_pool_id, servicedef.service_name,
2 costpools.special_calc
3 FROM cost_pools costpools, service_definitions servicedef
4 WHERE costpools.service_def_id = servicedef.service_def_id
5 AND costpools.special_calc = 'Y'
6 ORDER BY servicedef.service_name
7 /
COST_POOL_ID S S
1 A Y
2 A Y
3 A Y
4 A Y
5 A Y
6 A Y
6 rijen zijn geselecteerd.
SQL> disconnectAnd now tkprof shows you:
SELECT costpools.cost_pool_id, servicedef.service_name,
costpools.special_calc
FROM cost_pools costpools, service_definitions servicedef
WHERE costpools.service_def_id = servicedef.service_def_id
AND costpools.special_calc = 'Y'
ORDER BY servicedef.service_name
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 4 0.00 0.00 1 17 0 6
total 6 0.00 0.00 1 17 0 6
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 9833
Rows Row Source Operation
6 SORT ORDER BY
6 NESTED LOOPS
6 TABLE ACCESS FULL OBJ#(2702816)
6 TABLE ACCESS BY INDEX ROWID OBJ#(2702817)
6 INDEX UNIQUE SCAN OBJ#(2702818) (object id 2702818)
********************************************************************************Regards,
Rob. -
How i can obtain explain plan without run the query
Hello,
i need to know the result of explain of a query without run the query, it's this possible?
Thanks and best regards.explain plan for <your query>;
select * from table(dbms_xplan.display);Regards,
Rob. -
I have been considering buying a RV for a while. My boys aren't getting any younger. We currently have our house on the market. It seems like it is going to take forever to sell. My question is how bad do you think it will hurt my credit if I were to take out a small loan for approx $10,000 for a RV? My credit scores on fico 8 are around 660-670. I know waiting until after we buy a house is probably the best idea, but it just doesn't seem like it's going to sell anytime soon and I am dying to go camping and enjoy the summer with my husband and two boys.
Kyliemarie85888 wrote:
I have been considering buying a RV for a while. My boys aren't getting any younger. We currently have our house on the market. It seems like it is going to take forever to sell. My question is how bad do you think it will hurt my credit if I were to take out a small loan for approx $10,000 for a RV? My credit scores on fico 8 are around 660-670. I know waiting until after we buy a house is probably the best idea, but it just doesn't seem like it's going to sell anytime soon and I am dying to go camping and enjoy the summer with my husband and two boys.How about teaching your boys the joy of camping in a tent while hiking in the mountains or in a campground? Most boys would rather do this than hang out in a motorhome. (Motorhomes: Think retirees). I have been reading a lot about personal finance and the rule seems to be borrow only for necessities, pay cash for luxuries. Just something to think about. I know RV's can easily cost 60K - 100K or more, so I might be concerned about a 10K RV needing expensive repairs. Your boys won't be boys forever, but the important part is that you spend time with them. They don't need an RV to enjoy their parents. You could also rent a lot of nights in a nice cabin for less than 10K if you don't like sharing your bedroom space with bugs and bears. -
Just how bad is this phone ? (E70 revisited)
I have actually forgotten how frustrating Nokia phones can be as I had confirmed by (then) new E70 to the bottom drawer because with the firrmware on it, it wouldn't work in my bluetooth enabled BMer.
What joy when I learned of the new version. Could it be that version 3.0633.09.04 (where do these numbers come from) would solve my problem ?
Well I don't know. In fact I don't even know why I tried to put it on the phone. First I downloaded the latest PC Suite (the phone I have which actually works is NOT a Nokia, so I didn't have that on the PC ). Then I downloaded the software updater. Then I connected by recharged (and still plugged into the adaptor) E70, and fired up the updater.
Next the USB message that my phone was disconnected from PC-Suite appeared, and as predicted the updater actually told me there was an update. I now had the option to leave or continue. When I continued, I got a message which told me the updater could not verify my phone !
No WAIT !! I got past this by restarting, and while the message to get out was still on the screen, I used the utility in PCSuite to reselect my phone, and when the updater continued it started the download of 48.1M. Great.
Next it came to the update bit. Again the process failed and again the solution was to do the little tinker with PC Suite to get past that point. In fact I got all the way to where the phone reboots, and shows the Nokia test screen. Here the phone seems to reconnect itself, but either its not fast enough or it's not connecting to the updater, because it reports that the update has failed. Sad but true.
Should I have known ? Should I have guessed ? I have a buddy who has had an E61, an E70 and now wants to try the E90. Is he crazy or what ? S60 does for telephony what Locusts do for corn. If only words would describe how bad this series of phones really is...
For those of you still here, who are in the queues for the E90, I admire your sense of endevour ! May the force be with you.02-Oct-200705:53 PM
joevpt wrote:
You'd think... Eh!
What I found was that at various stages during the upgrade the NSU disconnects from the phone (which allows PC-Suite reconnect). When the NSU needs to reconnect, PC-Suite was holding onto the connection (because, I think, NSU only disconnects it once at the beginning... )
Regards,
Joe
Patheticlly true. -
So today, for the first time in as long as I've owned my 2.0 GHz iMac G5, it just randomly shut down on me. I thought it was a one time thing, a power surge or something maybe, so I started it back up and went about my business. Then a few hours later, it happened again. And about 20 mins after that, again. By this point I knew something was up, so I backed up a couple vital files real quick, shut it down, and cracked it open.
This is what I saw:
http://img.photobucket.com/albums/v12/newtikki/DSC00185.jpg
So, I figured it was overheating because of the symptoms, but that looks really bad. When I closed it back up, I felt the slit in the back and couldnt feel any air coming out the half that the CPU feeds to, however, the other half (which i presume is pumped from the video card) was pumping warm air. So, how can I resolve this? I bought it in probably June of last year, so I don't have any warranty remaining. How much is this going to cost me?
Thanks,
Michael
iMac G5 Mac OS X (10.4.6)Hi Michael,
My bet is actually that your primary problem is that the power supply is failing, and that your fans just might be running poorly because of dirt buildup or lower power.
Your Mac will cut out before heat doess any damage to the processor.
There are three fans - one for the Hd, one for the processor , and one for the "system" generally. The HD fan is really the one that does the most work usually. Its "base" setting is at 2300 RPM, while the CPU one sits down around only 1500 when its not doing a lot of work. Its only under load that it kciks up higher, and even then it will rarely be running as fast as the HD fan.
So you can almost always expect to feel a bit more breeze from the HD side than the processor side of the slot.
The general system fan usually sits on about 1700 rpm until things really start to heat up.
Cheers
Rod -
How can i reduce the cost of this explain plan
Plan
SELECT STATEMENT ALL_ROWSCost: 180,804 Bytes: 984,239,144 Cardinality:
Edited by: user565033 on Dec 11, 2008 8:05 AM
Edited by: user565033 on Dec 11, 2008 8:06 AM
Edited by: user565033 on Dec 12, 2008 1:22 PMuser565033 wrote:
2. i am trying to use this query to create a materialized view. My problem is this query returns in under 5mins. But when i try to create the view ( or even a regular table), it goes in a long-op ( sort ouput) whoes time itself is over 4-5 hrs.If it takes 5 min. to return the first rows, but hours to process the complete result set, this suggests that the problem is very likely caused by the function calls, since the sort of the result set must have already been performed to return the first rows and the function calls will probably be performed using the final result set. Try to perform the same without any function calls and check if you can build then a table more quickly.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
Another battery expansion... How bad is this?
I was using my faithful MacBook Pro 17" to watch a 1080p video on my 42" LCD television, when I noticed that book was lifting up awkwardly. I turned it over and was startled to see the battery bulging from the laptop.
At first I was startled and turned the system off, then proceeded to remove the battery. I googled for similar situations and found it was more common than I would have expected.
It is a few few years old (I think it's an '08) model. What steps should or can I take regarding this situation; Is this covered by Apple or will I have to "bite the bullet" here and buy a new battery?Has this really happened? Having spoken with multiple "Authorized Apple" technicians, I'm told that this is an isolated issue that is usually replaced after a phone call to Apple. Well, I've phoned Apple after being sent BY Apple to these technicians.
The result? I was told about all the customers that got free batteries for the same exact problem. In fact, I was told they were outside of their warranty period, AND did not require extended "AppleCare" due to the nature of this odd and rare occurrence. Furthermore, I was told that these batteries were replaced within three years from the date of purchase.
My laptop is NOT older than three years.
My laptop has been in the repair shop within the last few months already, and now my "laptop" cannot even leave the proximity of its power cord.
I think I may be beginning to lose faith in the Apple brand. -
How bad is this recursive method?
Ignore the variable names.
public static int reverse(int blah)
String temp ="";
String remaining = "";
String number = Integer.toString(blah);
if(number.length() == 1)
return (Integer.parseInt(number));
else if(number.length() != 1)
temp = number.substring(number.length()-1, number.length());
remaining = number.substring(0, number.length()-1);
temp+=reverse(Integer.parseInt(remaining));
return(Integer.parseInt(temp));
}Hello,
The code wont end if its length is >2.
Will not be recursive.
ex:
234
it will return 423
thats the only issue...
Edited by: amit.khosla on Mar 1, 2009 8:52 PM -
How can i paste the explain plan from toad..
Hello all
I tried taking a snap of the explain plan from toad but in this forum the paste option is disabled...please help964145 wrote:
I tried taking a snap of the explain plan from toad but in this forum the paste option is disabled...please helpI don't know, but it is a waste of time since explain plans from Toad are not useful.
Please read the forum FAQ on providing information for a tuning request, it describes how to generate an explain plan that can be shared.
{message:id=9360003}
This is an example.
SQL> explain plan for
2 select * from dual;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 3543395131
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 2 | 2 (0)| 00:00:01 |
| 1 | TABLE ACCESS FULL| DUAL | 1 | 2 | 2 (0)| 00:00:01 |
-------------------------------------------------------------------------- -
Why bother to use explain plan?
All my colleagues used the third party applications, Crystal Report or TAOD, to query data from the 10g R2 database for some kind of reporting. The problem is they always created the query with multiple outer join (> 10 tables) and they WRITE the codes without using the explain plan. They simply used the query for result of the moment and the query they wrote only were used for few time (< 3), because the manager requested the report kept changing the requirement. They did it on both Dev and Prod
I think it is bad practice, how can I convience them to change their practice?The concept that something is ad hoc and therefore doesn't matter can break down pretty quickly when a bright light is shined upon it. But what you are fighting here is more a question of politics than technology.
If the system is still chugging along at an acceptable speed, no end-user complaints, and practices in your organization range from sloppy to lazy you should probably just polish up your resume and move to a job where people care about professional standards and doing a good job.
To change a practice such as this usually one must get to the level of childish schoolyard play and create a competitive atmosphere. Take one of those slow queries and tune it. Challenge someone to do better than you did. Offer a beer to anyone that can write it more efficiently than you did, etc. Make it a game.
But don't be surprised if the reason they aren't running explain plan is that:
1. They don't know how
2. They know how but don't know how to read the output
3. They know how to read the output but haven't a clue what to do about it.
As an example ... I know a lot of people that think they know how to output an explain plan. In truth not 10% of them understand this:
SELECT * FROM TABLE(dbms_xplan.display_cursor('cpm9ss48qd32f', 0));
http://www.psoug.org/reference/dbms_xplan.html
Which is really rather sad.
Maybe you are looking for
-
I got a brand new iPod and wanted to put the music files on my old iPod to the new one. In addition to this I would like to know how to sync my new iPod to a different computer from that of the old one. Is it possible for me to accomplish all this wi
-
My experiences of importing different formats into IMovie...!!
I’ve been through a lot of pain with IMovie for the last 6 months, and cracked it a couple of days ago. I therefore feel the need to write about my experiences. I have lots of old footage on:- 1. DV tape 2. HI8 tapes 3. Sony mini-DVDs 4. DVDs 5. Sony
-
Java class integration with Oracle Identity Manager 9.1.0.2
Hello Friends, I have a java class that is responsible for sending notifications, my question is how do the relationship of this class with the Oracle Identity Manager 9.1.0.2 so you can take the class and notify users when an application is approved
-
WHY IS S.M.A.R.T STATUS SUPPORTED ON ATA BUS BUT NOT ON SCSI?
I have 4 internal HD's on a G4 733 S-Drive (Digital Audio) running X.4.4 and my question is: Why is S.M.A.R.T STATUS supported on the ATA bus but not on the SCSI bus? Is there something wrong with my computer if only 2 of the 4 internal HD's read "Ve
-
I am having difficulty with PeopleSoft allowing us to enter a voucher including VAT, when the ship to country and ship from country are different, but both countries are still in the European Union, and the vendor is charging us VAT. I am sure we hav