Understanding explain plan output

Hi,
Version 11202.
Bellow is the output of tkprof against a statment which has cpu time = elapsed time =~3000 sec.
The statment is related to oracle EBS , but the question bellow is regarding the execution plan.
As you can see in the plan bellow most of the time is spend on the following step :
         0          0          0      TABLE ACCESS BY INDEX ROWID IBY_PMT_INSTR_USES_ALL (cr=44630892 pr=31557 pw=0 time=3075553107 us cost=3 size=95402360 card=2385059)
2059303280 2059303280 2059303280       INDEX RANGE SCAN IBY_PMT_INSTR_USES_ALL_N2 (cr=13320705 pr=104 pw=0 time=1459328515 us cost=2 size=0 card=8)(object id 14313388)What i am trying to understand is why 2 billions rows (2059303280) has been accessed by the index IBY_PMT_INSTR_USES_ALL_N2
SQL> select table_name,num_rows,sample_size,last_analyzed from dba_tables where table_name='IBY_PMT_INSTR_USES_ALL';
TABLE_NAME NUM_ROWS SAMPLE_SIZE LAST_ANAL
IBY_PMT_INSTR_USES_ALL 2414470 241447 28-JAN-13
SQL> select table_name,distinct_keys,clustering_factor,num_rows,sample_size,last_analyzed from dba_indexes where index_name='IBY_PMT_INSTR_USES_ALL_N2';
TABLE_NAME DISTINCT_KEYS CLUSTERING_FACTOR NUM_ROWS SAMPLE_SIZE LAST_ANAL
IBY_PMT_INSTR_USES_ALL 304515 267170 2407170 240717 28-JAN-13The whole statment and is plan is as followed :
insert into iby_pmt_instr_uses_all (instrument_payment_use_id,payment_flow,
  ext_pmt_party_id,instrument_type,instrument_id,payment_function,
  order_of_preference,created_by,creation_date,last_updated_by,
  last_update_date,last_update_login,object_version_number,start_date,
  end_date,debit_auth_flag,debit_auth_method,debit_auth_reference,
  debit_auth_begin,debit_auth_end)select iby_pmt_instr_uses_all_s.nextval  ,
  'FUNDS_CAPTURE' ,iep.ext_payer_id ,'BANKACCOUNT' ,eba.ext_bank_account_id ,
  'CUSTOMER_PAYMENT' ,DECODE(cbi.primary_flag,'Y',1,10) ,:b0 ,SYSDATE ,:b0 ,
  SYSDATE ,:b2 ,1 ,cbi.start_date ,cbi.end_date ,'' ,'' ,'' ,'' ,''  from
  iby_external_payers_all iep ,hz_cust_accounts hca ,hz_cust_site_uses_all
  csu ,hz_cust_acct_sites_all cas ,hz_parties hzba ,hz_relationships hzr ,
  hz_code_assignments hcba ,hz_parties hzbb ,hz_organization_profiles hop ,
  hz_code_assignments hcbb ,iby_ext_bank_accounts eba ,
  ra_customer_banks_int_all cbi where
  (((((((((((((((((((((((((((((((((((((((cbi.interface_status is null  and
  cbi.request_id=:b3) and UPPER(cbi.bank_name)=UPPER(hzba.party_name)) and
  hzba.party_id=hop.party_id) and SYSDATE between
  TRUNC(hop.effective_start_date) and NVL(TRUNC(hop.effective_end_date),
  (SYSDATE+1))) and hcba.class_category='BANK_INSTITUTION_TYPE') and
  hcba.class_code='BANK') and hcba.owner_table_name='HZ_PARTIES') and
  hcba.owner_table_id=hzba.party_id) and cbi.bank_home_country=
  hop.home_country) and hzbb.party_id=hcbb.owner_table_id) and
  hcbb.owner_table_name='HZ_PARTIES') and hcbb.class_category=
  'BANK_INSTITUTION_TYPE') and hcbb.class_code='BANK_BRANCH') and
  nvl(hcbb.status,'A')='A') and hzbb.party_id=hzr.subject_id) and
  hzba.party_id=hzr.object_id) and hzr.relationship_type='BANK_AND_BRANCH')
  and hzr.relationship_code='BRANCH_OF') and hzr.status='A') and
  hzr.subject_table_name='HZ_PARTIES') and hzr.subject_type='ORGANIZATION')
  and hzr.object_table_name='HZ_PARTIES') and hzr.object_type='ORGANIZATION')
  and UPPER(cbi.bank_branch_name)=UPPER(hzbb.party_name)) and hzbb.party_id=
  eba.branch_id) and hzba.party_id=eba.bank_id) and eba.bank_account_num=
  cbi.bank_account_num) and eba.currency_code=cbi.bank_account_currency_code)
  and cbi.orig_system_customer_ref=hca.orig_system_reference) and
  iep.cust_account_id=hca.cust_account_id) and iep.party_id=hca.party_id) and
  ((cbi.orig_system_address_ref is null  and iep.org_id is null ) or
  iep.org_id=cbi.org_id)) and ((cbi.orig_system_address_ref is null  and
  iep.org_type is null ) or iep.org_type='OPERATING_UNIT')) and cbi.org_id=
  cas.org_id(+)) and nvl(iep.acct_site_use_id,(-1))=
  decode(cbi.orig_system_address_ref,null ,(-1),csu.site_use_id)) and
  cbi.orig_system_address_ref=cas.orig_system_reference(+)) and
  (csu.site_use_id=(select min(site_use_id)  from hz_cust_site_uses_all hcsua
  where ((hcsua.cust_acct_site_id=cas.cust_acct_site_id and
  hcsua.site_use_code='BILL_TO') and hcsua.status='A')) or csu.site_use_id is
  null )) and cas.cust_acct_site_id=csu.cust_acct_site_id(+)) and  not exists
  (select 'x'  from iby_pmt_instr_uses_all ipi where (((ipi.ext_pmt_party_id=
  iep.ext_payer_id and ipi.instrument_type='BANKACCOUNT') and
  ipi.instrument_id=eba.ext_bank_account_id) and ipi.payment_function=
  'CUSTOMER_PAYMENT')))
call     count       cpu    elapsed       disk      query    current        rows
Parse        1      0.00       0.00          0          0          0           0
Execute      1   3049.58    3080.23      31827   44696023       1587        1175
Fetch        0      0.00       0.00          0          0          0           0
total        2   3049.58    3080.23      31827   44696023       1587        1175
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 57  (APPS)
Number of plan statistics captured: 1
Rows (1st) Rows (avg) Rows (max)  Row Source Operation
         0          0          0  LOAD TABLE CONVENTIONAL  (cr=44696030 pr=31827 pw=0 time=2870820188 us)
      1175       1175       1175   SEQUENCE  IBY_PMT_INSTR_USES_ALL_S (cr=44695967 pr=31774 pw=0 time=3270855802 us)
      1175       1175       1175    FILTER  (cr=44695960 pr=31774 pw=0 time=3270803657 us)
      1175       1175       1175     NESTED LOOPS ANTI (cr=44695844 pr=31774 pw=0 time=3270739008 us cost=251 size=497 card=1)
      1175       1175       1175      NESTED LOOPS  (cr=64952 pr=217 pw=0 time=2991575 us cost=248 size=457 card=1)
      1175       1175       1175       NESTED LOOPS  (cr=64827 pr=205 pw=0 time=2949382 us cost=245 size=423 card=1)
      1175       1175       1175        NESTED LOOPS OUTER (cr=63494 pr=205 pw=0 time=2921176 us cost=243 size=403 card=1)
      1175       1175       1175         NESTED LOOPS  (cr=63377 pr=205 pw=0 time=2893312 us cost=240 size=391 card=1)
      1175       1175       1175          NESTED LOOPS  (cr=61415 pr=205 pw=0 time=2850064 us cost=236 size=348 card=1)
     47434      47434      47434           NESTED LOOPS  (cr=57058 pr=205 pw=0 time=2565056 us cost=234 size=328 card=1)
     41203      41203      41203            NESTED LOOPS OUTER (cr=42422 pr=0 pw=0 time=581594 us cost=230 size=296 card=1)
     41203      41203      41203             HASH JOIN  (cr=1049 pr=0 pw=0 time=173751 us cost=229 size=277 card=1)
      2333       2333       2333              NESTED LOOPS  (cr=1013 pr=0 pw=0 time=32850 us)
      2333       2333       2333               NESTED LOOPS  (cr=825 pr=0 pw=0 time=22036 us cost=208 size=172 card=1)
       514        514        514                NESTED LOOPS  (cr=691 pr=0 pw=0 time=16378 us cost=206 size=88 card=1)
       514        514        514                 NESTED LOOPS  (cr=588 pr=0 pw=0 time=7190 us cost=95 size=2501 card=41)
       514        514        514                  TABLE ACCESS BY INDEX ROWID HZ_CODE_ASSIGNMENTS (cr=20 pr=0 pw=0 time=1716 us cost=10 size=1681 card=41)
       514        514        514                   INDEX RANGE SCAN HZ_CODE_ASSIGNMENTS_N1 (cr=7 pr=0 pw=0 time=464 us cost=4 size=0 card=164)(object id 464630)
       514        514        514                  TABLE ACCESS BY INDEX ROWID HZ_PARTIES (cr=568 pr=0 pw=0 time=2797 us cost=2 size=20 card=1)
       514        514        514                   INDEX UNIQUE SCAN HZ_PARTIES_U1 (cr=54 pr=0 pw=0 time=1059 us cost=1 size=0 card=1)(object id 421661)
       514        514        514                 TABLE ACCESS BY INDEX ROWID HZ_ORGANIZATION_PROFILES (cr=103 pr=0 pw=0 time=5913 us cost=3 size=27 card=1)
       514        514        514                  INDEX RANGE SCAN BZ_HZ_ORGANIZATION_PROFILE_N1 (cr=76 pr=0 pw=0 time=2873 us cost=2 size=0 card=1)(object id 9378840)
      2333       2333       2333                INDEX RANGE SCAN HZ_RELATIONSHIPS_N2 (cr=134 pr=0 pw=0 time=3962 us cost=1 size=0 card=1)(object id 11581198)
      2333       2333       2333               TABLE ACCESS BY INDEX ROWID HZ_RELATIONSHIPS (cr=188 pr=0 pw=0 time=7476 us cost=2 size=84 card=1)
      1175       1175       1175              TABLE ACCESS FULL RA_CUSTOMER_BANKS_INT_ALL (cr=36 pr=0 pw=0 time=9479 us cost=21 size=123375 card=1175)
     41203      41203      41203             TABLE ACCESS BY INDEX ROWID HZ_CUST_ACCT_SITES_ALL (cr=41373 pr=0 pw=0 time=304952 us cost=1 size=19 card=1)
     41203      41203      41203              INDEX UNIQUE SCAN HZ_CUST_ACCT_SITES_U2 (cr=170 pr=0 pw=0 time=93830 us cost=1 size=0 card=1)(object id 421730)
     47434      47434      47434            TABLE ACCESS BY INDEX ROWID IBY_EXT_BANK_ACCOUNTS (cr=14636 pr=205 pw=0 time=2375333 us cost=4 size=32 card=1)
     47434      47434      47434             INDEX RANGE SCAN IBY_EXT_BANK_ACCOUNTS_N6 (cr=3548 pr=94 pw=0 time=1112297 us cost=2 size=0 card=1)(object id 14313177)
      1175       1175       1175           TABLE ACCESS BY INDEX ROWID HZ_PARTIES (cr=4357 pr=0 pw=0 time=171450 us cost=2 size=20 card=1)
      1203       1203       1203            INDEX UNIQUE SCAN HZ_PARTIES_U1 (cr=3154 pr=0 pw=0 time=107886 us cost=1 size=0 card=1)(object id 421661)
      1175       1175       1175          TABLE ACCESS BY INDEX ROWID HZ_CODE_ASSIGNMENTS (cr=1962 pr=0 pw=0 time=41107 us cost=3 size=43 card=1)
      1175       1175       1175           INDEX RANGE SCAN HZ_CODE_ASSIGNMENTS_U2 (cr=1611 pr=0 pw=0 time=25716 us cost=2 size=0 card=1)(object id 14355645)
      1175       1175       1175         TABLE ACCESS BY INDEX ROWID HZ_CUST_SITE_USES_ALL (cr=117 pr=0 pw=0 time=14875 us cost=3 size=12 card=1)
      1175       1175       1175          INDEX RANGE SCAN HZ_CUST_SITE_USES_N1 (cr=86 pr=0 pw=0 time=10600 us cost=2 size=0 card=1)(object id 464289)
      1175       1175       1175        TABLE ACCESS BY INDEX ROWID HZ_CUST_ACCOUNTS (cr=1333 pr=0 pw=0 time=22634 us cost=2 size=20 card=1)
      1175       1175       1175         INDEX UNIQUE SCAN HZ_CUST_ACCOUNTS_U3 (cr=158 pr=0 pw=0 time=9307 us cost=1 size=0 card=1)(object id 9438627)
      1175       1175       1175       TABLE ACCESS BY INDEX ROWID IBY_EXTERNAL_PAYERS_ALL (cr=125 pr=12 pw=0 time=131366 us cost=3 size=34 card=1)
      1175       1175       1175        INDEX RANGE SCAN IBY_EXTERNAL_PAYERS_ALL_U2 (cr=109 pr=4 pw=0 time=51266 us cost=2 size=0 card=1)(object id 14313089)
         0          0          0      TABLE ACCESS BY INDEX ROWID IBY_PMT_INSTR_USES_ALL (cr=44630892 pr=31557 pw=0 time=3075553107 us cost=3 size=95402360 card=2385059)
