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

Similar Messages

  • Hiding the cost column in Billing document

    Hi,
    We have a requirement to hide the COST column in transaction VF01, VF02; VF03.Please let me know if any body has any clues.
    In the current system there are two companies.
    Company 1 Users should not see cost; Company 2 Users has to see the cost.
    I have two options:
    Option One:
    We can hide the cost column by changing the screen variant.
    Impact:
    This is hiding total system so that both the users can not see the cost .
    This is not accepting by IT team.
    Option two:
    We can define new transaction copy of VF01, VF02, and VF03. (Transaction Variant)
    That will be ZVF01, ZVF02, and ZVF03.For this new transaction we can create a screen variant to hide the cost Authorization to assess of VF01, VF02 and VF03 will be removed to Company 1 users.
    Impact:
    If we remove the authorization to VF03 to customer service people.
    Through document flow customer service user cannot see billing document. They need to enter ZVF03 to see billing document.
    This solution is not accepting by Business (Customer service).
    It will be great full if someone can through some light on this.
    Thanks in advance.
    SAV

    Please check follwoing user exits :
    J_3RSINV
    SDVFX001 User exit header line in delivery to accounting
    SDVFX002 User exit for A/R line in transfer to accounting
    SDVFX003 User exit cash clearing in transfer to accounting
    SDVFX004 User exit G/L line in transfer to accounting
    SDVFX005 User exit reserves in transfer to accounting
    SDVFX006 User exit tax line in transfer to accounting
    SDVFX007 User exit: Billing plan during transfer to Accounting
    SDVFX008 User exit: Processing of transfer structures SD-FI
    SDVFX009 Billing doc. processing KIDONO (payment reference numbe
    SDVFX010 User exit item table for the customer lines
    SDVFX011 Userexit for the komkcv- and kompcv-structures
    V05I0001 User exits for billing index
    V05N0001 User Exits for Printing Billing Docs. using POR Procedu
    V60A0001 Customer functions in the billing document
    V60P0001 Data provision for additional fields for display in lis
    V61A0001 Customer enhancement: Pricing
    and also check with RV60* in se38

  • How to update the COST column using another table's column

    Dear All,
    I have table:
    table parts: pno, pname, qoh, price, olevel
    table orders: ono, cno, eno, received, shipped
    table odetails: ono, pno, qty
    view:orders_view: ono, cno, eno, received, shipped,sum(qty*price)order_costview:odetails_view: ono, pno, qty, (qty*price)cost
    after I update the price in parts, I need to update COST and ORDER_COST too. The orders_view does not have pno, qty, and price, the odetails_view does not have price, how can I update the COST and ORDER_COST. Please help and Thanks in advance!!!
    I wrote the update the price in parts:
    create or replace procedure change_price(ppno in parts.pno%type, pprice in parts.price%type) as
    begin
        update parts
        set price = pprice
        where pno = ppno;
    end;
    show errorsthis procedure works fine.
    I wrote the trigger:
    create or replace trigger update_orders_v
    after update of price on parts
    for each row
    begin
        update orders_view
        set order_cost = sum(parts.(:new.price)*parts.qty)
        where parts.pno = :new.pno;
    end;
    show errorsIt gives me:Errors for TRIGGER UPDATE_ORDERS_V:
    LINE/COL ERROR
    3/5 PL/SQL SQL Statement ignored
    4/22 PL/SQL ORA-00934: group function is not allowed hereplease help!

    You could add the columns to the tables and then you would need a trigger to update those columns. However, you could just as easily select the price * qty to get the cost, without creating an additional column or trigger. I have no idea what you might want to do with a global temporary table. I think you need to explain what your purpose is, before any of us can suggest the best method. Since I have already demonstrated an update with a view, I will demonstrate an update with the cost column added to the odetails table and a trigger as you asked about. Notice that you will need triggers on both tables, the one that has qty and the one that has price.
    scott@ORA92> create table parts
      2    (pno    number(5) not null primary key,
      3       pname  varchar2(30),
      4       qoh    integer check(qoh >= 0),
      5       price  number(6,2) check(price >= 0.0),
      6       olevel integer)
      7  /
    Table created.
    scott@ORA92> create table odetails
      2    (ono    number(5),
      3       pno    number(5) references parts,
      4       qty    integer check(qty > 0),
      5       cost   number,
      6       primary key (ono,pno))
      7  /
    Table created.
    scott@ORA92> create or replace procedure change_price
      2    (ppno   in parts.pno%type,
      3       pprice in parts.price%type)
      4  as
      5  begin
      6    update parts
      7    set    price = pprice
      8    where  pno = ppno;
      9  end;
    10  /
    Procedure created.
    scott@ORA92> create or replace trigger update_cost1
      2    after insert or update of price on parts
      3    for each row
      4  begin
      5    update odetails
      6    set    cost = qty * :new.price
      7    where  pno = :new.pno;
      8  end update_cost1;
      9  /
    Trigger created.
    scott@ORA92> show errors
    No errors.
    scott@ORA92> create or replace trigger update_cost2
      2    before insert or update of qty on odetails
      3    for each row
      4  declare
      5    v_price parts.price%type;
      6  begin
      7    select price
      8    into   v_price
      9    from   parts
    10    where  pno = :new.pno;
    11    --
    12    :new.cost := :new.qty * v_price;
    13  end update_cost2;
    14  /
    Trigger created.
    scott@ORA92> show errors
    No errors.
    scott@ORA92> insert into parts values (1, 'name1', 1, 10, 1)
      2  /
    1 row created.
    scott@ORA92> insert into odetails values (1, 1, 22, null)
      2  /
    1 row created.
    scott@ORA92> -- starting data:
    scott@ORA92> select * from parts
      2  /
           PNO PNAME                                 QOH      PRICE     OLEVEL
             1 name1                                   1         10          1
    scott@ORA92> select * from odetails
      2  /
           ONO        PNO        QTY       COST
             1          1         22        220
    scott@ORA92> -- update:
    scott@ORA92> execute change_price (1, 11)
    PL/SQL procedure successfully completed.
    scott@ORA92> -- results:
    scott@ORA92> select * from parts
      2  /
           PNO PNAME                                 QOH      PRICE     OLEVEL
             1 name1                                   1         11          1
    scott@ORA92> select * from odetails
      2  /
           ONO        PNO        QTY       COST
             1          1         22        242
    scott@ORA92> -- select works without extra cost column or trigger:
    scott@ORA92> select o.ono, o.pno, o.qty, (o.qty * p.price) as cost
      2  from   odetails o, parts p
      3  where  o.pno = p.pno
      4  /
           ONO        PNO        QTY       COST
             1          1         22        242
    scott@ORA92>

  • Time column of an explain plan

    Hi,
    I'm using Oracle version 10.2.0.3.0. I have 2 tables with 10 million records each. The DDL is as follows.
    create table bigtable(col1 varchar2(20), col2 varchar2(20))
    create table bigtablechild(col1 varchar2(20), col2 varchar(20))
    bigtablechild.col1 is a foreign key to bigtable.col1. Below is the query and explain plan. Over several executions, the query runs for about 20 seconds before returning results. Could anyone please explain what the time column represents? It doesn't match the time it took to return results.
    SQL> set autotrace on
    SQL>
    SQL> select b.col2
      2  from bigtable a, bigtablechild b
      3  where a.col1 = b.col1
      4  and a.col1 = 'ABC6554';
    COL2
    XYZ6554
    XYZ6554
    XYZ6554
    XYZ6554
    XYZ6554
    Execution Plan
    Plan hash value: 4210396901
    | Id  | Operation          | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |               |     5 |   150 | 21538   (4)| 00:04:19 |
    |*  1 |  HASH JOIN         |               |     5 |   150 | 21538   (4)| 00:04:19 |
    |*  2 |   TABLE ACCESS FULL| BIGTABLE      |     1 |    10 | 13124   (4)| 00:02:38 |
    |*  3 |   TABLE ACCESS FULL| BIGTABLECHILD |     5 |   100 |  8413   (5)| 00:01:41 |
    Predicate Information (identified by operation id):
       1 - access("A"."COL1"="B"."COL1")
       2 - filter("A"."COL1"='ABC6554')
       3 - filter("B"."COL1"='ABC6554')
    Statistics
              0  recursive calls
              0  db block gets
          93672  consistent gets
          91845  physical reads
              0  redo size
            463  bytes sent via SQL*Net to client
            396  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              5  rows processed

    Hi,
    the values in the TIME column are calculated from cost using system I/O statistics. If dbms_stats.gather_system_stats has never been run, then these stats have default values which may be very far from the truth. In your case, the optimizer expects a single-block I/O read to take about 12 ms, while in reality it is closer to 1 ms, thus the discrepancy between the prediction and actual results.
    In general, TIME column is not very helpful not just because of potentially incorrect I/O time estimates, but also because it is hard to predict how much data will be found in cash, so I would recommend not to pay too much attention to it (note, however, that A-time column, on the other hand, is extremely useful, but it's only available if rowsource statistics for the plan have been populated).
    Best regards,
    Nikolay

  • Understanding meaning of a query's explain plan

    Hi,
    I have a simple query but its query plan is looking difficult for me to understand. Can someone help me explain step by step what happens inthe query. I mean "first step table emp is full scan , than next step is another table's scan..." etc - in that way. I can't make out and need help to understand.
    SQL> explain plan for
      2  SELECT ename,dname ,grade
      3  from n1.salgrade salgrade ,n1.emp emp,n1.dept dept
      4  where emp.deptno=dept.deptno and
      5  emp.sal between salgrade.losal and salgrade.hisal;
    SQL> select plan_table_output from table(dbms_xplan.display());
    Plan hash value: 4131418678
    | Id  | Operation             | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT      |          |     1 |    36 |    12  (25)| 00:00:01 |
    |*  1 |  HASH JOIN            |          |     1 |    36 |    12  (25)| 00:00:01 |
    |   2 |   MERGE JOIN          |          |     1 |    23 |     8  (25)| 00:00:01 |
    |   3 |    SORT JOIN          |          |     5 |    50 |     4  (25)| 00:00:01 |
    |   4 |     TABLE ACCESS FULL | SALGRADE |     5 |    50 |     3   (0)| 00:00:01 |
    |*  5 |    FILTER             |          |       |       |            |          |
    |*  6 |     SORT JOIN         |          |    14 |   182 |     4  (25)| 00:00:01 |
    |   7 |      TABLE ACCESS FULL| EMP      |    14 |   182 |     3   (0)| 00:00:01 |
    |   8 |   TABLE ACCESS FULL   | DEPT     |     4 |    52 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - access("EMP"."DEPTNO"="DEPT"."DEPTNO")
       5 - filter("EMP"."SAL"<="SALGRADE"."HISAL")
       6 - access("EMP"."SAL">="SALGRADE"."LOSAL")
           filter("EMP"."SAL">="SALGRADE"."LOSAL")for example my question is why there is SORT JOIN on step no 6? does it mean that rows obtained from step 7 are sorted? than what is done during the step of FILTER?why there are so many joins. Basically I am not good in this area so need help.
    Thanks
    Edited by: orausern on Sep 23, 2010 11:58 AM

    The operations are performed in the following order: 4, 3, 7, 6, 5, 2, 8, 1, 0. The Merge Join operation in Node 2 consumes the SALGRADE and EMP records produced by Node 3 and Node 5 respectively. Node 3 and Node 5 are therefore visited repeatedly during the Merge Join operation. Whenever Node 3 produces a SALGRADE record, Node 5 tries to produce matching EMP records. Node 6 produces EMP records that satisfy the condition EMP.SAL >= SALGRADE.LOSAL. Node 5 then checks if the EMP records produced by Node 6 satisfy the additional condition EMP.SAL <= SALGRADE.HISAL before releasing them. All the results of the Merge Join operation are stored in a hash table in memory. Once the construction of the hash table is fully complete, the DEPT table is scanned and each DEPT record is checked using the hash table.
    Iggy

  • What are the permissions needed to run explain plans via sql develeper?

    Are the permissions the same in Sql Developer to run explain plans like they are when you run them via sql*plus?

    Yes same permission because the explain plan does not tie to the tools.

  • Index issue - dont understand the cost

    Hello
    I have a 112mil row table that I have copied to a new tablespace, which worked fine
    I'm then adding indexes to the copied table, but gets huge costs in the plans when trying to do a query using the new index, compared to quirying the original table/indexes
    To begin with I tired changing my main index to another tablespace and bigger initial extend, but even if I remove all this, and put it in the same tablespace as the original index and created the same way, I get the same huge difference.
    In most om my system queries this will cause that the CBO doesn't use the index, and the queries get very slow. If I do a simple select and the index is actually chosen, even though the cost is huge, the actual query time is the same as the origibal table/query. I cant get the index cost to change by trying different dbms_stats.gather_index_stats settings
    Can anybody tell me why this new index comes up with such a huge cost, and what I can do to bring the cost down, so that the index actually gets chosen?
    Here are the basic information:
    It's on Oracle 10gR2 (10.2.0.4) EE
    The simplyfied create statement for both the original and the new index:
    CREATE INDEX IDX_POS_DATE ON FMC_POS
    ("UTC_DATE" DESC, FMC_LOGVES_ID)
    CREATE INDEX IDX_POS_DATE_P2 ON FMC_POS_p2
    ("UTC_DATE" DESC, FMC_LOGVES_ID)
    The two indexes in dba_indexes:
    Original:
    OWNER: VTRACK
    INDEX_NAME: IDX_POS_DATE
    INDEX_TYPE: FUNCTION-BASED NORMAL
    TABLE_OWNER: VTRACK
    TABLE_NAME: FMC_POS
    TABLE_TYPE: TABLE
    UNIQUENESS: NONUNIQUE
    COMPRESSION: DISABLED
    PREFIX_LENGTH:
    TABLESPACE_NAME: USERS
    INI_TRANS: 2
    MAX_TRANS: 255
    INITIAL_EXTENT: 65536
    NEXT_EXTENT:
    MIN_EXTENTS: 1
    MAX_EXTENTS: 2147483645
    PCT_INCREASE:
    PCT_THRESHOLD:
    INCLUDE_COLUMN:
    FREELISTS:
    FREELIST_GROUPS:
    PCT_FREE: 10
    LOGGING: YES
    BLEVEL: 3
    LEAF_BLOCKS: 439239
    DISTINCT_KEYS: 108849202
    AVG_LEAF_BLOCKS_PER_KEY: 1
    AVG_DATA_BLOCKS_PER_KEY: 1
    CLUSTERING_FACTOR: 79021005
    STATUS: VALID
    NUM_ROWS: 110950137
    SAMPLE_SIZE: 2177632
    LAST_ANALYZED: 09-05-2011 23:38:15
    DEGREE: 1
    INSTANCES: 1
    PARTITIONED: NO
    TEMPORARY: N
    GENERATED: N
    SECONDARY: N
    BUFFER_POOL: DEFAULT
    USER_STATS: NO
    DURATION:
    PCT_DIRECT_ACCESS:
    ITYP_OWNER:
    ITYP_NAME:
    PARAMETERS:
    GLOBAL_STATS: YES
    DOMIDX_STATUS:
    DOMIDX_OPSTATUS:
    FUNCIDX_STATUS: ENABLED
    JOIN_INDEX: NO
    IOT_REDUNDANT_PKEY_ELIM: NO
    DROPPED: NO
    New:
    OWNER: VTRACK
    INDEX_NAME: IDX_POS_DATE_P2
    INDEX_TYPE: FUNCTION-BASED NORMAL
    TABLE_OWNER: VTRACK
    TABLE_NAME: FMC_POS_P2
    TABLE_TYPE: TABLE
    UNIQUENESS: NONUNIQUE
    COMPRESSION: DISABLED
    PREFIX_LENGTH:
    TABLESPACE_NAME: USERS
    INI_TRANS: 2
    MAX_TRANS: 255
    INITIAL_EXTENT: 65536
    NEXT_EXTENT:
    MIN_EXTENTS: 1
    MAX_EXTENTS: 2147483645
    PCT_INCREASE:
    PCT_THRESHOLD:
    INCLUDE_COLUMN:
    FREELISTS:
    FREELIST_GROUPS:
    PCT_FREE: 10
    LOGGING: YES
    BLEVEL: 3
    LEAF_BLOCKS: 408128
    DISTINCT_KEYS: 111888565
    AVG_LEAF_BLOCKS_PER_KEY: 1
    AVG_DATA_BLOCKS_PER_KEY: 1
    CLUSTERING_FACTOR: 88607794
    STATUS: VALID
    NUM_ROWS: 112757727
    SAMPLE_SIZE: 112757727
    LAST_ANALYZED: 23-06-2011 07:57:14
    DEGREE: 1
    INSTANCES: 1
    PARTITIONED: NO
    TEMPORARY: N
    GENERATED: N
    SECONDARY: N
    BUFFER_POOL: DEFAULT
    USER_STATS: NO
    DURATION:
    PCT_DIRECT_ACCESS:
    ITYP_OWNER:
    ITYP_NAME:
    PARAMETERS:
    GLOBAL_STATS: NO
    DOMIDX_STATUS:
    DOMIDX_OPSTATUS:
    FUNCIDX_STATUS: ENABLED
    JOIN_INDEX: NO
    IOT_REDUNDANT_PKEY_ELIM: NO
    DROPPED: NO
    The simple selects and costs:
    Original table/index:
    select * from fmc_pos where utc_date>sysdate-10
    Plan:
    SELECT STATEMENT ALL_ROWS
    Cost: 5 Bytes: 5.350 Cardinality: 50           
    2 TABLE ACCESS BY INDEX ROWID TABLE VTRACK.FMC_POS
    Cost: 5 Bytes: 5.350 Cardinality: 50      
    1 INDEX RANGE SCAN INDEX VTRACK.IDX_POS_DATE
    Cost: 4 Cardinality: 1
    Original table/index:
    select * from fmc_pos_p2 where utc_date>sysdate-10
    Plan:
    Plan
    SELECT STATEMENT ALL_ROWS
    Cost: 3.067 Bytes: 2.708.856 Cardinality: 25.082           
    2 TABLE ACCESS BY INDEX ROWID TABLE VTRACK.FMC_POS_P2
    Cost: 3.067 Bytes: 2.708.856 Cardinality: 25.082      
    1 INDEX RANGE SCAN INDEX VTRACK.IDX_POS_DATE_P2
    Cost: 2.927 Cardinality: 177

    KlausMogensen wrote:
    You are exactly right. The plan for the original table is to good to be true when searching for recent dates, because the statistics are outdated. If I do searches for older data, I get the same cost for both selects
    The funny part is that the outdated to good to be true statistics gives me the better performance for the more complex selects in the system, because the index always gets chosen. I guess I will have to use hints in my complex selects
    It's possible that the clustering_factor of the index is not a good model of how well the data really is clustered. The method the optimizer uses to calculate this figure is very naive and can easily be much too high if the data has even a fairly small degree of scatter (relative to the index). You may find that modifying the clustering_factor in a realistic way will solve the problem. Since the optimizer is also pessimistic about branch block caching in nested loops and in-list iterators you could also consider reducing the blevel by 1 or 2 to encourage it to use a good index.
    There's a note on my blog about adjusting index stats: http://jonathanlewis.wordpress.com/2010/01/06/copy-stats/
    Regards
    Jonathan Lewis

  • Three part blog about Reducing the Cost to Implement a Security Plan

    Part 3 of a great blog done by in AlienVault Support who has "heard it all" about the problems SMBs have in implementing a security plan with small budgets. Kenneth offers lots of practical and helpful advice for IT and security practitioners.
    https://www.alienvault.com/blogs/security-essentials/third-step-in-reducing-the-cost-to-implement-a-...
    This topic first appeared in the Spiceworks Community

    hi Elistariel -
    With no texting plan, it is 25 cents per picture message. The LG VX5500 (same phone my daughter has) does not use a memory card, so you can try two different programs on your computer (both free) and see if either one will get the pics off and saved on your computer; from there you can upload to your online album without a per picture charge.
    You can try Verizon's VCast media manager - download and install it on your computer, then use the USB cable to link the phone to the computer and transfer the pics with VCast.
    Here's a link
    A third party program called BitPim will also work, but it's more technical and does a lot more than just transfer your media. It can also brick your phone if you don't know what you are doing, so it's "use at your own risk", as Verizon won't cover any losses due to using BitPim. It does work though--I have used it, very cautiously!

  • How can I fix the 1st column width (member) in Planning data forms

    Hi all,
    does anybody know a trick, how I can fix the first column width in planning data forms? I need a composite data form (Planning 9.3.1) and the problem is, that in the first form the member names are longer. So Planning sizes the column as it is needed to display the full member name. The member names of the second data form are shorter, so the data entry cells are not exactly among each other for both data forms and that looks terrible....
    Thanks and kind regards
    André

    There are 3 ways of setting the width in webforms:-
    1. There is a global setting for input box length which has a syntax of FormInputBoxLength=30.
    2. When you specify the format for each of the dimensions you can choose to select the width of either a column heading or a row heading. In the following example, each time you specified the dimension ‘Account’ a format would be applied to its header. The syntax for this would be something like… HeaderOptionAccount=Length:50,Style:font-size: 12pt;font-family: calibri
    3. Each column can have its own width specified. The syntax for this can be setting in each of the column’s code. For example C6=Blank,Style:Background-color:rgb(203,218,231);width:3 would just show a thick vertical line as the width is so small.
    You can not set widths in data grids through the normal settings. You can manually change the widths and save the grid though. This can be done in the xml directly. For example… <HDRWIDTH idx=”0″ width=”50″/>.
    Then load the amended xml file back into the system.

  • COLUMN WIDTH USING EXPLAIN PLAN

    I set autotrace on and when it displays the Execution Plan it wrap and is quite annoying. Is there a command so it will not wrap, but still display all the output?

    You misunderstood, this it what it look like
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1 Bytes=62)
       1    0   FILTER
       2    1     TABLE ACCESS (FULL) OF 'NEW_TRAINING_REQUIREMENT' (Cost=
              1 Card=1 Bytes=62)
       3    1     NESTED LOOPS (Cost=12 Card=6 Bytes=210)
       4    3       MERGE JOIN (CARTESIAN) (Cost=6 Card=6 Bytes=168)
       5    4         NESTED LOOPS (Cost=2 Card=1 Bytes=18)
       6    5           TABLE ACCESS (BY INDEX ROWID) OF 'CORP_TESTERS' (C
              ost=1 Card=1 Bytes=10)
       7    6             INDEX (UNIQUE SCAN) OF 'IDX_PK_CORP_TESTERS_1' (
              UNIQUE)
       8    5           TABLE ACCESS (FULL) OF 'FULLTIME_WORKER' (Cost=1 C
              ard=1 Bytes=8)
       9    4         SORT (JOIN) (Cost=5 Card=6 Bytes=60)
      10    9           TABLE ACCESS (FULL) OF 'NEW_PERSONAL' (Cost=4 Card
              =6 Bytes=60)
      11    3       TABLE ACCESS (BY INDEX ROWID) OF 'NEW_ORGANIZATION' (C
              ost=1 Card=348 Bytes=2436)
      12   11         INDEX (UNIQUE SCAN) OF 'IDX_PK_NEWORGANIZATION_1' (U
              NIQUE)But I would like for it to look like
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1 Bytes=62)
       1    0   FILTER
       2    1     TABLE ACCESS (FULL) OF 'NEW_TRAINING_REQUIREMENT' (Cost=1 Card=1 Bytes=62)
       3    1     NESTED LOOPS (Cost=12 Card=6 Bytes=210)
       4    3       MERGE JOIN (CARTESIAN) (Cost=6 Card=6 Bytes=168)
       5    4         NESTED LOOPS (Cost=2 Card=1 Bytes=18)
       6    5           TABLE ACCESS (BY INDEX ROWID) OF 'CORP_TESTERS' (Cost=1 Card=1 Bytes=10)
       7    6             INDEX (UNIQUE SCAN) OF 'IDX_PK_CORP_TESTERS_1' (UNIQUE)
       8    5           TABLE ACCESS (FULL) OF 'FULLTIME_WORKER' (Cost=1 Card=1 Bytes=8)
       9    4         SORT (JOIN) (Cost=5 Card=6 Bytes=60)
      10    9           TABLE ACCESS (FULL) OF 'NEW_PERSONAL' (Cost=4 Card=6 Bytes=60)
      11    3       TABLE ACCESS (BY INDEX ROWID) OF 'NEW_ORGANIZATION' (Cost=1 Card=348 Bytes=2436)
      12   11         INDEX (UNIQUE SCAN) OF 'IDX_PK_NEWORGANIZATION_1' (UNIQUE)If I set wrap off it cuts off what normally would appear in the second line

  • What is the significance of "cost" column in explain plan

    Hi,
    Can anyone explain what is the meaning of the values which we get in the cost column in the explain plan..For Ex : Cost : 4500 . What does this value mean...and is it measured in which form of units...i mean seconds,nanoseconds etc

    kingfisher,
    Ok one more link for you but I shall quote the text also here,
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/optimops.htm#i82005
    The cost is an estimated value proportional to the expected resource use needed to execute the statement with a particular plan. The optimizer calculates the cost of access paths and join orders based on the estimated computer resources, which includes I/O, CPU, and memory.
    And few paragraphs down,
    13.4.1.3.3 Cost
    The cost represents units of work or resource used. The query optimizer uses disk I/O, CPU usage, and memory usage as units of work. So, the cost used by the query optimizer represents an estimate of the number of disk I/Os and the amount of CPU and memory used in performing an operation. The operation can be scanning a table, accessing rows from a table by using an index, joining two tables together, or sorting a row set. The cost of a query plan is the number of work units that are expected to be incurred when the query is executed and its result produced.
    The access path determines the number of units of work required to get data from a base table. The access path can be a table scan, a fast full index scan, or an index scan. During table scan or fast full index scan, multiple blocks are read from the disk in a single I/O operation. Therefore, the cost of a table scan or a fast full index scan depends on the number of blocks to be scanned and the multiblock read count value. The cost of an index scan depends on the levels in the B-tree, the number of index leaf blocks to be scanned, and the number of rows to be fetched using the rowid in the index keys. The cost of fetching rows using rowids depends on the index clustering factor. See "Assessing I/O for Blocks, not Rows".
    The join cost represents the combination of the individual access costs of the two row sets being joined, plus the cost of the join operation.
    Now I guess if you read this part, it should be pretty clear what cost is.Cost is an evlaution of the resource that is estimated by Oracle for every step incurred in the uery execution.There are no of steps and each may involve doing IO,consuming CPU and/or using memory.Cost is a factor which oracle uses combining all of these 3 (depending on the version) together to propose the work done or expected to be done in exeuting a query.So this actualy should represent the time spent exactly on each and every step.That's what the objective frm cost is.But at the moment,this is not there.There amy be a situation that cost is shown as very high but query is working fine.There are woraround which can bring the cost down for example using and tweaking optimizer_index_cost_adj parameter , we can propose oracle regarding our indexes and it may pick up lesser cost evaluation.What is mentioned is that this model is becoming more and more mature and in the next releases, we may see that cost is representing exactly the time that we would spend inthe query.At the moment,its not there.So as Chris mentioned,Tuning for low cost only is not a good way.
    I suggest you grab a copy of JL's book.He has explained it much better in his book.
    Hope I said some thing useful.
    Aman....

  • Cost in Explain Plan

    Hi all,
    Is the "COST" column in explain plan CPU or MEMORY usage cost? or both
    Thanks

    I am not sure this is also documented with same detail level.
    http://download.oracle.com/docs/cd/E11882_01/server.112/e16638/optimops.htm#sthref860 says:
    >
    The cost is an estimated value proportional to the expected resource use needed to execute the statement with a particular plan. The optimizer calculates the cost of access paths and join orders based on the estimated computer resources, which includes I/O, CPU, and memory.
    >
    and http://download.oracle.com/docs/cd/E11882_01/server.112/e16638/ex_plan.htm#sthref1110 says
    >
    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.
    >
    Edited by: P. Forstmann on 6 avr. 2011 08:38

  • Weird explain plan on multi-level structured XmlType column

    Hello,
    am running an explain on the follwing query on 11.2.0.2:
    SELECT
    T1.EVENT_ID,
    ACTION_SUB_ID,
    PARAM_KEY,
    PARAM_VALUE,
    TO_DATE('2013-12-10', 'YYYY-MM-DD')
    FROM  T_C_RMP_MNTRNG_XML_FULL_IL ,
      XMLTABLE('/monitoring' PASSING XML_CONTENT COLUMNS
      EVENT_ID VARCHAR2(4000) PATH 'eventId',
      ACTIONS XMLTYPE PATH 'action'
    ) T1,
      XMLTABLE('/action' PASSING T1.ACTIONS COLUMNS
      ACTION_SUB_ID NUMBER(10,0) PATH 'actionSubId',
      PARAMS xmltype PATH 'param'
    ) T2,
      XMLTABLE('/param' PASSING T2.params columns
      PARAM_KEY VARCHAR2(4000) PATH 'key',
      PARAM_VALUE VARCHAR2(1000) PATH 'value'
    ) T3
    WHERE MESSAGE_ID = 4972102 ;
    Although MESSAGE_ID is the primary key of T_C_RMP_MNTRNG_XML_FULL_IL and thus there is only one record matching the condition, I get an explain plan with huge costs, 500MB of data and an estimated 10 hour runtime:
    PLAN_TABLE_OUTPUT
    Plan hash value: 4011854835
    | Id  | Operation                      | Name                  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |                       |   223K|   489M|  3111K  (1)| 10:22:17 |
    |   1 |  NESTED LOOPS                  |                       |       |       |            |          |
    |   2 |   NESTED LOOPS                 |                       |   223K|   489M|  3111K  (1)| 10:22:17 |
    |   3 |    NESTED LOOPS                |                       |   140K|    11M|  1678   (1)| 00:00:21 |
    |*  4 |     INDEX RANGE SCAN           | X1B                   |     1 |    53 |     3   (0)| 00:00:01 |
    |   5 |     TABLE ACCESS BY INDEX ROWID| T_OR_MON_ACTION       |   140K|  4542K|  1675   (1)| 00:00:21 |
    PLAN_TABLE_OUTPUT
    |*  6 |      INDEX RANGE SCAN          | X3                    |   140K|       |     4  (25)| 00:00:01 |
    |*  7 |    INDEX RANGE SCAN            | X4G                   |  4083 |       |    22   (0)| 00:00:01 |
    |   8 |   TABLE ACCESS BY INDEX ROWID  | T_OR_MON_ACTION_PARAM |     2 |  4428 |    52   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       4 - access("MESSAGE_ID"=4972102)
       6 - access("SYS_ALIAS_0"."NESTED_TABLE_ID"="T_C_RMP_MNTRNG_XML_FULL_IL"."SYS_NC0001200013$")
       7 - access("NESTED_TABLE_ID"="SYS_ALIAS_0"."SYS_NC0000500006$")
    PLAN_TABLE_OUTPUT
    Note
       - dynamic sampling used for this statement (level=2)
    When I run the query, the result comes back within 0.3 seconds.
    Why is the explain plan off like that?
    Is this just the way it is, or is there something going wrong here?

    This is my table create statement:
    CREATE TABLE QQRCSBI0.T_C_RMP_MNTRNG_XML_FULL_IL (
      MESSAGE_ID NUMBER(22,0) NOT NULL ENABLE,
      XML_EVAL_ID NUMBER(22,0),
      VIN7 VARCHAR2(7 BYTE),
      FLEET_ID VARCHAR2(50 BYTE),
      CSC_SW_VERSION VARCHAR2(100 BYTE),
      RECEIVED DATE,
      XML_CONTENT SYS.XMLTYPE ,
      DWH_LM_TS_UTC DATE NOT NULL ENABLE,
      CONSTRAINT PK_C_RMP_MNTRNG_XML_FULL_IL5 PRIMARY KEY (MESSAGE_ID)
    ) NOLOGGING TABLESPACE CATALOG
    VARRAY "XML_CONTENT"."XMLDATA"."ACTION" STORE AS TABLE "T_OR_MON_ACTION" (
      NOLOGGING TABLESPACE "CATALOG"
      VARRAY "PARAM" STORE AS TABLE "T_OR_MON_ACTION_PARAM" (
      NOLOGGING TABLESPACE "CATALOG"
      ) RETURN AS LOCATOR
    ) RETURN AS LOCATOR
    XMLTYPE XML_CONTENT STORE AS OBJECT RELATIONAL XMLSCHEMA "http://mydomain.com/csc_monitoring_session.xsd" ELEMENT "monitoring";
    I set all default table names in the schema to blank and registered the schema with genTables=false.
    I am still running into problems retrieving the 3rd level T_OR_MON_ACTION_PARAM data. The query just crashes after a while because it is running out of either TEMP space or UNDO space (it keeps changing). I'll take a step back to re-evaluate and post another thread about that in a bit I guess...
    You said "SQL*Plus explain plan, goes most of the time bananas" - is there a difference in what client (SqlPlus or SqlDeveloper) I use to get the explain plan? I thought the plan was generated by the DB and the clients just display the result, and the only difference is the way the clients display the plan?!

  • "Cost" column of the VF03

    Hi,
    Can anybody explain where the "cost" column of the VF03 screen come from (from the material master, condition records or sales document's conditions...)?
    Thanks in advance?

    Hi John
    The condition type VPRS goes into the valuation segment in the material master and determines from this the standard price or average price.
    Thanks
    G. Lakshmipathi

  • What are the privileges required for explain plan in Oracle 11g database

    I am facing the problem in doing a explain plan for a view in Oracle 11g database. When I select from the view like this:
    select * from zonewisearpu
    It does a select on the view but when I give explain plan like
    explain plan for
    select * from zonewisearpu
    I get the error like insufficient privileges.
    Please let me know if things are getting missed out as I guess system level privileges are required to execute this.
    I hope, my question is clear.
    It’s a humble request to revert urgently if possible as I need to complete a task and do not know the way out.
    Regards

    975148 wrote:
    Thanks for your reply. I have found out that an explain plan is possible on the user's own objects and is not possible on the granted objects from a different schema. For eg, if I do a explain plan on a view querying on tables from a different view, it would not allow the explain plan to proceed. This could mean that explain plan needs different privileges than just a select.
    Requesting for a revert to this.
    Here is a simple test case that I have perfomed
    SQL> create user test1 identified by test1;
    User created.
    SQL> create user test2 identified by test1;
    User created.
    SQL> grant connect, resource to test1,test2;
    Grant succeeded.
    SQL> create table test1.tab1 as select * from v$session;
    Table created.
    SQL> connect test2/test1
    Conencted.
    SQL> show user
    USER is "TEST2"
    SQL>
    SQL> explain plan for
      2  select sid,serial#,status,username from test1.tab1 where username<> '';
    Explained.
    SQL>
    So, as can be seen I am able to do a explain plan from user test2 for tables belong to user test1.
    As far as privileges are concerned, following is the list
    SQL> select * from dba_role_privs where grantee in ('TEST1','TEST2') order by 1;
    GRANTEE                        GRANTED_ROLE                   ADM DEF
    TEST1                          CONNECT                        NO  YES
    TEST1                          RESOURCE                       NO  YES
    TEST2                          CONNECT                        NO  YES
    TEST2                          RESOURCE                       NO  YES
    SQL>
    SQL> select grantee,owner,table_name,privilege from dba_tab_privs where grantee in ('TEST1','TEST2') order by 1;
    GRANTEE    OWNER      TABLE_NAME           PRIVILEGE
    TEST2      TEST1      TAB1                 SELECT
    SQL>
    SQL>  select * from dba_sys_privs where grantee in ('TEST1','TEST2') order by 1;
    GRANTEE    PRIVILEGE                      ADM
    TEST1      UNLIMITED TABLESPACE           NO
    TEST2      UNLIMITED TABLESPACE           NO
    SQL>

Maybe you are looking for

  • Install odi error

    edit file :/etc/profile,add content: JAVA_HOME="/usr/local/jdk1.5.0" JRE_HOME="/usr/local/jdk1.5.0/jre" PATH=$PATH:$HOME/bin:$JAVA_HOME/bin:$JRE_HOME/bin CLASSPATH=.:$JAVA_HOME/lib/:$JRE_HOME/lib/ export JAVA_HOME JRE_HOME PATH CLASSPATH [oracle@loca

  • Songs in itunes match are not on my iphone

    I have recently started to trial iTunes Match and with 20k+ carefully managed songs with all artwork intact, I am confused and perplexed on why some songs are not uploaded to the Cloud; why some artwork is then missing in Match; and why songs showing

  • Classes for converting a flat file to XML

    I've been asked to convert text in a flat file to an XML document. The XML document must conform to an XML schema. Currenlty, there is no requirement to store the resulting xml in the database. Therefore my approach will be: 1. parse the flat file an

  • Segmentation of Organizations related to other Organizations

    Hi Experts, I am trying to segment Organizations (e.g. Sold-tos) that are related other Organizations (e.g. Buyers). Buyers are not created as contact persons but as corporate accounts as well and are connected to the Sold-to via the relationship "Ha

  • Message no. VF072

    HI At the time of Creating pro-forma invoice Based on the Delivery Document Number every time i am getting the Error i have to select manually every time i think it is very difficult to enter evbery time to enduser how to avoid this Guide me Regards,