Index not using the base table

Hi,
In which scenario, a query will only use the index and not the base table. Please give me some example.
Thanks,
Santhosh
Edited by: Santhosh on Oct 23, 2012 2:45 AM

Chancal,
not always,
SQL> desc temp;
Name                                                                                                      Null?    Type
EMPNO                                                                                                              NUMBER(4)
ENAME                                                                                                              VARCHAR2(10)
JOB                                                                                                                VARCHAR2(9)
MGR                                                                                                                NUMBER(4)
HIREDATE                                                                                                           DATE
SAL                                                                                                                NUMBER(7,2)
COMM                                                                                                               NUMBER(7,2)
DEPTNO                                                                                                             NUMBER(2)
SQL> select empno from temp;
     EMPNO
      7369
      7499
      7521
      7566
      7654
      7698
      7782
      7788
      7839
      7844
      7876
      7900
      7902
      7934
      1057
15 rows selected.
SQL> select * from table(dbms_xplan.display_cursor);
PLAN_TABLE_OUTPUT
SQL_ID  3qt0w20pqj162, child number 0
select empno from temp
Plan hash value: 3800668828
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT  |      |       |       |     2 (100)|          |
|   1 |  TABLE ACCESS FULL| TEMP |    15 |    60 |     2   (0)| 00:00:01 |
13 rows selected.
SQL> alter table temp modify(empno not null);
Table altered.
SQL> select empno from temp;
     EMPNO
      1057
      7369
      7499
      7521
      7566
      7654
      7698
      7782
      7788
      7839
      7844
      7876
      7900
      7902
      7934
15 rows selected.
SQL> select * from table(dbms_xplan.display_cursor);
PLAN_TABLE_OUTPUT
SQL_ID  3qt0w20pqj162, child number 0
select empno from temp
Plan hash value: 472861760
| Id  | Operation        | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT |          |       |       |     1 (100)|          |
|   1 |  INDEX FULL SCAN | IDX_TEMP |    15 |    60 |     1   (0)| 00:00:01 |
13 rows selected.