2059303280 2059303280 2059303280       INDEX RANGE SCAN IBY_PMT_INSTR_USES_ALL_N2 (cr=13320705 pr=104 pw=0 time=1459328515 us cost=2 size=0 card=8)(object id 14313388)
      1000       1000       1000     SORT AGGREGATE (cr=116 pr=0 pw=0 time=39211 us)
      1000       1000       1000      TABLE ACCESS BY INDEX ROWID HZ_CUST_SITE_USES_ALL (cr=116 pr=0 pw=0 time=27041 us cost=4 size=22 card=1)
      1000       1000       1000       INDEX RANGE SCAN HZ_CUST_SITE_USES_N1 (cr=85 pr=0 pw=0 time=19027 us cost=3 size=0 card=1)(object id 464289)

Yoav wrote:
and  not exists
(select 'x'  from iby_pmt_instr_uses_all ipi where (((ipi.ext_pmt_party_id=
iep.ext_payer_id and ipi.instrument_type='BANKACCOUNT') and
ipi.instrument_id=eba.ext_bank_account_id) and ipi.payment_function=
'CUSTOMER_PAYMENT')))
Number of plan statistics captured: 1
Rows (1st) Rows (avg) Rows (max)  Row Source Operation
0          0          0  LOAD TABLE CONVENTIONAL  (cr=44696030 pr=31827 pw=0 time=2870820188 us)
1175       1175       1175   SEQUENCE  IBY_PMT_INSTR_USES_ALL_S (cr=44695967 pr=31774 pw=0 time=3270855802 us)
1175       1175       1175    FILTER  (cr=44695960 pr=31774 pw=0 time=3270803657 us)
1175       1175       1175     NESTED LOOPS ANTI (cr=44695844 pr=31774 pw=0 time=3270739008 us cost=251 size=497 card=1)
1175       1175       1175      NESTED LOOPS  (cr=64952 pr=217 pw=0 time=2991575 us cost=248 size=457 card=1)
0          0          0      TABLE ACCESS BY INDEX ROWID IBY_PMT_INSTR_USES_ALL (cr=44630892 pr=31557 pw=0 time=3075553107 us cost=3 size=95402360 card=2385059)
2059303280 2059303280 2059303280       INDEX RANGE SCAN IBY_PMT_INSTR_USES_ALL_N2 (cr=13320705 pr=104 pw=0 time=1459328515 us cost=2 size=0 card=8)(object id 14313388)
1000       1000       1000     SORT AGGREGATE (cr=116 pr=0 pw=0 time=39211 us)
1000       1000       1000      TABLE ACCESS BY INDEX ROWID HZ_CUST_SITE_USES_ALL (cr=116 pr=0 pw=0 time=27041 us cost=4 size=22 card=1)
1000       1000       1000       INDEX RANGE SCAN HZ_CUST_SITE_USES_N1 (cr=85 pr=0 pw=0 time=19027 us cost=3 size=0 card=1)(object id 464289)
You have a "not exists" subquery that the optimizer has turned into a nested loop anti join.
For each of the 1175 rows returned by the previous step Oracle does a range scan of what it thinks is the most appropriate index - the figures for cost (2) and card (8) at that line show that something has gone wrong with the optimizer's estimates, and for each of the 1175 prior rows it has acquired an average 1.7M index entries based on the index predicates, then visited the table and discarded resulting row.
It looks as if the index is a bad choice of index - you need to check the index predicates for the plan - use dbms_xplan to pull it from memory; and check your indexes to see if there is a better one that the optimizer should have chosen
Regards
Jonathan Lewis

Similar Messages

  • Understanding explain plan

    Oracle Gurus,
    I am trying to understand the below explain plan which I generated using DBMS_XPLAN. This explain plan shows 380M cost, what do "M" and "K" mean here? If anyone has any good documentation to understand explain plan, please pass on.
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop | TQ |IN-OUT| PQ Distrib |
    | 0 | INSERT STATEMENT | | 9 | 801 | 380M(100)| 09:11:35 | | | | | |
    | 1 | HASH UNIQUE | | 9 | 801 | 380M(100)| 09:11:35 | | | | | |
    |* 2 | FILTER | | | | | | | | | | |
    | 3 | PX COORDINATOR | | | | | | | | | | |
    | 4 | PX SEND QC (RANDOM) | :TQ10002 | 3625K| 307M| 4282 (70)| 00:00:01 | | | Q1,02 | P->S | QC (RAND) |
    |* 5 | HASH JOIN BUFFERED | | 3625K| 307M| 4282 (70)| 00:00:01 | | | Q1,02 | PCWP | |
    | 6 | PX RECEIVE | | 362K| 14M| 1219 (52)| 00:00:01 | | | Q1,02 | PCWP | |
    | 7 | PX SEND HASH | :TQ10000 | 362K| 14M| 1219 (52)| 00:00:01 | | | Q1,00 | P->P | HASH |
    | 8 | PX BLOCK ITERATOR | | 362K| 14M| 1219 (52)| 00:00:01 | 7 | 7 | Q1,00 | PCWC | |
    |* 9 | TABLE ACCESS FULL | TOP10_UL_SECTOR_LUCENT | 362K| 14M| 1219 (52)| 00:00:01 | 7 | 7 | Q1,00 | PCWP | |
    | 10 | PX RECEIVE | | 411K| 18M| 1427 (52)| 00:00:01 | | | Q1,02 | PCWP | |
    | 11 | PX SEND HASH | :TQ10001 | 411K| 18M| 1427 (52)| 00:00:01 | | | Q1,01 | P->P | HASH |
    | 12 | PX BLOCK ITERATOR | | 411K| 18M| 1427 (52)| 00:00:01 | 182 | 212 | Q1,01 | PCWC | |
    |* 13 | TABLE ACCESS FULL | BH_UL_SECTOR_LUCENT | 411K| 18M| 1427 (52)| 00:00:01 | 182 | 212 | Q1,01 | PCWP | |
    | 14 | SORT AGGREGATE | | 1 | 14 | | | | | | | |
    | 15 | PARTITION RANGE ITERATOR| | 10 | 140 | 120 (100)| 00:00:01 | 182 | 212 | | | |
    |* 16 | INDEX SKIP SCAN | IDX2_BH_UL_SECTOR_LUCENT | 10 | 140 | 120 (100)| 00:00:01 | 182 | 212 | | | |
    -----------------------------------------------------------------------------------------------------------------------------------------------------

    Hello,
    Once again K is number of (1000) rows fetched and M is for bytes repsentation. Check this oracle doc for reading xplan
    Cost of the operation as estimated by the optimizer's query approach. Cost is not determined for table access operations. The value of this column does not have any particular unit of measurement; it is merely a weighted value used to compare costs of execution plans. The value of this column is a function of the CPU_COST and IO_COST columns
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/ex_plan.htm#i16971
    Regards

  • Explain plan output format

    Dear All,
    Please let me know how to publish my explain plan output properly here. Earlier i used [code]  .....  [/code]
    Thanks,
    Kods

    Who knows?
    Are you just looking at random explain plans to find a problem?
    Or did you look at the explain plan for a specific performance problem?
    Please format code and explain plan output with code tags.
    See also this thread, How to post a SQL tuning request:
    HOW TO: Post a SQL statement tuning request - template posting
    At the end of the day are the row estimates accurate?
    If they are, then everything's probably ok.
    If not, then everything might be ok or it might not be.
    Merge Join Cartesian + Buffer Sort operations are often, but not always, an indication of a problem particularly when the associated estimates are inaccurate for whatever reason.

  • I want to understand Explain Plan

    Dear Gurus,
    I want learn/understand Explain Plan for query so as to tune the query.
    OR I want to tune query by understanding their plan but how it help to tune query.
    Could anybody give me link or material on above.
    Thanking in advance
    Sanjeev

    If you don't want to read the Oracle documentation, then this book is excellent: Troubleshooting Oracle Performance - Christian Antognini
    It does a great job of explaining execution plans.

  • Need help understanding Explain Plan from 10046 trace

    Below is a query and Explain Plan from a 10046 trace shown with trcanlzr.sql.
    In the explain plan I don't understand what's happining at line ID 10 and 11. Specifically, is the result at line 11 rowids from lines 12 & 14? and then what? Are those rowids somehow used in line ID 10?
    SELECT cp.cred_process_id, cp.provider_id,
           brdg_credentialing.get_appl_specialist(cp.cred_process_id,'R') specialist_name,
           brdg_cred_report_pkg.provider_name(cp.cred_process_id) provider_name,
           ctc_apptype.description appl_type_desc,
           TRUNC (brdg_credentialing.get_appl_received_dt(cp.cred_process_id)) init_received_dt,
           brdg_code_util.code_descr(brdg_credentialing.get_appl_status_cd_ctc_id(cp.cred_process_id)) appl_status_desc,
           brdg_credentialing.get_appl_prac_specialties(cp.cred_process_id,'Y') primary_specialty,
           cwh.city practice_city,
           UPPER (cwh.state) practice_state,
           TRUNC (ch.event_dt) specialist_assign_dt,
           DECODE (ctc_apptype.code,'INITPPO', TRUNC (brdg_credentialing.get_appl_received_dt(cp.cred_process_id)),
                   'REAPP', TRUNC (brdg_credentialing.get_appl_received_dt(cp.cred_process_id)),
                   'SPECCRED', TRUNC (brdg_credentialing.get_appl_received_dt(cp.cred_process_id)),
                   'TRANS', TRUNC (brdg_credentialing.get_appl_received_dt(cp.cred_process_id)),
                   'RECPPO', p.next_recred_dt,
                   'RECAPP', p.next_recred_dt, NULL) sort_date,
                   p.next_recred_dt
      FROM brdg_cred_app_open_vw cp,
           brdg_cat_type_codes ctc_apptype,
           brdg_cred_work_history cwh,
           brdg_cred_history ch,
           brdg_providers p
    WHERE cp.type_cd_ctc_id = ctc_apptype.cat_type_code_id
       AND ctc_apptype.category_cd = 'CRED'
       AND ctc_apptype.type_cd = 'APPTYPE'
       AND cp.cred_process_id = cwh.cred_process_id (+)
       AND cwh.primary_practice_flag (+) = 'Y'
       AND cp.cred_process_id = ch.cred_process_id
       AND ch.cred_history_id = (SELECT MAX(cred_history_id)
                                   FROM brdg_cred_history
                                  WHERE cred_process_id = cp.cred_process_id
                                    AND event_cd_ctc_id = brdg_credentialing.get_event_ctc_id ('SEVENT','SPESTCHG'))
       AND cp.provider_id = p.provider_id (+)
       and brdg_credentialing.get_appl_specialist_id(cp.cred_process_id) = 5
    ORDER BY 3 ASC, 3, 5, 12, 6
            Explain Plan Operation
    ID   PID    Card     Rows    Cost      SearchCols  /   Indexed Cols     Predicates 
    0:    1                       36   SELECT STATEMENT   
    1:    0     1       139       36    SORT ORDER BY   
    2:    1             139            . FILTER   [+]  
    3:    2     1       311       11   .. NESTED LOOPS OUTER   
    4:    3     1       311       10   ... NESTED LOOPS OUTER   
    5:    4     1       311        9   .... NESTED LOOPS   
    6:    5     1       311        8   ....+ NESTED LOOPS   
    7:    6     4        16        1   ....+. TABLE ACCESS BY INDEX ROWID CAT_TYPE_CODES   
    8:    7     4        16        1   ....+.. INDEX RANGE SCAN CAT_TYPE_CODE_UK 2/3 [+]   [+]  
    9:    6     1       311        2   ....+. TABLE ACCESS BY INDEX ROWID CRED_PROCESSES   [+]  
    10:    9   183     61927        1   ....+.. INDEX RANGE SCAN CDPR_CTCD_FK1 1/1 [+]   [+]  
    11:   10     1         3        2   ....+... NESTED LOOPS   
    12:   11     1        16        1   ....+.... TABLE ACCESS BY INDEX ROWID CAT_TYPE_CODES   
    13:   12     1        16        1   ....+....+ INDEX UNIQUE SCAN CTCD_PK 1/1 [+]   [+]  
    14:   11     1         3        1   ....+.... INDEX UNIQUE SCAN CAT_TYPE_CODE_UK 3/3 [+]   [+]  
    15:    5     1        11        1   ....+ TABLE ACCESS BY INDEX ROWID CRED_HISTORY   [+]  
    16:   15     1       311        1   ....+. INDEX UNIQUE SCAN CDHT_PK 1/1 [+]   [+]  
    17:   16     1       311            ....+.. SORT AGGREGATE   
    18:   17     1       526        2   ....+... TABLE ACCESS BY INDEX ROWID CRED_HISTORY   [+]  
    19:   18    23      9950        1   ....+.... INDEX RANGE SCAN CDHT_CDPR_FK 1/1 [+]   [+]  
    20:    4     1       219        1   .... TABLE ACCESS BY INDEX ROWID PROVIDERS   
    21:   20     1       219        1   ....+ INDEX UNIQUE SCAN PROV_PK 1/1 [+]  [+]  
    22:    3     1       311        1   ... TABLE ACCESS BY INDEX ROWID CRED_WORK_HISTORY   [+] 
    23:   22     3      1057        1   .... INDEX RANGE SCAN CDWH_CDPR_FK 1/1 [+]   [+]  
    24:    2   172                      .. INLIST ITERATOR   
    25:   24     1       172        1   ... INDEX UNIQUE SCAN CAT_TYPE_CODE_UK 3/3 [+]   [+]  
    26:    2     1         0        2   .. TABLE ACCESS BY INDEX ROWID CRED_HISTORY   [+]  
    27:   26    23      2004        1   ... INDEX RANGE SCAN CDHT_CDPR_FK 1/1 [+]   [+]  
    (1) X/Y: Where X is the number of searched columns from index, which has a total of Y columns.
    (2) Actual rows returned by operation (average if there were more than 1 execution).
       2 - filter( NOT EXISTS (SELECT 0 FROM "PPO"."CAT_TYPE_CODES" "BRDG_CAT_TYPE_CODES" WHERE
                  "CODE"="BRDG_CODE_UTIL"."ID_CODE"("BRDG_CREDENTIALING"."GET_APPL_STATUS_CD_CTC_ID"(:B1)) AND
                  ("TYPE_CD"='APPROVAL' OR "TYPE_CD"='DENIED' OR "TYPE_CD"='INACTIVE' OR "TYPE_CD"='TERMED') AND
                  "CATEGORY_CD"='APPSTAT') AND  NOT EXISTS (SELECT 0 FROM "PPO"."CRED_HISTORY" "BRDG_CRED_HISTORY"
                  WHERE "CRED_PROCESS_ID"=:B2 AND "EVENT_CD_CTC_ID"="BRDG_CODE_UTIL"."GET_ID"('CRED','SEVENT','MSODC
       8 - access("CTC_APPTYPE"."CATEGORY_CD"='CRED' AND "CTC_APPTYPE"."TYPE_CD"='APPTYPE')
       9 - filter("BRDG_CREDENTIALING"."GET_APPL_SPECIALIST_ID"("CP"."CRED_PROCESS_ID")=5 AND
                  ("CP"."INS_DT">=TO_DATE(' 2007-12-20 17:00:00', 'syyyy-mm-dd hh24:mi:ss') OR
                  "CP"."TYPE_CD_CTC_ID"<>"BRDG_CODE_UTIL"."GET_ID"('CRED','APPTYPE','RECPPO')))
      10 - access("CP"."TYPE_CD_CTC_ID"="CTC_APPTYPE"."CAT_TYPE_CODE_ID")
           filter( NOT EXISTS (SELECT 0 FROM "PPO"."CAT_TYPE_CODES"
                  "CTC_APPTYPE","PPO"."CAT_TYPE_CODES" "CTC_TYPE" WHERE "CTC_TYPE"."CAT_TYPE_CODE_ID"=:B1 AND
                  "CTC_TYPE"."CODE"="CTC_APPTYPE"."CODE" AND "CTC_APPTYPE"."TYPE_CD"='APPSENT' AND
                  "CTC_APPTYPE"."CATEGORY_CD"='APPTYPE'))
      13 - access("CTC_TYPE"."CAT_TYPE_CODE_ID"=:B1)
      14 - access("CTC_APPTYPE"."CATEGORY_CD"='APPTYPE' AND "CTC_APPTYPE"."TYPE_CD"='APPSENT' AND
                  "CTC_TYPE"."CODE"="CTC_APPTYPE"."CODE")
      15 - filter("CP"."CRED_PROCESS_ID"="CH"."CRED_PROCESS_ID")
      16 - access("CH"."CRED_HISTORY_ID"= (SELECT MAX("CRED_HISTORY_ID") FROM "PPO"."CRED_HISTORY"
                  "BRDG_CRED_HISTORY" WHERE "CRED_PROCESS_ID"=:B1 AND
                  "EVENT_CD_CTC_ID"="BRDG_CREDENTIALING"."GET_EVENT_CTC_ID"('SEVENT','SPESTCHG')))
      18 - filter("EVENT_CD_CTC_ID"="BRDG_CREDENTIALING"."GET_EVENT_CTC_ID"('SEVENT','SPESTCHG'))
      19 - access("CRED_PROCESS_ID"=:B1)
      21 - access("CP"."PROVIDER_ID"="P"."PROVIDER_ID"(+))
      22 - filter("CWH"."PRIMARY_PRACTICE_FLAG"(+)='Y')
      23 - access("CP"."CRED_PROCESS_ID"="CWH"."CRED_PROCESS_ID"(+))
      25 - access("CATEGORY_CD"='APPSTAT' AND ("TYPE_CD"='APPROVAL' OR "TYPE_CD"='DENIED' OR
                  "TYPE_CD"='INACTIVE' OR "TYPE_CD"='TERMED') AND "CODE"="BRDG_CODE_UTIL"."ID_CODE"("BRDG_CREDENTIAL
                  ING"."GET_APPL_STATUS_CD_CTC_ID"(:B1)))
      26 - filter("EVENT_CD_CTC_ID"="BRDG_CODE_UTIL"."GET_ID"('CRED','SEVENT','MSODC'))
      27 - access("CRED_PROCESS_ID"=:B1)

    Welcome to the forums!
    user11987210 wrote:
    In the explain plan I don't understand what's happining at line ID 10 and 11. Specifically, is the result at line 11 rowids from lines 12 & 14? and then what? Are those rowids somehow used in line ID 10?
    9:    6     1       311        2   ....+. TABLE ACCESS BY INDEX ROWID CRED_PROCESSES   [+]  
    10:    9   183     61927        1   ....+.. INDEX RANGE SCAN CDPR_CTCD_FK1 1/1 [+]   [+]  
    11:   10     1         3        2   ....+... NESTED LOOPS   
    12:   11     1        16        1   ....+.... TABLE ACCESS BY INDEX ROWID CAT_TYPE_CODES   
    13:   12     1        16        1   ....+....+ INDEX UNIQUE SCAN CTCD_PK 1/1 [+]   [+]  
    14:   11     1         3        1   ....+.... INDEX UNIQUE SCAN CAT_TYPE_CODE_UK 3/3 [+]   [+]   The NESTED LOOPS operation (ID #11) has two children, ID #12 sometimes called the driving source, and ID #14 the inner loop. ID #14 is executed once for each row returned by ID #12. The results of ID #11 are then fed to ID #10 which performs an INDEX RANGE SCAN.
    Hope this helps!

  • Verbose EXPLAIN PLAN output when asking for explain plan on simple SQL

    Hello. In a nutshell I have two issues: first, inability to execute EXPLAIN PLAN via SET AUTOTRACE ON EXPLAIN, and second, extremely verbose output when I log on as SYSDBA to circumvent the first issue.
    So, issue number one:
    I am trying to get an EXPLAIN PLAN via SET AUTOTRACE ON EXPLAIN for a simple SQL query:
      1   select decode(rownum,1,'JAN', 2,'FEB',3,'MAR',4,'APR',5,'MAY',6,'JUN',7,'JUL',8,'AUG',9,'SEP',10,'OCT',11,'NOV',12,'DEC')
      2* from all_objects where rownum<13
    HR@XE> /
    DEC
    JAN
    FEB
    MAR
    APR
    MAY
    JUN
    JUL
    AUG
    SEP
    OCT
    NOV
    DEC
    12 rows selected.
    HR@XE> set autotrace on explain
    HR@XE> /
    DEC
    JAN
    FEB
    MAR
    APR
    MAY
    JUN
    JUL
    AUG
    SEP
    OCT
    NOV
    DEC
    12 rows selected.
    Execution Plan
    ERROR:
    ORA-01039: insufficient privileges on underlying objects of the viewSo, first question, why am I getting this error? ALL_OBJECTS should be available to everybody, no?
    So to circumvent this I log on as sysdba and get the second issue: the following extremely verbose output
    HR@XE> connect / as sysdba
    Connected.
    SYS@XE>  select decode(rownum,1,'JAN', 2,'FEB',3,'MAR',4,'APR',5,'MAY',6,'JUN',7,'JUL',8,'AUG',9,'SEP',10,'OCT',11,'NOV',12,'DEC')
      2  from all_objects where rownum<13;
    DEC
    JAN
    FEB
    MAR
    APR
    MAY
    JUN
    JUL
    AUG
    SEP
    OCT
    NOV
    DEC
    12 rows selected.
    SYS@XE> set autotrace on explain
    SYS@XE> /
    DEC
    JAN
    FEB
    MAR
    APR
    MAY
    JUN
    JUL
    AUG
    SEP
    OCT
    NOV
    DEC
    12 rows selected.
    Execution Plan
    Plan hash value: 1291336664
    | Id  | Operation                          | Name                    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                   |                         |    12 |  3240 |     5  (20)| 00:00:01 |
    |*  1 |  COUNT STOPKEY                     |                         |       |       |            |       |
    |*  2 |   FILTER                           |                         |       |       |            |       |
    |*  3 |    HASH JOIN                       |                         |    32 |  8640 |     5  (20)| 00:00:01 |
    |   4 |     INDEX FULL SCAN                | I_USER2                 |    49 |  1078 |     1   (0)| 00:00:01 |
    |*  5 |     HASH JOIN                      |                         |    32 |  5248 |     4  (25)| 00:00:01 |
    |   6 |      INDEX FULL SCAN               | I_USER2                 |    49 |   196 |     1   (0)| 00:00:01 |
    |*  7 |      TABLE ACCESS FULL             | OBJ$                    |    33 |  2640 |     2   (0)| 00:00:01 |
    |*  8 |    TABLE ACCESS BY INDEX ROWID     | IND$                    |     1 |     8 |     2   (0)| 00:00:01 |
    |*  9 |     INDEX UNIQUE SCAN              | I_IND1                  |     1 |       |     1   (0)| 00:00:01 |
    |* 10 |    HASH JOIN                       |                         |     1 |    24 |     3  (34)| 00:00:01 |
    |* 11 |     INDEX RANGE SCAN               | I_OBJAUTH1              |     1 |    11 |     2   (0)| 00:00:01 |
    |  12 |     FIXED TABLE FULL               | X$KZSRO                 |   100 |  1300 |     0   (0)| 00:00:01 |
    |* 13 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 14 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |  15 |    NESTED LOOPS                    |                         |       |       |            |       |
    |  16 |     NESTED LOOPS                   |                         |     1 |    73 |     6   (0)| 00:00:01 |
    |  17 |      NESTED LOOPS                  |                         |     1 |    63 |     4   (0)| 00:00:01 |
    |  18 |       NESTED LOOPS                 |                         |     1 |    52 |     3   (0)| 00:00:01 |
    |  19 |        MERGE JOIN CARTESIAN        |                         |     1 |    48 |     2   (0)| 00:00:01 |
    |* 20 |         INDEX RANGE SCAN           | I_OBJ5                  |     1 |    35 |     2   (0)| 00:00:01 |
    |  21 |         BUFFER SORT                |                         |   100 |  1300 |     0   (0)| 00:00:01 |
    |  22 |          FIXED TABLE FULL          | X$KZSRO                 |   100 |  1300 |     0   (0)| 00:00:01 |
    |* 23 |        INDEX RANGE SCAN            | I_USER2                 |     1 |     4 |     1   (0)| 00:00:01 |
    |* 24 |       INDEX RANGE SCAN             | I_OBJAUTH1              |     1 |    11 |     1   (0)| 00:00:01 |
    |* 25 |      INDEX RANGE SCAN              | I_DEPENDENCY1           |     4 |       |     1   (0)| 00:00:01 |
    |* 26 |     TABLE ACCESS BY INDEX ROWID    | DEPENDENCY$             |     1 |    10 |     2   (0)| 00:00:01 |
    |* 27 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 28 |    HASH JOIN                       |                         |     1 |    24 |     3  (34)| 00:00:01 |
    |* 29 |     INDEX RANGE SCAN               | I_OBJAUTH1              |     1 |    11 |     2   (0)| 00:00:01 |
    |  30 |     FIXED TABLE FULL               | X$KZSRO                 |   100 |  1300 |     0   (0)| 00:00:01 |
    |* 31 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |  32 |    NESTED LOOPS                    |                         |     2 |    48 |     2   (0)| 00:00:01 |
    |* 33 |     INDEX RANGE SCAN               | I_OBJAUTH1              |     1 |    11 |     2   (0)| 00:00:01 |
    |* 34 |     FIXED TABLE FULL               | X$KZSRO                 |     2 |    26 |     0   (0)| 00:00:01 |
    |  35 |    NESTED LOOPS                    |                         |     1 |    38 |     2   (0)| 00:00:01 |
    |  36 |     NESTED LOOPS                   |                         |     1 |    25 |     2   (0)| 00:00:01 |
    |* 37 |      TABLE ACCESS BY INDEX ROWID   | TRIGGER$                |     1 |    14 |     1   (0)| 00:00:01 |
    |* 38 |       INDEX UNIQUE SCAN            | I_TRIGGER2              |     1 |       |     0   (0)| 00:00:01 |
    |* 39 |      INDEX RANGE SCAN              | I_OBJAUTH1              |     1 |    11 |     1   (0)| 00:00:01 |
    |* 40 |     FIXED TABLE FULL               | X$KZSRO                 |     1 |    13 |     0   (0)| 00:00:01 |
    |* 41 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |  42 |    NESTED LOOPS                    |                         |       |       |            |       |
    |  43 |     NESTED LOOPS                   |                         |     1 |    73 |     6   (0)| 00:00:01 |
    |  44 |      NESTED LOOPS                  |                         |     1 |    63 |     4   (0)| 00:00:01 |
    |  45 |       NESTED LOOPS                 |                         |     1 |    52 |     3   (0)| 00:00:01 |
    |  46 |        MERGE JOIN CARTESIAN        |                         |     1 |    48 |     2   (0)| 00:00:01 |
    |* 47 |         INDEX RANGE SCAN           | I_OBJ5                  |     1 |    35 |     2   (0)| 00:00:01 |
    |  48 |         BUFFER SORT                |                         |   100 |  1300 |     0   (0)| 00:00:01 |
    |  49 |          FIXED TABLE FULL          | X$KZSRO                 |   100 |  1300 |     0   (0)| 00:00:01 |
    |* 50 |        INDEX RANGE SCAN            | I_USER2                 |     1 |     4 |     1   (0)| 00:00:01 |
    |* 51 |       INDEX RANGE SCAN             | I_OBJAUTH1              |     1 |    11 |     1   (0)| 00:00:01 |
    |* 52 |      INDEX RANGE SCAN              | I_DEPENDENCY1           |     4 |       |     1   (0)| 00:00:01 |
    |* 53 |     TABLE ACCESS BY INDEX ROWID    | DEPENDENCY$             |     1 |    10 |     2   (0)| 00:00:01 |
    |* 54 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 55 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 56 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |  57 |    NESTED LOOPS                    |                         |     2 |    68 |     2   (0)| 00:00:01 |
    |  58 |     NESTED LOOPS                   |                         |     1 |    21 |     2   (0)| 00:00:01 |
    |  59 |      TABLE ACCESS BY INDEX ROWID   | TABPART$                |     1 |    10 |     1   (0)| 00:00:01 |
    |* 60 |       INDEX UNIQUE SCAN            | I_TABPART_OBJ$          |     1 |       |     0   (0)| 00:00:01 |
    |* 61 |      INDEX RANGE SCAN              | I_OBJAUTH1              |     1 |    11 |     1   (0)| 00:00:01 |
    |* 62 |     FIXED TABLE FULL               | X$KZSRO                 |     2 |    26 |     0   (0)| 00:00:01 |
    |* 63 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 64 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 65 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 66 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 67 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 68 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 69 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 70 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 71 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 72 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 73 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 74 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |  75 |    VIEW                            |                         |     1 |    13 |     2   (0)| 00:00:01 |
    |  76 |     FAST DUAL                      |                         |     1 |       |     2   (0)| 00:00:01 |
    |* 77 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 78 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 79 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 80 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 81 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 82 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |  83 |    NESTED LOOPS                    |                         |     2 |    42 |     2   (0)| 00:00:01 |
    |* 84 |     INDEX RANGE SCAN               | I_OBJAUTH1              |     1 |     8 |     2   (0)| 00:00:01 |
    |* 85 |     FIXED TABLE FULL               | X$KZSRO                 |     2 |    26 |     0   (0)| 00:00:01 |
    |* 86 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |  87 |    NESTED LOOPS                    |                         |     2 |    42 |     2   (0)| 00:00:01 |
    |* 88 |     INDEX RANGE SCAN               | I_OBJAUTH1              |     1 |     8 |     2   (0)| 00:00:01 |
    |* 89 |     FIXED TABLE FULL               | X$KZSRO                 |     2 |    26 |     0   (0)| 00:00:01 |
    |* 90 |      FIXED TABLE FULL              | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |  91 |    VIEW                            |                         |     1 |    16 |     1   (0)| 00:00:01 |
    |  92 |     SORT GROUP BY                  |                         |     1 |    86 |     1   (0)| 00:00:01 |
    |  93 |      NESTED LOOPS                  |                         |     1 |    86 |     1   (0)| 00:00:01 |
    |  94 |       MERGE JOIN CARTESIAN         |                         |     1 |    78 |     0   (0)| 00:00:01 |
    |  95 |        NESTED LOOPS                |                         |     1 |    65 |     0   (0)| 00:00:01 |
    |* 96 |         INDEX UNIQUE SCAN          | I_OLAP_CUBES$           |     1 |    13 |     0   (0)| 00:00:01 |
    |* 97 |         TABLE ACCESS BY INDEX ROWID| OLAP_DIMENSIONALITY$    |     1 |    52 |     0   (0)| 00:00:01 |
    |* 98 |          INDEX RANGE SCAN          | I_OLAP_DIMENSIONALITY$  |     1 |       |     0   (0)| 00:00:01 |
    |  99 |        BUFFER SORT                 |                         |     1 |    13 |     0   (0)| 00:00:01 |
    | 100 |         INDEX FULL SCAN            | I_OLAP_CUBE_DIMENSIONS$ |     1 |    13 |     0   (0)| 00:00:01 |
    |*101 |       INDEX RANGE SCAN             | I_OBJ1                  |     1 |     8 |     1   (0)| 00:00:01 |
    | 102 |    NESTED LOOPS                    |                         |     1 |    30 |     2   (0)| 00:00:01 |
    |*103 |     INDEX SKIP SCAN                | I_USER2                 |     1 |    20 |     1   (0)| 00:00:01 |
    |*104 |     INDEX RANGE SCAN               | I_OBJ4                  |     1 |    10 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter(ROWNUM<13)
       2 - filter(("O"."TYPE#"<>1 AND "O"."TYPE#"<>10 OR "O"."TYPE#"=1 AND  (SELECT 1 FROM "SYS"."IND$"
                  "I" WHERE "I"."OBJ#"=:B1 AND ("I"."TYPE#"=1 OR "I"."TYPE#"=2 OR "I"."TYPE#"=3 OR "I"."TYPE#"=4 OR
                  "I"."TYPE#"=6 OR "I"."TYPE#"=7 OR "I"."TYPE#"=9))=1) AND (("O"."SPARE3"=USERENV('SCHEMAID') OR
                  "O"."SPARE3"=1) OR "O"."TYPE#"=13 AND ( EXISTS (SELECT 0 FROM "SYS"."OBJAUTH$" "OA",SYS."X$KZSRO"
                  "X$KZSRO" WHERE "OA"."GRANTEE#"="KZSROROL" AND "OA"."OBJ#"=:B2 AND ("OA"."PRIVILEGE#"=12 OR
                  "OA"."PRIVILEGE#"=26)) OR  EXISTS (SELECT 0 FROM SYS."X$KZSPR" "X$KZSPR" WHERE
                  "INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-184) OR (-"KZSPRPRV")=(-181) OR
                  (-"KZSPRPRV")=(-241)))) OR ("O"."TYPE#"=1 OR "O"."TYPE#"=2 OR "O"."TYPE#"=3 OR "O"."TYPE#"=4 OR
                  "O"."TYPE#"=5 OR "O"."TYPE#"=19 OR "O"."TYPE#"=20 OR "O"."TYPE#"=34 OR "O"."TYPE#"=35) AND  EXISTS
                  (SELECT 0 FROM SYS."X$KZSPR" "X$KZSPR" WHERE "INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-45)
                  OR (-"KZSPRPRV")=(-47) OR (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR (-"KZSPRPRV")=(-50))) OR
                  "O"."TYPE#"=11 AND ( EXISTS (SELECT 0 FROM "SYS"."OBJAUTH$" "OA","SYS"."DEPENDENCY$"
                  "DEP",SYS."USER$" "U",SYS."OBJ$" "O",SYS."X$KZSRO" "X$KZSRO" WHERE "O"."NAME"=:B3 AND
                  "O"."SPARE3"=:B4 AND "O"."TYPE#"=9 AND "O"."TYPE#"<>88 AND "O"."OWNER#"="U"."USER#" AND
                  "DEP"."D_OBJ#"=:B5 AND "DEP"."P_OBJ#"="O"."OBJ#" AND "OA"."OBJ#"="O"."OBJ#" AND "OA"."PRIVILEGE#"=26
                  AND "OA"."GRANTEE#"="KZSROROL") OR  EXISTS (SELECT 0 FROM SYS."X$KZSPR" "X$KZSPR" WHERE
                  ((-"KZSPRPRV")=(-141) OR (-"KZSPRPRV")=(-241)) AND "INST_ID"=USERENV('INSTANCE'))) OR ("O"."TYPE#"=7
                  OR "O"."TYPE#"=8 OR "O"."TYPE#"=9 OR "O"."TYPE#"=28 OR "O"."TYPE#"=29 OR "O"."TYPE#"=30 OR
                  "O"."TYPE#"=56) AND ( EXISTS (SELECT 0 FROM "SYS"."OBJAUTH$" "OA",SYS."X$KZSRO" "X$KZSRO" WHERE
                  "OA"."GRANTEE#"="KZSROROL" AND "OA"."OBJ#"=:B6 AND ("OA"."PRIVILEGE#"=12 OR "OA"."PRIVILEGE#"=26)) OR
                   EXISTS (SELECT 0 FROM SYS."X$KZSPR" "X$KZSPR" WHERE "INST_ID"=USERENV('INSTANCE') AND
                  ((-"KZSPRPRV")=(-144) OR (-"KZSPRPRV")=(-141) OR (-"KZSPRPRV")=(-241)))) OR "O"."TYPE#"<>14 AND
                  "O"."TYPE#"<>28 AND "O"."TYPE#"<>29 AND "O"."TYPE#"<>30 AND "O"."TYPE#"<>56 AND "O"."TYPE#"<>93 AND
                  "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND
                  "O"."TYPE#"<>13 AND  EXISTS (SELECT 0 FROM "SYS"."OBJAUTH$" "OBJAUTH$",SYS."X$KZSRO" "X$KZSRO" WHERE
                  "GRANTEE#"="KZSROROL" AND "OBJ#"=:B7 AND ("PRIVILEGE#"=3 OR "PRIVILEGE#"=6 OR "PRIVILEGE#"=7 OR
                  "PRIVILEGE#"=9 OR "PRIVILEGE#"=10 OR "PRIVILEGE#"=11 OR "PRIVILEGE#"=12 OR "PRIVILEGE#"=16 OR
                  "PRIVILEGE#"=17 OR "PRIVILEGE#"=18)) OR "O"."TYPE#"=12 AND ( EXISTS (SELECT 0 FROM "SYS"."OBJAUTH$"
                  "OA","SYS"."TRIGGER$" "T",SYS."X$KZSRO" "X$KZSRO" WHERE "OA"."GRANTEE#"="KZSROROL" AND "T"."OBJ#"=:B8
                  AND BITAND("T"."PROPERTY",24)=0 AND "OA"."OBJ#"="T"."BASEOBJECT" AND "OA"."PRIVILEGE#"=26) OR  EXISTS
                  (SELECT 0 FROM SYS."X$KZSPR" "X$KZSPR" WHERE ((-"KZSPRPRV")=(-152) OR (-"KZSPRPRV")=(-241)) AND
                  "INST_ID"=USERENV('INSTANCE'))) OR "O"."TYPE#"=14 AND ( EXISTS (SELECT 0 FROM "SYS"."OBJAUTH$"
                  "OA","SYS"."DEPENDENCY$" "DEP",SYS."USER$" "U",SYS."OBJ$" "O",SYS."X$KZSRO" "X$KZSRO" WHERE
                  "O"."NAME"=:B9 AND "O"."SPARE3"=:B10 AND "O"."TYPE#"=13 AND "O"."TYPE#"<>88 AND
                  "O"."OWNER#"="U"."USER#" AND "DEP"."D_OBJ#"=:B11 AND "DEP"."P_OBJ#"="O"."OBJ#" AND
                  "OA"."OBJ#"="O"."OBJ#" AND "OA"."PRIVILEGE#"=26 AND "OA"."GRANTEE#"="KZSROROL") OR  EXISTS (SELECT 0
                  FROM SYS."X$KZSPR" "X$KZSPR" WHERE ((-"KZSPRPRV")=(-181) OR (-"KZSPRPRV")=(-241)) AND
                  "INST_ID"=USERENV('INSTANCE'))) OR ("O"."TYPE#"=66 OR "O"."TYPE#"=100) AND  EXISTS (SELECT 0 FROM
                  SYS."X$KZSPR" "X$KZSPR" WHERE (-"KZSPRPRV")=(-265) AND "INST_ID"=USERENV('INSTANCE')) OR
                  ("O"."TYPE#"=67 OR "O"."TYPE#"=79) AND  EXISTS (SELECT 0 FROM SYS."X$KZSPR" "X$KZSPR" WHERE
                  ((-"KZSPRPRV")=(-265) OR (-"KZSPRPRV")=(-266)) AND "INST_ID"=USERENV('INSTANCE')) OR "O"."TYPE#"=19
                  AND  EXISTS (SELECT 0 FROM SYS."TABPART$" "TABPART$","SYS"."OBJAUTH$" "OBJAUTH$",SYS."X$KZSRO"
                  "X$KZSRO" WHERE "GRANTEE#"="KZSROROL" AND "BO#"="OBJ#" A)
       3 - access("O"."OWNER#"="U"."USER#")
       5 - access("O"."SPARE3"="U"."USER#")
       7 - filter("O"."NAME"<>'_NEXT_OBJECT' AND "O"."NAME"<>'_default_auditing_options_' AND
                  BITAND("O"."FLAGS",128)=0 AND "O"."LINKNAME" IS NULL)
       8 - filter("I"."TYPE#"=1 OR "I"."TYPE#"=2 OR "I"."TYPE#"=3 OR "I"."TYPE#"=4 OR "I"."TYPE#"=6 OR
                  "I"."TYPE#"=7 OR "I"."TYPE#"=9)
       9 - access("I"."OBJ#"=:B1)
      10 - access("OA"."GRANTEE#"="KZSROROL")
      11 - access("OA"."OBJ#"=:B1)
           filter("OA"."PRIVILEGE#"=12 OR "OA"."PRIVILEGE#"=26)
      13 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-184) OR (-"KZSPRPRV")=(-181) OR
                  (-"KZSPRPRV")=(-241)))
      14 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-45) OR (-"KZSPRPRV")=(-47) OR
                  (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR (-"KZSPRPRV")=(-50)))
      20 - access("O"."SPARE3"=:B1 AND "O"."NAME"=:B2 AND "O"."TYPE#"=9)
           filter("O"."TYPE#"=9 AND "O"."TYPE#"<>88)
      23 - access("O"."OWNER#"="U"."USER#")
      24 - access("OA"."OBJ#"="O"."OBJ#" AND "OA"."GRANTEE#"="KZSROROL" AND "OA"."PRIVILEGE#"=26)
           filter("OA"."PRIVILEGE#"=26 AND "OA"."GRANTEE#"="KZSROROL")
      25 - access("DEP"."D_OBJ#"=:B1)
      26 - filter("DEP"."P_OBJ#"="O"."OBJ#")
      27 - filter(((-"KZSPRPRV")=(-141) OR (-"KZSPRPRV")=(-241)) AND "INST_ID"=USERENV('INSTANCE'))
      28 - access("OA"."GRANTEE#"="KZSROROL")
      29 - access("OA"."OBJ#"=:B1)
           filter("OA"."PRIVILEGE#"=12 OR "OA"."PRIVILEGE#"=26)
      31 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-144) OR (-"KZSPRPRV")=(-141) OR
                  (-"KZSPRPRV")=(-241)))
      33 - access("OBJ#"=:B1)
           filter("PRIVILEGE#"=3 OR "PRIVILEGE#"=6 OR "PRIVILEGE#"=7 OR "PRIVILEGE#"=9 OR "PRIVILEGE#"=10
                  OR "PRIVILEGE#"=11 OR "PRIVILEGE#"=12 OR "PRIVILEGE#"=16 OR "PRIVILEGE#"=17 OR "PRIVILEGE#"=18)
      34 - filter("GRANTEE#"="KZSROROL")
      37 - filter(BITAND("T"."PROPERTY",24)=0)
      38 - access("T"."OBJ#"=:B1)
      39 - access("OA"."OBJ#"="T"."BASEOBJECT" AND "OA"."PRIVILEGE#"=26)
           filter("OA"."PRIVILEGE#"=26)
      40 - filter("OA"."GRANTEE#"="KZSROROL")
      41 - filter(((-"KZSPRPRV")=(-152) OR (-"KZSPRPRV")=(-241)) AND "INST_ID"=USERENV('INSTANCE'))
      47 - access("O"."SPARE3"=:B1 AND "O"."NAME"=:B2 AND "O"."TYPE#"=13)
           filter("O"."TYPE#"=13 AND "O"."TYPE#"<>88)
      50 - access("O"."OWNER#"="U"."USER#")
      51 - access("OA"."OBJ#"="O"."OBJ#" AND "OA"."GRANTEE#"="KZSROROL" AND "OA"."PRIVILEGE#"=26)
           filter("OA"."PRIVILEGE#"=26 AND "OA"."GRANTEE#"="KZSROROL")
      52 - access("DEP"."D_OBJ#"=:B1)
      53 - filter("DEP"."P_OBJ#"="O"."OBJ#")
      54 - filter(((-"KZSPRPRV")=(-181) OR (-"KZSPRPRV")=(-241)) AND "INST_ID"=USERENV('INSTANCE'))
      55 - filter((-"KZSPRPRV")=(-265) AND "INST_ID"=USERENV('INSTANCE'))
      56 - filter(((-"KZSPRPRV")=(-265) OR (-"KZSPRPRV")=(-266)) AND "INST_ID"=USERENV('INSTANCE'))
      60 - access("OBJ#"=:B1)
      61 - access("BO#"="OBJ#" AND "PRIVILEGE#"=9)
           filter("PRIVILEGE#"=9)
      62 - filter("GRANTEE#"="KZSROROL")
      63 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-189) OR (-"KZSPRPRV")=(-190) OR
                  (-"KZSPRPRV")=(-191) OR (-"KZSPRPRV")=(-192)))
      64 - filter((-"KZSPRPRV")=(-109) AND "INST_ID"=USERENV('INSTANCE'))
      65 - filter(((-"KZSPRPRV")=(-177) OR (-"KZSPRPRV")=(-178)) AND "INST_ID"=USERENV('INSTANCE'))
      66 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-45) OR (-"KZSPRPRV")=(-47) OR
                  (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR (-"KZSPRPRV")=(-50)))
      67 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-205) OR (-"KZSPRPRV")=(-206) OR
                  (-"KZSPRPRV")=(-207) OR (-"KZSPRPRV")=(-208)))
      68 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-200) OR (-"KZSPRPRV")=(-201) OR
                  (-"KZSPRPRV")=(-202) OR (-"KZSPRPRV")=(-203) OR (-"KZSPRPRV")=(-204)))
      69 - filter(((-"KZSPRPRV")=(-222) OR (-"KZSPRPRV")=(-223)) AND "INST_ID"=USERENV('INSTANCE'))
      70 - filter((-"KZSPRPRV")=12 AND "INST_ID"=USERENV('INSTANCE'))
      71 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-251) OR (-"KZSPRPRV")=(-252) OR
                  (-"KZSPRPRV")=(-253) OR (-"KZSPRPRV")=(-254)))
      72 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-258) OR (-"KZSPRPRV")=(-259) OR
                  (-"KZSPRPRV")=(-260) OR (-"KZSPRPRV")=(-261)))
      73 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-246) OR (-"KZSPRPRV")=(-247) OR
                  (-"KZSPRPRV")=(-248) OR (-"KZSPRPRV")=(-249)))
      74 - filter(((-"KZSPRPRV")=(-268) OR (-"KZSPRPRV")=(-267)) AND "INST_ID"=USERENV('INSTANCE'))
      77 - filter(((-"KZSPRPRV")=(-277) OR (-"KZSPRPRV")=(-278)) AND "INST_ID"=USERENV('INSTANCE'))
      78 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-292) OR (-"KZSPRPRV")=(-293) OR
                  (-"KZSPRPRV")=(-294)))
      79 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-282) OR (-"KZSPRPRV")=(-283) OR
                  (-"KZSPRPRV")=(-284) OR (-"KZSPRPRV")=(-285)))
      80 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-302) OR (-"KZSPRPRV")=(-303) OR
                  (-"KZSPRPRV")=(-304) OR (-"KZSPRPRV")=(-305) OR (-"KZSPRPRV")=(-306) OR (-"KZSPRPRV")=(-307)))
      81 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-315) OR (-"KZSPRPRV")=(-316) OR
                  (-"KZSPRPRV")=(-317) OR (-"KZSPRPRV")=(-318)))
      82 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-320) OR (-"KZSPRPRV")=(-321) OR
                  (-"KZSPRPRV")=(-322)))
      84 - access("OBJ#"=:B1)
      85 - filter("GRANTEE#"="KZSROROL")
      86 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-309) OR (-"KZSPRPRV")=(-310) OR
                  (-"KZSPRPRV")=(-311) OR (-"KZSPRPRV")=(-312) OR (-"KZSPRPRV")=(-313)))
      88 - access("OBJ#"=:B1)
      89 - filter("GRANTEE#"="KZSROROL")
      90 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-302) OR (-"KZSPRPRV")=(-303) OR
                  (-"KZSPRPRV")=(-304) OR (-"KZSPRPRV")=(-305) OR (-"KZSPRPRV")=(-306) OR (-"KZSPRPRV")=(-307)))
      96 - access("C"."OBJ#"=:B1)
      97 - filter("DIML"."DIMENSION_TYPE"=11)
      98 - access("DIML"."DIMENSIONED_OBJECT_ID"=:B1 AND "DIML"."DIMENSIONED_OBJECT_TYPE"=1)
    101 - access("DIML"."DIMENSION_ID"="DO"."OBJ#")
           filter("DO"."OBJ#"="DIM"."OBJ#")
    103 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
           filter("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
    104 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
    SYS@XE>Many thanks in advance.
    Jason

    Welcome to the forum!
    Whenever you post please provide your 4 digit Oracle Version (result of SELECT * FROM V$VERSION).
    >
    So, first question, why am I getting this error? ALL_OBJECTS should be available to everybody, no?
    >
    Your user probably does have access to ALL_OBJECTS. But you need to have dba privileges to access views base objects.
    The "ORA-01039: insufficient privileges on underlying objects of the view" message is telling you that the user does not have privileges to access the BASE OBJECTS that used to build the view. Access to those base objects is necessary to generate the plan you are trying to see.
    So to circumvent this I log on as sysdba and get the second issue: the following extremely verbose output
    >
    And that is because sysdba DOES have access to the base objects of the view. You asked for a plan and you got it. That verbose output IS the plan and all of those oddly named tables are being accessed to satisfy your query so are included in the plan.
    Do your query using DUAL or the SCOTT.EMP table and you won't get the error.

  • Explain plan output  for a sql in JSP page

    Hello all,
    I have a requirement to give SQL query as an input and get the output and explain plan in the same JSP page. i could get the SQL result, but i want to get the EXPLAIN Plan.
    can any one help me in this.
    Thanks
    Kiran

    Hello all,
    I have a requirement to give SQL query as an input and get the output and explain plan in the same JSP page. i could get the SQL result, but i want to get the EXPLAIN Plan.
    can any one help me in this.
    Thanks
    Kiran

  • Help me in reading/understanding Explain Plan

    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    SELECT SRC2.PGM_MSTR_NBR,
                                                  SRC2.PGM_TRK_NBR,
                                                  SRC2.CNTL_LOCN,
                                                  SRC2.PGM_NAME,
                                                  SRC2.PGM_STS,
                                                  SRC2.SIS_PGM_START_DATE,
                                                  SRC2.SIS_PGM_END_DATE,
                                                  SRC2.AWARD_TRGT,
                                                  SRC2.AWARD_MAX,
                                                  SRC2.COMPLNC_TYPE,
                                                  SRC2.CMPNY_VNDR_LOCN,
                                                  SRC2.CMPNY_VNDR_NBR,
                                                  LKP3.ADDR_NAME,
                                                  SRC2.INV_IND,
                                                  SRC2.LAST_INV_THRU_DATE,
                                                  SRC2.INV_RPT_DAY,
                                                  SRC2.INV_RPT_CYCLE,
                                                  SRC2.BEG_COLL_DATE,
                                                  SRC2.END_COLL_DATE,
                                                  SRC2.SLS_CONT_DIST,
                                                  SRC2.SLS_CONT_NBR,
                                                  SRC2.ORD_INV_START_DATE,
                                                  SRC2.ORD_INV_END_DATE,
                                                  SRC2.CMPLNC_RPT_IND,
                                                  SRC2.PROD_ENTRY_LVL,
                                                  SRC2.DIST_ENTRY_LVL,
                                                  SRC2.CUST_ENTRY_LVL,
                                                  SRC2.VNDR_ENTRY_LVL,
                                                  SRC2.VNDR_CONT,
                                                  SRC2.SIS_CMPNY_VNDR_NBR
                                                  FROM CASADM.SBA_REB_PGM SRC2
                                                  INNER JOIN(SELECT PGM_MSTR_NBR,PGM_TRK_NBR,CNTL_LOCN  FROM CASADM.ACCR_SIS_PURCH_DTL
                                                             UNION SELECT PGM_MSTR_NBR,PGM_TRK_NBR,CNTL_LOCN  FROM CASADM.ACCR_SIS_EXCL_DTL)ACCR2
                                                        ON  (SRC2.PGM_MSTR_NBR=ACCR2.PGM_MSTR_NBR AND SRC2.PGM_TRK_NBR=ACCR2.PGM_TRK_NBR AND SRC2.CNTL_LOCN=ACCR2.CNTL_LOCN)
                                                  LEFT OUTER JOIN
                                                            CASADM.MT_CMPNY_VNDR LKP3
                                                        ON (LKP3.CMPNY_VNDR_NBR=SRC2.CMPNY_VNDR_NBR);
    Record Count in each table:
    select count(*) from casadm.accr_sis_purch_dtl --375,968
    select count(*) from casadm.accr_sis_excl_dtl --1,988,867
    select count(*) from casadm.sba_reb_pgm --526,133
    select count(*) from casadm.mt_cmpny_vndr --20743
    Execution Plan
    Plan hash value: 1465316812
    | Id  | Operation                    | Name                  | Rows  | Bytes |TempSpc| Cost (%CPU)| Time|
    |   0 | SELECT STATEMENT             |                       |     9 |  1908 | | 26988   (2)| 00:06:18 |
    |   1 |  NESTED LOOPS OUTER          |                       |     9 |  1908 | | 26988   (2)| 00:06:18 |
    |*  2 |   HASH JOIN                  |                       |     9 |  1656 |83M| 26979   (2)| 00:06:18|
    |   3 |    TABLE ACCESS FULL         | SBA_REB_PGM           |   536K|    77M| |  2624   (2)| 00:00:37 |
    |   4 |    VIEW                      |                       |  2364K|    74M| | 16424   (2)| 00:03:50 |
    |   5 |     SORT UNIQUE              |                       |  2364K|    49M|72M| 16424  (86)| 00:03:50|
    |   6 |      UNION-ALL               |                       |       |       ||            |          |
    |   7 |       INDEX FAST FULL SCAN   | ACCR_SIS_PURCH_DTL_PK |   375K|  8077K||   871   (1)| 00:00:13 |
    |   8 |       TABLE ACCESS FULL      | ACCR_SIS_EXCL_DTL     |  1988K|    41M||  5634   (1)| 00:01:19 |
    |   9 |   TABLE ACCESS BY INDEX ROWID| MT_CMPNY_VNDR         |     1 |    28 | |     1   (0)| 00:00:01 |
    |* 10 |    INDEX UNIQUE SCAN         | MT_CMPNY_VNDR_PK      |     1 |       | |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("SRC2"."PGM_MSTR_NBR"="ACCR2"."PGM_MSTR_NBR" AND
                  "SRC2"."PGM_TRK_NBR"="ACCR2"."PGM_TRK_NBR" AND "SRC2"."CNTL_LOCN"=
    "ACCR2"."CNTL_LOCN")
      10 - access("LKP3"."CMPNY_VNDR_NBR"(+)="SRC2"."CMPNY_VNDR_NBR")
    Statistics
            102  recursive calls
              0  db block gets
          34558  consistent gets
          23241  physical reads
             88  redo size
         531258  bytes sent via SQL*Net to client
           2760  bytes received via SQL*Net from client
            361  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
           5392  rows processed

    With respect to HASH JOIN it has two operands a TABLE ACCESS FULL and VIEW. Oracle joins these results together based on the following access predicate:
    2 - access("SRC2"."PGM_MSTR_NBR"="ACCR2"."PGM_MSTR_NBR" AND
                  "SRC2"."PGM_TRK_NBR"="ACCR2"."PGM_TRK_NBR" AND "SRC2"."CNTL_LOCN"="ACCR2"."CNTL_LOCN")The VIEW is the result of the union between the CASADM.ACCR_SIS_PURCH_DTL and CASADM.ACCR_SIS_EXCL_DTL where instead of accessing the table CASADM.ACCR_SIS_PURCH_DTL Oracle was able to acquire all the data from the index ACCR_SIS_PURCH_DTL_PK .
    The TABLE ACCESS FULL is exactly what says a full table access of SBA_REB_PGM.
    The NESTED LOOPS OUTER has two operands like the HASH JOIN. The way this works is that for each result returned by the HASH JOIN operation it accesses the index MT_CMPNY_VNDR_PK and then the table MT_CMPNY_VNDR based on the following access predicate:
    10 - access("LKP3"."CMPNY_VNDR_NBR"(+)="SRC2"."CMPNY_VNDR_NBR")It'd probably be worthwhile for you to review the following paper by Christian Antognini Interpreting Execution Plans as well.

  • Understanding the COST column of an explain plan

    Hello,
    I executed the following query, and obtained the corresponding explain plan:
    select * from isis.clas_rost where cour_off_# = 28
    Description COST Cardinality Bytes
    SELECT STATEMENT, GOAL = FIRST_ROWS               2     10     1540
    TABLE ACCESS BY INDEX ROWID     ISIS     CLAS_ROST     2     10     1540
    INDEX RANGE SCAN     ISIS     CLAS_ROST_N2     1 10     
    I don't understand how these cost values add up. What is the significance of the cost in each row of the explain plan output?
    By comparison, here is another plan output for the following query:
    select * from isis.clas_rost where clas_rost_# = 28
    Description COST Cardinality Bytes
    SELECT STATEMENT, GOAL = FIRST_ROWS               1     1     154
    TABLE ACCESS BY INDEX ROWID     ISIS     CLAS_ROST     1     1     154
    INDEX UNIQUE SCAN     ISIS     CLAS_ROST_U1     1 1     
    Thanks!

    For the most part, you probably want to ignore the cost column. The cardinality column is generally what you want to pay attention to.
    Ideally, the cost column is Oracle's estimate of the amount of work that will be required to execute a query. It is a unitless value that attempts to combine the cost of I/O and CPU (depending on the Oracle version and whether CPU costing is enabled) and to scale physical and logical I/O appropriately). As a unitless number, it doesn't really relate to something "real" like the expected number of buffer gets. It is also determined in part by initialization parameters,session settings, system statistics, etc. that may artificially increase or decrease the cost of certain operations.
    Beyond that, however, cost is problematic because it is only as accurate as the optimizer's estimates. If the optimizer's estimates are accurate, that implies that the cost is reasonably representative (in the sense that a query with a cost of 200 will run in less time than a query with a cost of 20000). But if you're looking at a query plan, it's generally because you believe there may be a problem which means that you are inherently suspicious that some of the optimizer's estimates are incorrect. If that's the case, you should generally distrust the cost.
    Justin

  • Looking for a book or link to  understand indexes stats an explain plan

    Please,
    Where could I find a good book or link to leran more about indexes statistics:
    My Concerns are:
    How could I know indexes in the database that are most used,less used and used at all in order to get rid of the last one?
    A book or link to fully undertstand how to analyze explain plan give some advices from that.
    Thank a lot for your coperation

    There is any link where I can find how to analyze explain plan output?Again, the manuals are usually a good place to start:
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14211/ex_plan.htm#g42231

  • Explain Plan understand technique & Query optimizing check list

    Hello gurus,
    Can some body help me with doc available or your experience to tell on how to understand Explain Plan & Query optimizing check list.
    Thanks..

    That's correct,
    But unfortunately the institute is pretty far from home.. and travelling time will be high..
    I am a working man..
    Please suggest if some good book or link.
    Thanks.

  • Understanding of Explain plan

    Hi all,
    Could you please provide me any article on how to read and understand the complete explain plan by step by step?
    I am not much familiar with expalin paln.
    Wolud be appreciated your help !!
    Regards,
    Vissu...
    Edited by: vissu on Aug 10, 2010 2:13 AM

    [ | http://www.lmgtfy.com/?q=Understanding+explain+plans+in+oracle+10g]
    [| http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/ex_plan.htm]

  • Explain Plan not showing correct results.

    Hi Gurus,
    Please help me to understand below issue.
    Whenever I am doing explain plan on any of the sql statements it says as explained but when retriving the explain plan output it shows same results again and again.
    DB - 11gR2 Stand alone
    ASM - Configured.
    OS - RHEL 6.2.
    SQL> select count(*) from t2114;
    COUNT(*)
    639292
    SQL> explain plan for select count(*) from t2114;
    Explained.
    SQL> @?/rdbms/admin/utlxpls.sql
    PLAN_TABLE_OUTPUT
    Plan hash value: 1497650422
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 6634 | 524K| 2993 (19)| 00:00:01 |
    | 1 | SORT ORDER BY | | 6634 | 524K| 2993 (19)| 00:00:01 |
    | 2 | TABLE ACCESS BY INDEX ROWID| T2210 | 6634 | 524K| 2947 (17)| 00:00:01 |
    |* 3 | INDEX RANGE SCAN | T2210_T | 6842 | | 108 (22)| 00:00:01 |
    Predicate Information (identified by operation id):
    3 - access("T2210"."C490008000"=:SYS_B_0 AND "T2210"."C490009100"=:SYS_B_2
    AND "T2210"."C301363300"=TO_NUMBER(:SYS_B_1))
    16 rows selected.
    SQL> explain plan for
    2 SELECT T2114.C1 FROM T2114 WHERE ((T2114.C1000000001 = :"SYS_B_0") AND (T2114.C536871442 = :"SYS_B_1") AND (T2114.C536871477 = :"SYS_B_2") AND ((:"SYS_B_3" - T2114.C3) >= :"SYS_B_4") AND ((:"SYS_B_5" - T2114.C3) <= :"SYS_B_6") AND (T2114.C1000000217 LIKE :"SYS_B_7") AND (T2114.C536871478 < :"SYS_B_8")) ORDER BY C1000000161 DESC, :"SYS_B_9" ASC;
    Explained.
    SQL> SELECT * FROM TABLE(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 1497650422
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 6634 | 524K| 2993 (19)| 00:00:01 |
    | 1 | SORT ORDER BY | | 6634 | 524K| 2993 (19)| 00:00:01 |
    | 2 | TABLE ACCESS BY INDEX ROWID| T2210 | 6634 | 524K| 2947 (17)| 00:00:01 |
    |* 3 | INDEX RANGE SCAN | T2210_T | 6842 | | 108 (22)| 00:00:01 |
    Predicate Information (identified by operation id):
    3 - access("T2210"."C490008000"=:SYS_B_0 AND "T2210"."C490009100"=:SYS_B_2
    AND "T2210"."C301363300"=TO_NUMBER(:SYS_B_1))
    16 rows selected.

    Hi Dom,
    Thanks for your immediate response.
    I am getting two values for PLAN_TABLE. Please let me know if we need to drop any of them??
    SQL> SELECT *
    FROM all_objects
    WHERE object_name = 'PLAN_TABLE'; 2 3
    OWNER OBJECT_NAME SUBOBJECT_NAME OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE CREATED LAST_DDL_TIME TIMESTAMP STATUS T G S NAMESPACE EDITION_NAME
    PUBLIC PLAN_TABLE 5127 SYNONYM 17-SEP-11 17-SEP-11 2011-09-17:09:47:47 VALID N N N 1
    ARADMIN PLAN_TABLE 219426 219426 TABLE 07-APR-13 07-APR-13 2013-04-07:23:01:12 VALID N N N 1

  • Question regarding using of Explain Plan

    Hi. I'm new with Oracle Queries so I have a little obstacles about understanding. I want to learn how to use Explain Plan feature from Oracle
    I am using Oracle 9i as back end .
    Please tell me how can i use feature of Explain Plan Feature for the below query.
    SELECT * FROM emp WHERE empno = 7369
    Thanks in advance.

    [email protected] wrote:
    Hi. I'm new with Oracle Queries so I have a little obstacles about understanding. I want to learn how to use Explain Plan feature from Oracle
    I am using Oracle 9i as back end .
    Please tell me how can i use feature of Explain Plan Feature for the below query.
    SELECT * FROM emp WHERE empno = 7369
    Kiran,
    Firstly , before anything else, I would suggest to change your handle to anything else and remove the email id from it. Its not good to have the id displayed in any public forum.
    About the question, unfortunately, its not that easy to answer. To understand explain plan and how to use it, you need to understand that algorithm/mechanism, whatever you feel like saying, that generates it. Because, explain plan is just the outcome of that mechanism, a final product, its the result of some inputs given by you in the form of your query, predicates, joins and their types and that all bring up the explain plan. Explain plan is basically the constitution of some steps which are used /fixed by optimizer to run the query. I would suggest that you read this page from cover to cover to understand some of the steps and their meanings which are shown to you in the plan. I am giving 10g link as this is a more better version of optimizer than the previous ones and I would suggest you to do experiments on 10g only.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/optimops.htm#i21299
    And I would suggest that you collect these following books and start reading them. I haven't yet found any thing better than these books.
    [Cost Based Oracle Fundamentals (Jonathan Lewis)|http://www.amazon.com/Cost-Based-Oracle-Fundamentals-Experts-Voice/dp/1590596366]
    [Troubleshooting Oracle Performance(Christian Antognini )|http://www.amazon.com/Troubleshooting-Oracle-Performance-Christian-Antognini/dp/1590599179/ref=sr_1_1?ie=UTF8&s=books&qid=1240078634&sr=1-1]
    [Effectuve Oracle By Design(Tom Kyte)|http://www.amazon.com/Effective-Oracle-Design-Osborne-ORACLE/dp/0072230657/ref=sr_1_1?ie=UTF8&s=books&qid=1240078698&sr=1-1]
    It would be real long journey before the mazes of optimizer and explain would be clear so make sure you have patience as well.
    HTH
    Aman....

  • Explain Plan from TKPROF trace file.

    Hello,
    My procedure is taking time for that i have trace on in procedure fo find explain plan of particular query.
    Using below statement Trace is on.
       EXECUTE IMMEDIATE 'ALTER SESSION SET SQL_TRACE = TRUE';
       EXECUTE IMMEDIATE 'ALTER SESSION SET TIMED_STATISTICS = TRUE';Now for getting expalin plan from TKPROF i have used below statement but for some query i have found explain paln and some case i cant found explain plan.
    tkprof mf_ora_23773.trc mf_ora_23773.txt explain =abc/abc
    can u please help me to analyze where i m wrong?
    Thanks.

    First of all, you should best avoid using the explain= clause on the tkprof command line.
    This will run explain plan on the statement in the trace file, and that explain plan can even be wrong, as there is no information on datatypes in the trace file.
    The real explain plan data is flushed to the trace file, when the program issues commit or rollback. Oracle always issues an implicit commit when the program disconnects, so when you run the program to completion you should have explain plan output in your trace files.
    You won't get explain plan output if you don't have access to the objects in the SQL statement. Also recursive SQL won't produce explain plan result.
    One would need to see part of your trace file to verify your assertion the explain clause doesn't always work.
    Sybrand Bakker
    Senior Oracle DBA

Maybe you are looking for

  • I can't sync music onto my iPod touch after restoring

    I have just restored and updated my iPod touch and now my music won't sync onto it. The music is still in my iTunes library and the "Sync music" box is ticked but the music will not sync onto my iPod. My apps are no longer in my iTunes library to syn

  • Reversing Black EPS in ID CS4

    We place a ton of logos in our catalogs. 75% of those logos are solid black vector files. Every now and then, we want to reverse a logo against a solid color. Until today, we have been creating a white version of the logo we wanted to reverse, but to

  • Message split ABAP mapping

    Hello everybody, for a special mappging I use ABAP mapping -everything fine. But I need to split the message with ABAP mapping. Does anybody know if this is possible ? In the ABAP-class I use the interface IF_MAPPING. This has as a result parameter t

  • How to split a string using IndexOf?

    How would you split a string using indexOf and not using the .split method? Any help is appreciated :D Message was edited by: billiejoe

  • How can i restore history back to 8-27-11

    how can i check the history back to 8-27-2011. it looks like it clears history after one day.