Similar Messages

  • How to order by a column not on the base table?

    Best explained by example:
    I have 1 block, base table is SALE. I would like to sort this block by PROD_DESCRIPTION which is not on SALE. I only have PROD_CODE (the primary key of PRODUCT which contains PROD_DESCRIPTION)
    I am not running Enterprise Edition so I cannot create a view and use Instead-of triggers.
    I would rather not have to re-write all my triggers because I want the default base table behaviour that forms provides.
    Any ideas?
    Cheers,
    Tim.

    Hey tim,
    I also had a similar problem.
    You need to create a function in the database with an associated
    pragma to specify the level of purity of the function
    WNDS (write no database state)
    WNPS (write no package state)
    PRAGMA RESTRICT_REFERENCES(fn_get_dname, WNDS, WNPS);
    Function fn_get_dname (p_empno in number) return varchar2 is
    v_dept_name varchar2(40);
    begin
    select dname into v_dept_name
    from dept, emp
    where dept.deptno = emp.deptno
    and emp.emp_no = p_emp_no;
    return v_dept_name;
    end;
    order by in a block based on the emp table (assuming you want a list of employees by department name)
    order by fn_get_dname(empno), empno
    Hope that will help you to solve your problem.
    Thanks
    Pranati

  • Index not used on view when table stats exist

    Hello,
    I would be grateful if someone comes with ideas on the following problem I'm currently facing.
    I have a table with XMLTYPE data type column:
    sql-->desc ACFBNK_STMT008
    RECID     NOT NULL     VARCHAR2(200)
    XMLRECORD XMLTYPE
    I have a view V_ACFBNK_STMT008 on that table, in which the view columns are defined as extracted tags values from the XMLTYPE field, e.g. for the view field N_BOOKING_DATE:
    numcast(extractValue(xmlrecord,'/row/c25')) "N_BOOKING_DATE"
    (note: numcast is just a simple function that returns TO_NUMBER of its input argument)
    I have also a function-based index on this field of the table:
    CREATE INDEX train4.NIX_ACFBNK_STMT008_C25
    ON train4.ACFBNK_STMT008("TRAIN4"."NUMCAST"(extractValue(xmlrecord,'/row/c25')))
    And so, I'm executing on the view the following SQL statement:
    SELECT RECID FROM V_ACFBNK_STMT008 WHERE (N_BOOKING_DATE > TO_NUMBER('20070725'));
    Now, the problem comes: when statistics exist on the view base table (that is ACFBNK_STMT008) then the above statement is not using the index and is making a "table access full". When I delete the statistics for the table then the SQL runs fast with an "index range scan".
    Which is further strange - when I change the ">" operand with a "=" the SQL statement correctly captures the index regardless of whether or not statistics exist.
    I've tried to manually rewrite the SQL and include the "numcast" function in it:
    SELECT RECID FROM TRAIN4.V_ACFBNK_STMT008 WHERE ( N_BOOKING_DATE>train4.numcast(TO_NUMBER( '20010725' ) ));
    And in this way the index is used OK even with statistics existing!
    But regretfully I don't have a way to change the application and the SQL, so the only things I can change is the view and/or the index.
    Thank you in advance,
    Evgeni
    P.S.
    I've tried gathering statistics in both the following ways but still the problem persists:
    sql-->analyze table train4.ACFBNK_STMT008 compute statistics;
    sql-->exec dbms_stats.gather_table_stats(ownname=>'TRAIN4', tabname=>'ACFBNK_STMT008', CASCADE=>TRUE, partname=>NULL);

    Oh, and I forgot to mention: I cannot change the view definition as well (for example, to remove the "numcast"), since every now and then the application would recreate it automatically with the same code. :(

  • Why is this query not using the index?

    check out this query:-
    SELECT CUST_PO_NUMBER, HEADER_ID, ORDER_TYPE, PO_DATE
    FROM TABLE1
    WHERE STATUS = 'N'
    and here's the explain plan:-
    1     
    2     -------------------------------------------------------------------------------------
    3     | Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
    4     -------------------------------------------------------------------------------------
    5     | 0 | SELECT STATEMENT | | 2735K| 140M| 81036 (2)|
    6     |* 1 | TABLE ACCESS FULL| TABLE1 | 2735K| 140M| 81036 (2)|
    7     -------------------------------------------------------------------------------------
    8     
    9     Predicate Information (identified by operation id):
    10     ---------------------------------------------------
    11     
    12     1 - filter("STATUS"='N')
    There is already an index on this column, as is shown below:-
         INDEX_NAME INDEX_TYPE     UNIQUENESS     TABLE_NAME     COLUMN_NAME     COLUMN_POSITION
    1     TABLE1_IDX2 NORMAL     NONUNIQUE     TABLE1      STATUS     1
    2     TABLE1_IDX NORMAL     NONUNIQUE     TABLE1     HEADER_ID     1
    So why is this query not using the index on the 'STATUS' Column?
    I've already tried using optimizer hints and regathering the stats on the table, but the execution plan still remains the same, i.e. it still uses a FTS.
    I have tried this command also:-
    exec dbms_stats.gather_table_stats('GECS','GEPS_CS_SALES_ORDER_HEADER',method_opt=>'for all indexed columns size auto',cascade=>true,degree=>4);
    inspite of this, the query is still using a full table scan.
    The table has around 55 Lakh records, across 60 columns. And because of the FTS, the query is taking a long time to execute. How do i make it use the index?
    Please help.
    Edited by: user10047779 on Mar 16, 2010 6:55 AM

    If the cardinality is really as skewed as that, you may want to look at putting a histogram on the column (sounds like it would be in order, and that you don't have one).
    create table skewed_a_lot
    as
       select
          case when mod(level, 1000) = 0 then 'N' else 'Y' end as Flag,
          level as col1
       from dual connect by level <= 1000000;
    create index skewed_a_lot_i01 on skewed_a_lot (flag);
    exec dbms_stats.gather_table_stats(user, 'SKEWED_A_LOT', cascade => true, method_opt => 'for all indexed columns size auto');Is an example.

  • Query not using the index

    Query
    SELECT case.case_objid FROM [email protected] case, table_x_cwp_tickect_details_vw t WHERE CASE.case_condition_cd IN ('OPEN', 'OPEN-DISPATCH', 'OPEN-REJECT', 'OPEN-RETURNED') AND case.case_type_cd in ('CUSTOMER FAULT', 'CHRONIC','SCHEDULED ACTIVITY','PROBLEM') AND ROWNUM <= 500 AND case.case_objid = t.ticket_objid AND ( ( case.account_id = '672286' ) ) ORDER BY case.case_id DESC
    From PROD
    Plan
    SELECT STATEMENT HINT: FIRST_ROWS Cost: 2,629 Bytes: 221,500 Cardinality: 500
         37 SORT ORDER BY Cost: 2,629 Bytes: 221,500 Cardinality: 500
              36 COUNT STOPKEY
                   35 NESTED LOOPS OUTER Cost: 2,628 Bytes: 279,533 Cardinality: 631
                        33 HASH JOIN OUTER Cost: 2,627 Bytes: 275,116 Cardinality: 631
                             31 NESTED LOOPS OUTER Cost: 2,249 Bytes: 266,282 Cardinality: 631
                                  28 NESTED LOOPS Cost: 1,766 Bytes: 257,448 Cardinality: 631
                                       26 NESTED LOOPS Cost: 1,765 Bytes: 253,031 Cardinality: 631
                                            24 NESTED LOOPS Cost: 1,764 Bytes: 248,614 Cardinality: 631
                                                 22 NESTED LOOPS Cost: 1,763 Bytes: 244,197 Cardinality: 631
                                                      19 NESTED LOOPS Cost: 1,258 Bytes: 235,363 Cardinality: 631
                                                           17 NESTED LOOPS Cost: 1,257 Bytes: 230,946 Cardinality: 631
                                                                14 NESTED LOOPS OUTER Cost: 752 Bytes: 217,695 Cardinality: 631
                                                                     12 HASH JOIN Cost: 751 Bytes: 213,278 Cardinality: 631
                                                                          1 INDEX FAST FULL SCAN INDEX (UNIQUE) SA.GBST_ELM_OBJINDEX Cost: 2 Bytes: 10,052 Cardinality: 1,436
                                                                          11 HASH JOIN Cost: 748 Bytes: 208,861 Cardinality: 631
                                                                               2 INDEX FAST FULL SCAN INDEX (UNIQUE) SA.GBST_ELM_OBJINDEX Cost: 2 Bytes: 10,052 Cardinality: 1,436
                                                                               10 HASH JOIN Cost: 746 Bytes: 204,444 Cardinality: 631
                                                                                    3 INDEX FAST FULL SCAN INDEX (UNIQUE) SA.GBST_ELM_OBJINDEX Cost: 2 Bytes: 10,052 Cardinality: 1,436
                                                                                    9 HASH JOIN Cost: 743 Bytes: 200,027 Cardinality: 631
                                                                                         4 INDEX FAST FULL SCAN INDEX (UNIQUE) SA.GBST_ELM_OBJINDEX Cost: 2 Bytes: 10,052 Cardinality: 1,436
                                                                                         8 NESTED LOOPS Cost: 741 Bytes: 195,610 Cardinality: 631
                                                                                              5 REMOTE REMOTE CASE Cost: 235 Bytes: 156,488 Cardinality: 631
                                                                                              7 TABLE ACCESS BY INDEX ROWID TABLE SA.TABLE_CASE Cost: 1 Bytes: 62 Cardinality: 1
                                                                                                   6 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.TC_C_CASE_OBJINDEX Cost: 1 Cardinality: 1
                                                                     13 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.UN_PTT2CASE Cost: 1 Bytes: 7 Cardinality: 1
                                                                16 TABLE ACCESS BY INDEX ROWID TABLE SA.TABLE_SITE Cost: 1 Bytes: 21 Cardinality: 1
                                                                     15 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.SITE_OBJINDEX Cost: 1 Cardinality: 1
                                                           18 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.BUS_ORG_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
                                                      21 TABLE ACCESS BY INDEX ROWID TABLE SA.TABLE_ADDRESS Cost: 1 Bytes: 14 Cardinality: 1
                                                           20 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.ADDRESS_OBJINDEX Cost: 1 Cardinality: 1
                                                 23 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.COUNTRY_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
                                            25 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.CONTACT_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
                                       27 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.CONDITION_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
                                  30 TABLE ACCESS BY GLOBAL INDEX ROWID TABLE SA.TABLE_SITE_PART Cost: 1 Bytes: 14 Cardinality: 1 Partition #: 34
                                       29 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.SITE_PART_OBJINDEX Cost: 1 Cardinality: 1
                             bold 32 TABLE ACCESS FULL TABLE SA.TABLE_MOD_LEVEL Cost: 376 Bytes: 1,442,084 Cardinality: 103,006 bold
                        34 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.PART_NUM_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
    From DEV platform
    Plan
    SELECT STATEMENT HINT: FIRST_ROWS Cost: 591 Bytes: 61,134 Cardinality: 138
         37 SORT ORDER BY Cost: 591 Bytes: 61,134 Cardinality: 138
              36 COUNT STOPKEY
                   35 HASH JOIN Cost: 590 Bytes: 61,134 Cardinality: 138
                        1 INDEX FAST FULL SCAN INDEX (UNIQUE) SA.GBST_ELM_OBJINDEX Cost: 2 Bytes: 10,045 Cardinality: 1,435
                        34 HASH JOIN Cost: 588 Bytes: 60,168 Cardinality: 138
                             2 INDEX FAST FULL SCAN INDEX (UNIQUE) SA.GBST_ELM_OBJINDEX Cost: 2 Bytes: 10,045 Cardinality: 1,435
                             33 HASH JOIN Cost: 585 Bytes: 59,202 Cardinality: 138
                                  3 INDEX FAST FULL SCAN INDEX (UNIQUE) SA.GBST_ELM_OBJINDEX Cost: 2 Bytes: 10,045 Cardinality: 1,435
                                  32 HASH JOIN Cost: 583 Bytes: 58,236 Cardinality: 138
                                       4 INDEX FAST FULL SCAN INDEX (UNIQUE) SA.GBST_ELM_OBJINDEX Cost: 2 Bytes: 10,045 Cardinality: 1,435
                                       31 NESTED LOOPS OUTER Cost: 580 Bytes: 57,270 Cardinality: 138
                                            29 NESTED LOOPS OUTER Cost: 579 Bytes: 56,304 Cardinality: 138
                                                 27 NESTED LOOPS OUTER Cost: 469 Bytes: 54,372 Cardinality: 138
                                                      24 NESTED LOOPS Cost: 363 Bytes: 52,440 Cardinality: 138
                                                           22 NESTED LOOPS Cost: 362 Bytes: 51,474 Cardinality: 138
                                                                20 NESTED LOOPS Cost: 361 Bytes: 50,508 Cardinality: 138
                                                                     18 NESTED LOOPS Cost: 360 Bytes: 49,542 Cardinality: 138
                                                                          15 NESTED LOOPS Cost: 249 Bytes: 47,610 Cardinality: 138
                                                                               13 NESTED LOOPS Cost: 248 Bytes: 46,644 Cardinality: 138
                                                                                    10 NESTED LOOPS OUTER Cost: 138 Bytes: 43,746 Cardinality: 138
                                                                                         8 NESTED LOOPS Cost: 137 Bytes: 42,780 Cardinality: 138
                                                                                              5 REMOTE REMOTE CASE Cost: 26 Bytes: 34,224 Cardinality: 138
                                                                                              7 TABLE ACCESS BY INDEX ROWID TABLE SA.TABLE_CASE Cost: 1 Bytes: 62 Cardinality: 1
                                                                                                   6 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.TC_C_CASE_OBJINDEX Cost: 1 Cardinality: 1
                                                                                         9 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.UN_PTT2CASE Cost: 1 Bytes: 7 Cardinality: 1
                                                                                    12 TABLE ACCESS BY INDEX ROWID TABLE SA.TABLE_SITE Cost: 1 Bytes: 21 Cardinality: 1
                                                                                         11 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.SITE_OBJINDEX Cost: 1 Cardinality: 1
                                                                               14 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.BUS_ORG_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
                                                                          17 TABLE ACCESS BY INDEX ROWID TABLE SA.TABLE_ADDRESS Cost: 1 Bytes: 14 Cardinality: 1
                                                                               16 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.ADDRESS_OBJINDEX Cost: 1 Cardinality: 1
                                                                     19 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.COUNTRY_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
                                                                21 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.CONTACT_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
                                                           23 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.CONDITION_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
                                                      26 TABLE ACCESS BY GLOBAL INDEX ROWID TABLE SA.TABLE_SITE_PART Cost: 1 Bytes: 14 Cardinality: 1 Partition #: 34
                                                           25 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.SITE_PART_OBJINDEX Cost: 1 Cardinality: 1
                                       bold           28 INDEX RANGE SCAN INDEX SA.IND_PART_INFO2PART_NUM Cost: 1 Bytes: 14 Cardinality: 1 bold
                                            30 INDEX UNIQUE SCAN INDEX (UNIQUE) SA.PART_NUM_OBJINDEX Cost: 1 Bytes: 7 Cardinality: 1
    Conclusion:
    IND_PART_INFO2PART_NUM is not in use in Production environment
    PROD
    1. SQL> select index_name,NUM_ROWS,CLUSTERING_FACTOR from dba_indexes where index_name='IND_PART_INFO2PART_NUM';
    INDEX_NAME NUM_ROWS CLUSTERING_FACTOR
    IND_PART_INFO2PART_NUM 103023 46488
    DEV environment
    SQL> select index_name,NUM_ROWS,CLUSTERING_FACTOR,table_name from dba_indexes where index_name='IND_PART_INFO2PART_NUM';
    INDEX_NAME NUM_ROWS CLUSTERING_FACTOR TABLE_NAME
    IND_PART_INFO2PART_NUM 101982 45722 TABLE_MOD_LEVEL
    1. Index is rebuild
    2. stats are up to date
    3. Redef on table is done.
    Still no change in the plan .

    Osama-mustafa wrote:
    Aman.... wrote:
    Osama-mustafa wrote:
    alter index <index-name> rebuild ;Why?
    Aman....I faced this issue with query and indexes was need rebuildWhat issue Osama-that query wasn't using index and after rebuild it did start using it? Not just that this reply is wrong , this is OP has mentioned that he has done already. Please note that index rebuild is not the answer when the query is not using the index. There can be many reasons behind it. Have a look at Richard Foote's blog where he explains all of this in a very detailed way and in many posts.
    Aman....

  • Qeury not using the bitmap index

    Hi,
    Pls have a look at the query below:
    SELECT
    A.flnumber,
    A.fldate,
    SUBSTR(C.sec,1,3) sect,
    D.element,
    C.class,
    SUM(C.qty) qty,
    A.indicator,
    DECODE(A.indicator, 'I', B.inrt, 'O', B.outrt, 'R', B.rting, NULL) direction,
    B.rting
    FROM
    Header A,
    Paths B,
    PathData C,
    ElementData D
    WHERE
    (D.category='N') AND
    (A.rt=B.rt) AND
    (C.element=D.element) AND
    (A.fldate=C.fldate AND
    A.flnumber=C.flnumber) AND
    C.element IN (SELECT codes FROM Master_codes WHERE type='F')
    GROUP BY A.flnumber,
         A.fldate,
         SUBSTR(C.sec, 1, 3),
         D.element,
         C.class,
         A.indicator,
         DECODE(A.indicator,'I', B.inrt, 'O', B.outrt,'R', B.rting, NULL),
    B.rting
    UNION ALL
    SELECT
    A.flnumber,
    A.fldate,
    SUBSTR(C.sec,1,3) sect,
    D.element,
    C.class,
    SUM(C.qty) qty,
    A.indicator,
    DECODE(A.indicator, 'I', B.inrt, 'O', B.outrt, 'R', B.rting, NULL) ROUTE_direction,
    B.rting
    FROM
    Header A,
    Paths B,
    PathData C,
    ElementData D
    WHERE
    (D.category='N') AND
    (A.rt=B.rt) AND
    (C.element=D.element) AND
    (A.fldate=C.fldate AND
    A.flnumber=C.flnumber) AND
    C.element NOT IN (SELECT codes FROM Master_codes WHERE type='F')
    GROUP BY A.flnumber,
         A.fldate,
         SUBSTR(C.sec, 1, 3),
         D.element,
         C.class,
         A.indicator,
         DECODE(A.indicator,'I', B.inrt, 'O', B.outrt,'R', B.rting, NULL),
    B.rting
    The cost in the explain plan is very high. The table PathData* has 42710366 records and there is a bitmap index on the flnumber_ and fldate* columns. But the query above does not use the indexes. The other tables in the list are fine as their respective PK and indexes are used but the table PathData* is going for a "Table Access by Local Index Rowid". dont know what it means but the cost for this is 7126 which is high. I cant figure out why is the query not using the bitmap indexes for this table.
    Pls let me know what should be done.???

    Thread: HOW TO: Post a SQL statement tuning request - template posting
    HOW TO: Post a SQL statement tuning request - template posting
    SELECT a.flnumber,
           a.fldate,
           Substr(c.sec, 1, 3)       sect,
           d.element,
           c.class,
           SUM(c.qty)                qty,
           a.INDICATOR,
           Decode(a.INDICATOR, 'I', b.inrt,
                               'O', b.outrt,
                               'R', b.rting,
                               NULL) direction,
           b.rting
    FROM   header a,
           paths b,
           pathdata c,
           elementdata d
    WHERE  ( d.category = 'N' )
           AND ( a.rt = b.rt )
           AND ( c.element = d.element )
           AND ( a.fldate = c.fldate
                 AND a.flnumber = c.flnumber )
           AND c.element IN (SELECT codes
                             FROM   master_codes
                             WHERE  TYPE = 'F')
    GROUP  BY a.flnumber,
              a.fldate,
              Substr(c.sec, 1, 3),
              d.element,
              c.class,
              a.INDICATOR,
              Decode(a.INDICATOR, 'I', b.inrt,
                                  'O', b.outrt,
                                  'R', b.rting,
                                  NULL),
              b.rting
    UNION ALL
    SELECT a.flnumber,
           a.fldate,
           Substr(c.sec, 1, 3)       sect,
           d.element,
           c.class,
           SUM(c.qty)                qty,
           a.INDICATOR,
           Decode(a.INDICATOR, 'I', b.inrt,
                               'O', b.outrt,
                               'R', b.rting,
                               NULL) route_direction,
           b.rting
    FROM   header a,
           paths b,
           pathdata c,
           elementdata d
    WHERE  ( d.category = 'N' )
           AND ( a.rt = b.rt )
           AND ( c.element = d.element )
           AND ( a.fldate = c.fldate
                 AND a.flnumber = c.flnumber )
           AND c.element NOT IN (SELECT codes
                                 FROM   master_codes
                                 WHERE  TYPE = 'F')
    GROUP  BY a.flnumber,
              a.fldate,
              Substr(c.sec, 1, 3),
              d.element,
              c.class,
              a.INDICATOR,
              Decode(a.INDICATOR, 'I', b.inrt,
                                  'O', b.outrt,
                                  'R', b.rting,
                                  NULL),
              b.rting  Edited by: sb92075 on Mar 13, 2011 7:58 AM

  • Why is Oracle not using the index??

    Hi,
    I have a table called 'arc_errors' which has an index on 'member_number' as follows:- Create/Recreate indexes
    create index DWO.DW_ARC_CERRORS_MNO on DWO.DW_ARC_CERRORS (MEMBER_NUMBER);
    But surpisingly, when I execute the following query, it does not use the index.
    SELECT member_number,
    COUNT(*) error_count
    FROM arc_errors a
    WHERE member_number = 68534152 AND
    ( tx_type = 'SDIC' AND
    error_number IN (4, 7, 12, 13, 15, 17, 18, 705) )
    OR
    ( tx_type = 'AUTH' AND
    error_number IN (100, 104, 107, 111, 116) )
    OR
    ( tx_type = 'BHO' AND
    error_number IN (708,710) )
    OR
    ( tx_type = 'XLGN' AND
    ( error_number BETWEEN 102 AND 105 OR
    error_number BETWEEN 107 AND 120 OR
    error_number BETWEEN 300 AND 304 ) )
    OR
    ( tx_type = 'None' AND
    ( error_number IN (20, 112) OR
    error_number BETWEEN 402 AND 421 ) )
    OR
    ( tx_type = 'HYBR' AND
    error_number IN (303, 304) )
    GROUP BY member_number;
    This is what 'explain plan' tell me
    SELECT STATEMENT, GOAL = RULE               237907     502923     15087690     
    SORT GROUP BY               237907     502923     15087690     
    PARTITION RANGE ALL                              
    TABLE ACCESS FULL     DWO     DW_ARC_CERRORS     237209     502923     15087690     
    Can someone tell me why a 'table acess full' is required here?
    Thanks in advance,
    Rajesh

    Sorry, I just found the solution myself. I need to put an extra pair of braces around the set of conditions seperated by OR.

  • Why does it not use the index?

    L.S.,
    We are using a table called IT_RFC_REGISTRATION. It is a relatively big table for our application.
    Its primary key is RFCNR, each new RFCNR getting the next value.
    Now for my intranet report I am interested in the last 40 records. But when I execute:
    SELECT *
    FROM IT_RFC_REGISTRATION
    ORDER BY RFCNR DESC
    the query takes ages to execute.
    When I do this:
    SELECT RFCNR
    FROM IT_RFC_REGISTRATION
    ORDER BY RFCNR DESC
    the result comes instantaneous because this query uses the index on RFCNR.
    Why does the former query not use the index to execute? It should be much faster to fetch ROWIDs from the index end to start and use those to get the records, than to load all the records and then sort them.
    Is there a trick with which I can use a join of the latter query and the former query to speed up the result?
    Greetings,
    Philbert de Zwart,
    Utrecht, The Netherlands.

    The difference you see in query run time is based on the amount data being sorted, then returned. In the first query, a full table scan is faster since if the index was used, Oracle would have to do a lookup in the index, get the rowid's and go look up the data in the table (TWO disk i/o's). It's faster to just scan the entire table.
    Indexes will generally not be used unless you have a where clause. If you only need a few fields from the table, you could include them all in an index. For instance, if you only need RFCNR & DESC create a concatenated index on those two columns and then only a scan of the index is required (very fast).

  • Why my select is not using the index

    This is my index
    CREATE INDEX CONFIG_STATE_IDX ON IDENTIFIER
    (CONFIGURATION_ID, STATE)
    LOGGING
    TABLESPACE NII_INDEX
    PCTFREE 10
    INITRANS 2
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 1
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    NOPARALLEL;
    This is my select statement:
    SELECT *
    FROM identifier i
    WHERE
         i.configuration_id = '89afead40a0c0b8d00628c59aa405ea4'
         AND i.state = 'QT'
    AND ROWNUM <6
    This is my exmplain plan result
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Hint=CHOOSE          5           2128                     
    COUNT STOPKEY                                        
    TABLE ACCESS FULL     IDENTIFIER     133 K     19 M     2128                     
    Why it is not using the index on configuration_id and state.

    Possibility one: you didn't do an analyze statistics on the table and/or the index after index creation.
    Possibility two: The optimizer has determined that it can return the query result set with fewer I/Os if it does a FTS vs using the index (the optimizer is very keen on I/Os).

  • Data Not loaded from  ap_invoice_lines_interface to the base table

    Hi ,
    Please I'm working on Interface which load invoices from Cobol system to oracle , anyway procedure is working on fine & all data is loaded to the interface as i'm inserting 4 attributes which is DFF on the invoice line level
    Now when i ran the import program all data is loaded to the base table except one of the attributes isnot loaded .
    will anyone tell me what is the reason or how can i trace that ..........
    Thanks In Advance

    Dear All ,,,,
    Please i got it's a matter of size of the attribute1 segment i increased it ,,,,,,,,,but now the issue that data is saved in the base table but not showing in the screen
    will you please help me in that
    Edited by: miro_feps on May 21, 2012 1:01 AM

  • My table of contents does not use the entry style I select for words in the paragraph that have character styles applied to them in the chapter, so some of the letters are showing up as green, which is fine in the chapter but not in the TOC.

    My table of contents does not use the entry style I select for words in the paragraph that have character styles applied to them in the chapter, so some of the letters, specifically parameters, are showing up green, which is fine in the chapter but not in the TOC. I can manually fix this in the TOC by changing the character style to none after the toc  has been generated, but I don't want to do this.

    What application are you running? Please ask this in the forum of the product you're using.

  • After i bought mac os x lion from web then download , after that to install but when they ask me to choose disk to install i can not choose, it say this disk does not use the GUID partiton table scheme. use disk utility to change the partition scheme. but

    after i bought mac os x lion from web then download , after that to install but when they ask me to choose disk to install i can not choose, it say this disk does not use the GUID partiton table scheme. use disk utility to change the partition scheme. but

    after i bought mac os x lion from web then download , after that to install but when they ask me to choose disk to install i can not choose, it say this disk does not use the GUID partiton table scheme. use disk utility to change the partition scheme. but

  • HT5225 "This disc does not use the GUID Partition Table Scheme...". I keep getting this message when I try to install OSXLion. It has something to do with a repair Apple performed last year. I use a 17" MacBookPro. Any suggestions?

    "This disc does not use the GUID Partition Table Scheme. Use Disc Utility to change the partition scheme". I keep getting this message when I try to install OSX Lion so that I can upgrade my 17" MacBookPro to move to iCloud. My harddrive was replaced last year by Apple because of a fault by the manufacturer and I think this is the cause of the problem. What can I do so that I don't lose my content.

    When you click the partion tab. There is option on the bottom of the window. Click on that there there are these options.

  • Index not using in select query

    Hello All,
    I have table CITY with 2 composite primary key CITYCODE, COUNTRYCODE of course they are NOT NULL.
    i created an index.
    CREATE UNIQUE INDEX CITYKEY ON CITY     (CITYCODE, COUNTRYCODE);
    then i run explain plan as follows
    explain plan for
    select CityCode, CityName, CountryCode, LexiconId, UserId, Status
    from City
    where CountryCode = 'IR';
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 803 | 57013 | 112 (2)| 00:00:02 |
    |* 1 | TABLE ACCESS FULL| CITY | 803 | 57013 | 112 (2)| 00:00:02 |
    later i analyze table rebuild indexes but again explain plan gives me the same result.
    Could any 1 please guide me to solve this issue.
    Thanks
    Edited by: mohsin javed on Feb 17, 2011 10:10 AM

    Hello All,
    Again with one more query which having join:
    table SDNMASTER with sdnid pk and SDNMASTER_PK index on SDNID, table SDNALIAS sdnid pk and SDNALIAS_PK index on SDNID.
    explain plan for
    SELECT a.SourceId,
              a.SourceName,
              b.LastName,
              a.Status
    FROM SdnMaster a,
              SdnAlias b
    WHERE a.SdnId = b.SdnId
    AND a.Status in ('1', '3')
    AND b.LastName is not null
    ORDER BY b.LastName;
    PLAN_TABLE_OUTPUT
    Plan hash value: 1153036645
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 2399 | 64773 | 69 (5)| 00:00:01 |
    | 1 | SORT ORDER BY | | 2399 | 64773 | 69 (5)| 00:00:01 |
    |* 2 | HASH JOIN | | 2399 | 64773 | 68 (3)| 00:00:01 |
    |* 3 | TABLE ACCESS FULL| SDNALIAS | 2399 | 21591 | 11 (0)| 00:00:01 |
    |* 4 | TABLE ACCESS FULL| SDNMASTER | 4562 | 82116 | 56 (2)| 00:00:01 |
    Even after analyzing table and rebuilding index its not using the index..
    Thanks

  • Data is not populate into base table

    Hi all,
    I am using Oracle EBS R12 and OS is WIN XP. I am working in PO module.The data is not populating into the base table after running the concurrent program.Instead,the interface error table is populated with the error.
    The error is :-- Bill to location id not valid
    Name of concurrent program:import Standard purchase order

    Pl identify which version of R12. Pl see if these MOS Docs can help
    Vision Demo - How To Import Standard Purchase Orders Using the Purchase Document Open Interface          (Doc ID 1054004.1)
    How To Diagnose Problems With Importing Standard Purchase Orders          (Doc ID 781351.1)
    HTH
    Srini

Maybe you are looking for

  • Can't connect to app store....

    just bought an Ipad and set it to start..... So i had to create an apple ID to be able to use appstore...but I can't get to do anything.....everytime I try to go on Itunes or appstore it ask me for my apple ID and pass word and every single time ther

  • Weblogic 5.1 SP9 problems with MAC OS 9 w/ MRJ 2.2.5 [InterruptedIOException]

    Hello all, We're having a problem with one of the beans running on our WebLogic server. A quick summary: The application is a standalone java application that interfaces with a Weblogic 5.1 SP9 running on a Solaris box. The clients are a mix of Windo

  • Usb key suddenly became read only

    Hi, my usb key used to work fine between OS X and Windows XP. Now after it was removed from XP without unmounting it, it's read only on OS X. It's formatted in MS-DOS FAT 16 and Disk Utility can't reformat it. Any suggestion is welcome!

  • LIKE VARIABLE

    Hello How can I use like operator with parameters in procedures? For example: p_project_name is my parameter and my query is select * from project where project_name like p_project_name hlp me please

  • Archivelogs are deleted on Primary side

    Hi, In oracle 10g and 11g version dataguard concept if archivelog files are deleted on primary side, before transferring to standby side, then what happens on the standby side. How we can recover this data on standby database side. Thank you!