Compund index vs simple index

I want to know the differece between a compund index and a simple one.
For example I have a compund index with three fileds: field1, field2, field3
index type 1:
create index index1 on table1 (field1, field2, field3);
What happen if I change this compund index for a simple one?, something like this:
index type 2:
create index index1 on table1 (field1);
create index index2 on table1 (field2);
create index index3 on table1 (field3);
I think that index type 2 (simples one) takes more space than index type 1, isn't it???
I think index type 1 is more effective in a sql with all the indexed fields in the where, something like that: select * from table1 where field1 = ' ' and field2 = ' ' and field3 = ' ', but in any other sql is more effective index type 2 , isn't it???
is that true??, any other difference?
Any advice or design criteria about indexes (compund or simple) will be greatly appreciatted.
Thanks in advance

In my opinion most important thing between two is first has one index and the other has three :) Indexes result more I/O activity on update, insert and delete operations on the related table. So they need to be choosen carefully if you are creating them over heavily loaded oltp tables.
Also according to your query's where clause first index will be more selective, effective but this needs to be tested.

Similar Messages

  • Strange behavior when using servlet filter with simple index.htm

    I am new to J2EE development so please tolerate my ignorance. I have a web application that starts with a simple index.htm file. I am using a servlet filter throughout the website to check for session timeout, redirecting the user to a session expiration page if the session has timed out. When I do something as simple as loading the index.htm page in the browser, the .css file and one image file that are associated, or referenced in the file are somehow corrupted and not being rendered. How do I get the filter to ignore css and image files??? Thank you!!
    The servlet filter:
    import java.io.IOException;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class SessionTimeoutFilter implements Filter {
         String[] excludedPages = {"SessionExpired.jsp","index.htm","index.jsp"};
         String timeoutPage = "SessionExpired.jsp";
         public void destroy() {
         public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
              if ((request instanceof HttpServletRequest) && (response instanceof HttpServletResponse)) {
                   HttpServletRequest httpServletRequest = (HttpServletRequest) request;
                   HttpServletResponse httpServletResponse = (HttpServletResponse) response;
                   //httpServletResponse.setHeader("Cache-Control","no-cache");
                   //httpServletResponse.setHeader("Pragma","no-cache");
                   //httpServletResponse.setDateHeader ("Expires", 0);
                   String requestPath = httpServletRequest.getRequestURI();
                   boolean sessionInvalid = httpServletRequest.getSession().getAttribute("loginFlag") != "loggedIn";               
                   System.out.println(sessionInvalid);
                   boolean requestExcluded = false;
                   System.out.println(requestExcluded);
                   for (int i=0;i<excludedPages.length;i++){
                        if(requestPath.contains(excludedPages)){
                             requestExcluded = true;
                   if (sessionInvalid && !requestExcluded){
                        System.out.println("redirecting");
                        httpServletResponse.sendRedirect(timeoutPage);
              // pass the request along the filter chain
              chain.doFilter(request, response);
         public void init(FilterConfig arg0) throws ServletException {
              //System.out.println(arg0.getInitParameter("test-param"));
    The index.htm file (or the relevant portion)<HTML>
    <Head>
    <META http-equiv="Content-Style-Type" content="text/css">
    <LINK href="RTEStyleSheet.css" rel="stylesheet" type="text/css">
    <TITLE>Login</TITLE>
    </HEAD>
    <BODY>
    <FORM NAME="Login" METHOD="POST" ACTION="rte.ServletLDAP"><!-- Branding information -->
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
         <tr>
              <td width="30%" align="left"><img src="images/top_logo_new2.gif">
              </td>
              <td width="37%" align="center"></td>
              <td width="33%" align="right"></td>
         </tr>
    </table>
    My web.xml entry for the filter:     <filter>
              <description>
              Checks for a session timeout on each user request, redirects to logout if the session has expired.</description>
              <display-name>
              SessionTimeoutFilter</display-name>
              <filter-name>SessionTimeoutFilter</filter-name>
              <filter-class>SessionTimeoutFilter</filter-class>
              <init-param>
                   <param-name>test-param</param-name>
                   <param-value>this is a test parameter</param-value>
              </init-param>
         </filter>
         <filter-mapping>
              <filter-name>SessionTimeoutFilter</filter-name>
              <url-pattern>/*</url-pattern>
              <dispatcher>REQUEST</dispatcher>
              <dispatcher>FORWARD</dispatcher>
         </filter-mapping>

    Hi,
    Try adding CSS files and images to the excluded Pages.

  • Simple Select on VBPA using index running very slow

    Hello,
    We have a very simple selection on the table VBPA:
    data:
    begin of it_vbeln occurs 100,
      vbeln like vbpa-vbeln,
    end of it_vbeln.
    select vbeln from vbpa
    into table it_vbeln
    where
    kunnr = '##########'
    and parvw = 'AG'.
    All we're trying to accomplish is to find orders for a given customer number and type.
    We have two indices "Z1" and "Z2" which respectively declare: KUNNR, and MANDT, KUNNR, PARVW.
    In looking at a sql trace, it says it's using the VBPA~Z2 index, which is expected, and that its estimated costs are very low on the index:
    SELECT STATEMENT ( Estimated Costs = 71 , Estimated #Rows = 63 )
           2 TABLE ACCESS BY INDEX ROWID VBPA
             ( Estim. Costs = 71 , Estim. #Rows = 63 )
             Estim. CPU-Costs = 553,782 Estim. IO-Costs = 71
               1 INDEX RANGE SCAN VBPA~Z2
                 ( Estim. Costs = 3 , Estim. #Rows = 111 )
                 Search Columns: 3
                 Estim. CPU-Costs = 43,764 Estim. IO-Costs = 3
    Despite declaring that it will do an index range scan, in SM51 it shows as Sequential Read (Table Scan?) and takes a VERY long time to return, about 60 - 120 seconds.
    Since this is needed for a user exit that will be run during order creation, it needs to occur MUCH faster. Our entries in VBPA number above 10 million records currently.
    Can anyone suggest either why the index does not appear to be helping (it takes just as long without the index), or perhaps another method for finding the orders for a given customer number.
    Thank you,
    Randy

    Hi Randy,
    I suggest you skip the attempts to speed up selecting on VBPA, but rather look into using table VAKPA for finding sales documents for a given partner number.
    Greetings
    Thomas

  • Simple SQL Query is not using Bitmap index

    Hello to All,
    We are having Oracle9i Database and using it for the datawarehouse purpose.
    I have created the bitmap index on calledinfo column and I am running the following simple query which takes serveral hours to complete:
    select * from ssp.ssp_2006_q4 where calledinfo='799992515f'
    OR
    select calledinfo from ssp.ssp_2006_q4 where calledinfo='799992515f'
    I don't know why it is not using the bitmap index: Can anybody help me here?
    Thanks in Advance
    Hashim

    I know why and everyone that has read Jonathan Lewis' book on the CBO knows why.
    Why? Because the CBO thinks the cost of using your index will be higher than the cost of ignoring it.
    To see what Oracle is thinking run an explain plan using DBMS_XPLAN for create the output and then rerun it with a hint forcing index usage.
    It is a mistake to believe that an index will always make things better. Issues of cardinality, clustering factor, etc. are very important.
    Post the explain plans if you have any questions about what they show:
    http://www.psoug.org/reference/explain_plan.html

  • [svn:fx-trunk] 11641: A simple fix - we need to keep track of the display list index for non-clipping masks such as luminosity masks , not just alpha masks.

    Revision: 11641
    Author:   [email protected]
    Date:     2009-11-10 18:29:57 -0800 (Tue, 10 Nov 2009)
    Log Message:
    A simple fix - we need to keep track of the display list index for non-clipping masks such as luminosity masks, not just alpha masks.
    QE notes: Please include tests for multiple graphic content nodes with masks under a .
    Doc notes: N/A
    Bugs:
    SDK-24133 - Multiple non-Group maskees don't work when using maskType="luminosity"
    Reviewer: Deepa
    Tests run: Checkintests, Bug test case
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-24133
    Modified Paths:
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/fxg/FlexFXG2SWFTranscoder.java

    Revision: 11641
    Author:   [email protected]
    Date:     2009-11-10 18:29:57 -0800 (Tue, 10 Nov 2009)
    Log Message:
    A simple fix - we need to keep track of the display list index for non-clipping masks such as luminosity masks, not just alpha masks.
    QE notes: Please include tests for multiple graphic content nodes with masks under a .
    Doc notes: N/A
    Bugs:
    SDK-24133 - Multiple non-Group maskees don't work when using maskType="luminosity"
    Reviewer: Deepa
    Tests run: Checkintests, Bug test case
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-24133
    Modified Paths:
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/fxg/FlexFXG2SWFTranscoder.java

  • Index not used in a simple query

    Hi all,
    I have a query which is using only 2 tables linked with an indexed column, i'm surprised that the 2 tables are not using index and they are full scanned. here is some details:
    Table a: T1 (col11 number, col12 varchar2) indexed on col11 (primary key): rows number=4 millions indexe: idx1 on col11
    Table b: T2 (col21 number, col22 varchar2) indexed on col21 (primary key): rows number=3 millions indexe: idx2 on col21
    select a.col12, b.col22 from T1 a, T2 b where a.col11=b.col21
    The execution plan is:
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=ALL_ROWS          3 M           32356                                          
      PX COORDINATOR                                                                
        PX SEND QC (RANDOM)     SYS.:TQ10002     3 M     67 M     32356       :Q1002      P->S       QC (RANDOM)      
          HASH JOIN          3 M     67 M     32356       :Q1002      PCWP                        
            PX RECEIVE          3 M     20 M     7376       :Q1002      PCWP                        
              PX SEND HASH     SYS.:TQ10001     3 M     20 M     7376       :Q1001      P->P       HASH             
                PX BLOCK ITERATOR          3 M     20 M     7376       :Q1001      PCWC                        
                  TABLE ACCESS FULL     T2     3 M     20 M     7376       :Q1001      PCWP                        
            BUFFER SORT                             :Q1002      PCWC                        
              PX RECEIVE          3 M     44 M     24708       :Q1002      PCWP                        
                PX SEND HASH     SYS.:TQ10000     3 M     44 M     24708              S->P       HASH             
                  TABLE ACCESS FULL     T1     3 M     44 M     24708                                           Thanks

    Hi Herald,
    Thanks for your reply
    when selecting only the columns which are indexed, it is using the index
    select a.account_link_code_n, b.account_link_code_n from gsm_sims_master a, gsm_service_mast b
    where a.account_link_code_n=b.account_link_code_n
    See the execution below:
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=ALL_ROWS          3 M           11051                                          
      PX COORDINATOR                                                                
        PX SEND QC (RANDOM)     SYS.:TQ10002     3 M     44 M     11051       :Q1002      P->S       QC (RANDOM)      
          HASH JOIN          3 M     44 M     11051       :Q1002      PCWP                        
            PX RECEIVE          3 M     20 M     7376       :Q1002      PCWP                        
              PX SEND HASH     SYS.:TQ10001     3 M     20 M     7376       :Q1001      P->P       HASH             
                PX BLOCK ITERATOR          3 M     20 M     7376       :Q1001      PCWC                        
                  TABLE ACCESS FULL     GSM_SERVICE_MAST     3 M     20 M     7376       :Q1001      PCWP                        
            BUFFER SORT                             :Q1002      PCWC                        
              PX RECEIVE          3 M     22 M     3403       :Q1002      PCWP                        
                PX SEND HASH     SYS.:TQ10000     3 M     22 M     3403              S->P       HASH             
                  INDEX FAST FULL SCAN     ABILLITY.SIM_ACC_LNK_CD_IDX     3 M     22 M     3403                                                     But using hints has a very bad execution plan and a very high cost:
    select /*+ index(a) index(b) */ a.account_link_code_n, b.account_link_code_n from gsm_sims_master a, gsm_service_mast b
    where a.account_link_code_n=b.account_link_code_n
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=ALL_ROWS          3 M           31899                                          
      HASH JOIN          3 M     44 M     31899                                          
        INDEX FULL SCAN     ABILLITY.GSM_SERV_MAST#ACLINK_CODE$PK     3 M     20 M     8158                                          
        INDEX FULL SCAN     ABILLITY.SIM_ACC_LNK_CD_IDX     3 M     22 M     15709                                           Thank you
    Luc

  • Index not usable in my simple query

    Hi,
    I have created index for INC_ID coloumn but when I use it in queries, it is not working. Verified the index it is on valid stat only, eventhough its not using in queries.
    can you please suggest why it is not using. what I have to do for this. I am going to use this query in procedures. My DBA will not allow to use hints in queries.
    Thanks in advance
    select * from TAB_FLNDAT t where t.INC_ID = 2055Explain plan
    SELECT STATEMENT, GOAL = ALL_ROWS               339682     19174     7631252
    TABLE ACCESS FULL     AIMS_OWNR     ONT_T_FLNDATASTATUS_AGNT     339682     19174     7631252Total no of records in TAB_FLNDAT table -- 21427155
    Table DDL
    -- Create table
    create table TAB_FLNDAT
      INC_ID                VARCHAR2(25),
      INC_PERIOD            NUMBER,
      AREA_DEF_ID           NUMBER,
      DEAL_CODE             VARCHAR2(50),
      FLNMTH                DATE,
      DOCNUM                NUMBER(10),
      CPNNUM                NUMBER(3),
      CTRY_ISO_CODE         VARCHAR2(2),
      FLNLOCCOD             VARCHAR2(7),
      FLNCTYCOD             VARCHAR2(3),
      FLNDATAKEY            NUMBER,
      MAIN_CLASS            VARCHAR2(17),
      BOKCLSCOD             VARCHAR2(1),
      ORIGIN                VARCHAR2(6),
      DESTINATION           VARCHAR2(3),
      FINAL_ST          NUMBER(1),
      SALE_ST           NUMBER(1),
      AGENT_ST          NUMBER(1),
      EKOAL_ST          NUMBER(1),
      FARE_ST           NUMBER(1),
      PAPERTKT_ST       NUMBER(1),
      OND_ST            NUMBER(1),
      RBD_ST            NUMBER(1),
      FLIGHT_ST         NUMBER(1),
      FBC_ST            NUMBER(1),
      DEAL_ST           NUMBER(1),
      DEAL_ST_CODE      VARCHAR2(50),
      ONDRBD_ST         NUMBER(1),
      DATE_ST           NUMBER(1),
      CODESHARE_ST      NUMBER(1),
      HPMCO_ST          NUMBER(1),
      CTRY_ST           NUMBER(1),
      LC_REVENUE            NUMBER(18,3),
      CURCOD                VARCHAR2(3),
      LC_NET_NET            NUMBER(21,3),
      REPORTING_CURRENCY    VARCHAR2(3),
      CARDSGCOD             VARCHAR2(2),
      CARNUMCOD             VARCHAR2(3),
      DOCTYP                VARCHAR2(3),
      FLNDAT                DATE,
      FLTNUM                VARCHAR2(4),
      FLNSEC                VARCHAR2(6),
      FLNITN                VARCHAR2(200),
      SALMTH                DATE,
      SALCTYCOD             VARCHAR2(3),
      SALLOCCOD             VARCHAR2(10),
      FABCOD                VARCHAR2(50),
      IATA_FABCOD           VARCHAR2(50),
      TOTPAX                NUMBER(9),
      CPNCNT                NUMBER(6),
      PAXCNT                NUMBER(6),
      CBKGRSAMT             NUMBER(15,3),
      CBKNETAMT             NUMBER(15,3),
      CBKCOMAMT             NUMBER(15,3),
      CBKORCAMT             NUMBER(15,3),
      COSGRSAMT             NUMBER(15,3),
      COSNETAMT             NUMBER(15,3),
      COSCOMAMT             NUMBER(15,3),
      COSORCAMT             NUMBER(15,3),
      COUCOD                VARCHAR2(7),
      TOUCOD                VARCHAR2(20),
      OLD_DOCNUM            NUMBER(10),
      ON_OFFLINE            CHAR(1),
      ENTFABCOD             VARCHAR2(50),
      EKOALIND              CHAR(1),
      ONL_INTL_INDICATOR    VARCHAR2(1),
      FULL_ITINERARY        VARCHAR2(500),
      RPD_COSGRSAMT         NUMBER(15,3),
      RPD_COSNETAMT         NUMBER(15,3),
      RPD_COSCOMAMT         NUMBER(15,3),
      RPD_COSORCAMT         NUMBER(15,3),
      SALDAT                DATE,
      REPENDDAT             DATE,
      ETKIND                VARCHAR2(1),
      MKTFLTNUM             VARCHAR2(8),
      CODSHRIND             VARCHAR2(1),
      FARE_TYPE             VARCHAR2(50),
      CMM_CUSTOMER_ID       VARCHAR2(25),
      OPERATING_COST        NUMBER(18,3),
      ACM_AMOUNT            NUMBER(18,3),
      GDS_COST              NUMBER(18,3),
      OCCURRENCE            NUMBER(3),
      PROCESS_MONTH         DATE,
      ONTRACK_FBC           VARCHAR2(100),
      EKHMCOIND             CHAR(1),
      RPT_FLNITN            VARCHAR2(200),
      CORPORATE_ID          VARCHAR2(25),
      CORP_DEAL_CODE        VARCHAR2(50),
      OSI_DATA              VARCHAR2(100),
      PAX_NAME              VARCHAR2(1000),
      PAX_TYPE              VARCHAR2(1),
      BOOKING_DATE          DATE,
      SKYWARDS_NO           VARCHAR2(11),
      PROCESSED             CHAR(1),
      FLTFULROU             VARCHAR2(30),
      FLTROUFLNLEG          VARCHAR2(30),
      FLNACFTYP             VARCHAR2(10),
      SEQNO                 NUMBER(3),
      FORM_OF_PAYMENT       VARCHAR2(9),
      TRPTYP                VARCHAR2(1),
      FOPDTL                VARCHAR2(300),
      PNR_ID                NUMBER(15),
      VALUE_ADDED_COST      NUMBER(18,3),
      LINK_OD               VARCHAR2(45),
      TEMP                  VARCHAR2(50),
      ONT_FBC_TEMP          VARCHAR2(100),
      ONT_FBC_TYPE_TEMP     VARCHAR2(20),
      ONT_FBC_ST_TEMP   NUMBER(1),
      INC_FINAL_ST_TEMP NUMBER(1),
      TEMP_FLAG             VARCHAR2(1),
      MODIFIED              CHAR(1),
      MATCH_FLAG            CHAR(2)
    tablespace A_DAT
      pctfree 10
      initrans 1
      maxtrans 255
      storage
        initial 64K
        next 1M
        minextents 1
        maxextents unlimited
    -- Create/Recreate indexes
    create index IND_FLNST_AGNT_DOC on TAB_FLNDAT (DOCNUM)
      tablespace A_IDX
      pctfree 10
      initrans 2
      maxtrans 255
      storage
        initial 64K
        next 1M
        minextents 1
        maxextents unlimited
    create index IND_FLNST_AGNT_FLNMTH on TAB_FLNDAT (FLNMTH)
      tablespace A_IDX
      pctfree 10
      initrans 2
      maxtrans 255
      storage
        initial 64K
        next 1M
        minextents 1
        maxextents unlimited
    create bitmap index IND_FLNST_AREDEF on TAB_FLNDAT (AREA_DEF_ID)
      tablespace A_IDX
      pctfree 10
      initrans 2
      maxtrans 255
      storage
        initial 64K
        next 1M
        minextents 1
        maxextents unlimited
    create index IND_FLNST_FLNDATAKEY on TAB_FLNDAT (FLNDATAKEY)
      tablespace A_IDX
      pctfree 10
      initrans 2
      maxtrans 255
      storage
        initial 64K
        next 1M
        minextents 1
        maxextents unlimited
    create bitmap index IND_FLNST_INCPERIOD on TAB_FLNDAT (INC_PERIOD)
      tablespace A_IDX
      pctfree 10
      initrans 2
      maxtrans 255
      storage
        initial 64K
        next 1M
        minextents 1
        maxextents unlimited
    create index IND_FLNST_INC_ID on TAB_FLNDAT (INC_ID)
      tablespace A_IDX
      pctfree 10
      initrans 2
      maxtrans 255
      storage
        initial 64K
        next 1M
        minextents 1
        maxextents unlimited
      );Edited by: venkatraman.L on Mar 18, 2012 12:51 PM
    Edited by: venkatraman.L on Mar 18, 2012 12:52 PM

    venkatraman.L wrote:
    yes if I use Quotes it is using index. It should be a numeric field.
    Thanks Etbin. I was a little surprised by that. i thought oracle will always implicitly convert to the type of the column. But that happens only for insert/updates.
    From the docs (http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements002.htm):
    The following rules govern the direction in which Oracle Database makes implicit datatype conversions:
    <li>During INSERT and UPDATE operations, Oracle converts the value to the datatype of the affected column.
    <li>During SELECT FROM operations, Oracle converts the data from the column to the type of the target variable.
    <li>When manipulating numeric values, Oracle usually adjusts precision and scale to allow for maximum capacity. In such cases, the numeric datatype resulting from such operations can differ from the numeric datatype found in the underlying tables.
    <li>When comparing a character value with a numeric value, Oracle converts the character data to a numeric value.
    <li>Conversions between character values or NUMBER values and floating-point number values can be inexact, because the character types and NUMBER use decimal precision to represent the numeric value, and the floating-point numbers use binary precision.
    Rule 4 is what happened in your case.

  • Simple index (How to view data(all columns) of an index in toad)

    Hi All,
    I am training myself on sql tuning and over the years I have seen ppl creating many indexes, today I am trying to learn various types of indexes and just curious to see physical data in an index but I am not able to do so on toad, I know if I have some index def like:
    create index employees_employee_id on employees(employee_id)
    my index would have two columns of information : first rowid and employee_ids in sorted order, right ? <- if my understanding is not right could any1 please correct me here.
    PS: The major problem is to see physical index data in toad, please help me with it.
    Many thanks
    Rahul

    There is no SELECT query that could be written over an index. But a SELECT query on a TABLE can be in such a way that Oracle only scans the index and give you the information
    Here is an example.
    SQL> create table t
      2  (
      3    no integer
      4  );
    Table created.
    SQL> create index t_idx on t(no);
    Index created.
    SQL> insert into t       
      2  select level
      3    from dual connect by level <= 10;
    10 rows created.
    SQL> commit;
    Commit complete.
    SQL> alter table t modify no not null;
    Table altered.
    SQL> exec dbms_stats.gather_table_stats(user, 'T', cascade=>true)
    PL/SQL procedure successfully completed.
    SQL> select rowid, no from t;
    ROWID                      NO
    AAFrZaABMAAAiKKAAA          1
    AAFrZaABMAAAiKKAAB          2
    AAFrZaABMAAAiKKAAC          3
    AAFrZaABMAAAiKKAAD          4
    AAFrZaABMAAAiKKAAE          5
    AAFrZaABMAAAiKKAAF          6
    AAFrZaABMAAAiKKAAG          7
    AAFrZaABMAAAiKKAAH          8
    AAFrZaABMAAAiKKAAI          9
    AAFrZaABMAAAiKKAAJ         10
    10 rows selected.
    SQL> select * from table(dbms_xplan.display_cursor);
    PLAN_TABLE_OUTPUT
    SQL_ID  35mwb1b3fpfrh, child number 0
    select rowid, no from t
    Plan hash value: 3354442786
    | Id  | Operation        | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT |       |       |       |     1 (100)|          |
    |   1 |  INDEX FULL SCAN | T_IDX |    10 |    30 |     1   (0)| 00:00:01 |
    13 rows selected.
    Actually in this case i have queried the INDEX

  • Simple query but not using index..please help??

    I do have this column indexed. Why my query is not using this index?
    Any help .
    select count(*) from v_dis_sub_har;
    SQL>
      COUNT(*)
       4543289
    1 row selected.
    SQL>
    select vzw_vendor_id , count(*)
    from v_dis_sub_har
    group by vzw_vendor_id
    SQL>   2    3    4 
    VZW_VENDOR_ID   COUNT(*)
           200091     908653
           200013     908659
           200012     908659
           200057     908659
           200031     908659
    5 rows selected.
    SQL> SQL>
    explain plan for
    select
    event_seq
    from v_dis_sub_har b 
    where b.VZW_VENDOR_ID='200013'
    -- and b.status='P' and b.extract_date is null
    SQL>   2    3    4    5    6    7 
    Explained.
    SQL> SQL>
    select plan_table_output from table(dbms_xplan.display)
    SQL> SQL>   2 
    PLAN_TABLE_OUTPUT
    Plan hash value: 2852398983
    | Id  | Operation         | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |               |   908K|  7986K|  3132  (16)| 00:00:38 |
    |*  1 |  TABLE ACCESS FULL| V_DIS_SUB_HAR |   908K|  7986K|  3132  (16)| 00:00:38 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       1 - filter("B"."VZW_VENDOR_ID"=200013)
    13 rows selected.
    SQL> SQL>

    You are right Justin. Oracle is not stupid as you may want to say some times when things do not happen according to you. I just created a bitmap index on status field and look what appened. Som times it uses bitmap index and some times it does not. And the reason is clear. Row count by status. 'S' status uses bitmap index where 'P' does not.
    Thanks for your help.
    select   status, count(*)
    from v_dis_sub_har
    group  by status
    ;SQL>   2    3    4 
    S   COUNT(*)
    A    5844982
    P    2312759
    S      20178
    3 rows selected.
    SQL>
    explain plan for
    select
    event_seq
    from v_dis_sub_har b 
    where
    --b.VZW_VENDOR_ID=200013
    --  and
    b.status='S'
    --and b.extract_date is null
    select plan_table_output from table(dbms_xplan.display)
    SQL>   2    3    4    5    6    7    8    9   10 
    Explained.
    SQL> SQL> SQL> SQL>   2 
    PLAN_TABLE_OUTPUT
    Plan hash value: 829738689
    | Id  | Operation                    | Name                         | Rows  | Bytes | Cost (%CPU)| T
    ime     |
    PLAN_TABLE_OUTPUT
    |   0 | SELECT STATEMENT             |                              | 20290 |   118K|  2772   (1)| 0
    0:00:34 |
    |   1 |  TABLE ACCESS BY INDEX ROWID | V_DIS_SUB_HAR                | 20290 |   118K|  2772   (1)| 0
    0:00:34 |
    |   2 |   BITMAP CONVERSION TO ROWIDS|                              |       |       |            |
            |
    |*  3 |    BITMAP INDEX SINGLE VALUE | V_DISPATCH_SUBSCRIPTION_NDX2 |       |       |            |
            |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       3 - access("B"."STATUS"='S')
    15 rows selected.
    SQL> SQL> set line 120
    SQL> /
    PLAN_TABLE_OUTPUT
    Plan hash value: 829738689
    | Id  | Operation                    | Name                         | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |                              | 20290 |   118K|  2772   (1)| 00:00:34 |
    |   1 |  TABLE ACCESS BY INDEX ROWID | V_DIS_SUB_HAR                | 20290 |   118K|  2772   (1)| 00:00:34 |
    |   2 |   BITMAP CONVERSION TO ROWIDS|                              |       |       |            |          |
    |*  3 |    BITMAP INDEX SINGLE VALUE | V_DISPATCH_SUBSCRIPTION_NDX2 |       |       |            |          |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       3 - access("B"."STATUS"='S')
    15 rows selected.
    SQL>
    explain plan for
    select
    event_seq
    from v_dis_sub_har b 
    where
    --b.VZW_VENDOR_ID=200013
    --  and
    b.status='P'
    --and b.extract_date is null
    select plan_table_output from table(dbms_xplan.display)
          SQL>   2    3    4    5    6    7    8    9   10 
    Explained.
    SQL> SQL> SQL> SQL>   2 
    PLAN_TABLE_OUTPUT
    Plan hash value: 2852398983
    | Id  | Operation         | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |               |  2325K|    13M|  5784  (18)| 00:01:10 |
    |*  1 |  TABLE ACCESS FULL| V_DIS_SUB_HAR |  2325K|    13M|  5784  (18)| 00:01:10 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       1 - filter("B"."STATUS"='P')
    13 rows selected.
    SQL>

  • A simple question about Indexes

    For what kind of tables are Indexes inappropriate? Is it for an INSERT-intensive or UPDATE-intensive table?

    Almost every table requires some set of indexes... I suppose it would be inappropriate to create an index on a table you only inserted into, never read from, never updated, and never deleted from. I can't imagine the utility, however, of this sort of write-only table.
    Maintaining indexes adds some overhead to INSERT transactions and may or may not improve the performance of UPDATEs (depending on whether the index helps you find the row to update more efficiently or whether it just requires maintenance after the update happens). Similarly, it may or may not slow down DELETE operations. Indexes are generally designed, though, to improve query performance.
    Justin

  • Simple z-index layering problem

    I'm trying to overlay some text on top of an image. The
    stacking order seems to work, but I can't position my text where I
    want it–in the white box on the graphic below. It may be a
    problem with my positioning attribute, but I'm not sure which one
    to use (absolute, relative, inherit etc...) I've tried them all,
    and none seem to work. Anyone have any suggestions?
    And why does the positioning look fine in the design view in
    Dreamweaver?
    http://www.theeficlub.com/test/EFI_about_the_author.html
    Thanks

    Auggh, just figured it out.  The Polaroid needed to be relative positioning!

  • Problem during creation of index

    Dear All,
          I want to create index for MSEG table. This index i have created and activated also. I have used index fields as MJAHR,AUFNR and BWART. Same i have written in select query in where condition. But i think it is not working because select query takes same time as before created index during run time.
    One warning message is coming in index like.
    "Index does not exist in database system MSSQL"
    I don't know why it is coming. I have create simple index and also extension index. In both case same warning message is coming. when i have to create index and extension index.?
    Please give me any solution.
    Regards,
    Shivam.

    Hello,
    I suppose you have created the index via transaction SE11.
    When the database table is too big and you generate/activate the index via SE11 the index will only be created in the SAP repository not in the database (this should be in the log of SE11).
    You have now to start transaction SE14, select your index there (you will see that it does not exist in the DB) and create the index via transaction SE14 (preferably in background to prevent a possible time out).
    Success.
    Wim Van den Wyngaert

  • HT4759 I have never used  "iwork for cloud beta" or "google chrome" to my knowledge to print. I wish icloud to please and thank you for you to delete this information! as it shows in the advanced settings for icloud when I was trying to print an index of

    My note on my ipad and Iphone have an index of the notes to the left on my copnuter!  I wanted to only print the index and the date after the index.  The computer would allow me to print the note but not the date it was indexed or the title to the left! of the index date!  Has anyone ever had this problem!  I am changing laptops and wanted to keep an index printed out for references but delete all the notes from this old notebook! 
    Please note my Ipad automatically changed to the ios7 update even when the Iphone 5 was with my spouse in Norfolk Va.  I had purchased an iphone 5 in feb with 32 gb verses 16 I was happy with it until I thought I was updating itunes to fix bugs and fixes.  It updated the ios7 program and the whole look of the iphone five changed and I am over 58 and have trouble keeping up and did not want to update!  I callled and had 436 days of insurance left on my phone and I asked them to keep te money for the upgrade and just give me back the 6ios. of course it is know.  Apple was trying to helpe get up to speed but the calendar was given me the most difficulty not being able to see appts forward enough to plan very well!  My spouse is retiring from the DOD  and for the first time in his life can have his on cell so I gave him my 5 and still had my old 4 got my ios6 back and  just now the phone is feeling pretty comfortable again for me. The only thing missing is siri i do miss her!  I never anticipated that my ipad would change to the ios7 on its on but the applestore in Tampa said that yes that happens oops! I now will try to self educate myself on the ios7.  I love my ipad but wish it had not jumped to the 7ios.  big problem again is I have is on my 5 it wasa a 32 and I have double or the max of icloud storage but just learned at the apple store that icloud does not store your photos on the cloud.  I am a grandmother and the soul pupose of me purchasing so much icloud storage was for my grandkids pics and now I found out you guys don't do this.  Where do you store the photos for people?   Help!  have mercy on me because even though the 436 days of service from Icloud left on my iphone 5 my spouse is the only one that can use it even tho my ipad automatically switched to the ios 7.  Really am trying to work with you apple because I think you have a better product but as far as customer service you can make an appt at the service center an hour away and then wait inline for 40 minutes for the genuis bar guys to make you feel like an idiot for not figuring this out on your own or I have to pay just to talk to your service department after I already have in my name 436 days left on my service contract!  The contract only goes with the phone even though your update changed my ipad also!  A little customer service that is given free of charge when you have some one really trying to educate themselves on and ios7 that they didn't even want would go a very long way toward keeping your customers happy otherwise once a more friendly tech company that offers the better product tops you. Its over!  You have a great product and people are paying you to help them lean how to navigate it!  The problem is once you have mastered one system that system is updated and you start over!  Maybe you could offe something for everyone!  You see my husband doesn't have to ever call apple because he has and IQ to high to measure!   Unfortunately the service I payed for is with his phone and I now have and I pad with the ios7 that converted automatically and when I call they tell me I must be told there will be a fee charged for this service!   One question I asked the support center apple store is how can the ipad convert when the iphone 5 is at the Norfolk Navy Base with my spouse and the ipad is here in Spring Hill Florida with me.  She said it just happens!  The service center nearest available to me is 1 hour away and I need an appt. With them to ask a simple question!.  Time is a commodity that is becoming more dear to me every day and it seems I am spending a great deal of it trying to solve a somewhat simple question to the experts no more than a 3 minute conversation could set me on the right track but I can't even buy insurance service for my ipad that just converted to ios 7 on its's own!  Sincerely I could use some help
    <E-mail Edited by Host>

    My note on my ipad and Iphone have an index of the notes to the left on my copnuter!  I wanted to only print the index and the date after the index.  The computer would allow me to print the note but not the date it was indexed or the title to the left! of the index date!  Has anyone ever had this problem!  I am changing laptops and wanted to keep an index printed out for references but delete all the notes from this old notebook! 
    Please note my Ipad automatically changed to the ios7 update even when the Iphone 5 was with my spouse in Norfolk Va.  I had purchased an iphone 5 in feb with 32 gb verses 16 I was happy with it until I thought I was updating itunes to fix bugs and fixes.  It updated the ios7 program and the whole look of the iphone five changed and I am over 58 and have trouble keeping up and did not want to update!  I callled and had 436 days of insurance left on my phone and I asked them to keep te money for the upgrade and just give me back the 6ios. of course it is know.  Apple was trying to helpe get up to speed but the calendar was given me the most difficulty not being able to see appts forward enough to plan very well!  My spouse is retiring from the DOD  and for the first time in his life can have his on cell so I gave him my 5 and still had my old 4 got my ios6 back and  just now the phone is feeling pretty comfortable again for me. The only thing missing is siri i do miss her!  I never anticipated that my ipad would change to the ios7 on its on but the applestore in Tampa said that yes that happens oops! I now will try to self educate myself on the ios7.  I love my ipad but wish it had not jumped to the 7ios.  big problem again is I have is on my 5 it wasa a 32 and I have double or the max of icloud storage but just learned at the apple store that icloud does not store your photos on the cloud.  I am a grandmother and the soul pupose of me purchasing so much icloud storage was for my grandkids pics and now I found out you guys don't do this.  Where do you store the photos for people?   Help!  have mercy on me because even though the 436 days of service from Icloud left on my iphone 5 my spouse is the only one that can use it even tho my ipad automatically switched to the ios 7.  Really am trying to work with you apple because I think you have a better product but as far as customer service you can make an appt at the service center an hour away and then wait inline for 40 minutes for the genuis bar guys to make you feel like an idiot for not figuring this out on your own or I have to pay just to talk to your service department after I already have in my name 436 days left on my service contract!  The contract only goes with the phone even though your update changed my ipad also!  A little customer service that is given free of charge when you have some one really trying to educate themselves on and ios7 that they didn't even want would go a very long way toward keeping your customers happy otherwise once a more friendly tech company that offers the better product tops you. Its over!  You have a great product and people are paying you to help them lean how to navigate it!  The problem is once you have mastered one system that system is updated and you start over!  Maybe you could offe something for everyone!  You see my husband doesn't have to ever call apple because he has and IQ to high to measure!   Unfortunately the service I payed for is with his phone and I now have and I pad with the ios7 that converted automatically and when I call they tell me I must be told there will be a fee charged for this service!   One question I asked the support center apple store is how can the ipad convert when the iphone 5 is at the Norfolk Navy Base with my spouse and the ipad is here in Spring Hill Florida with me.  She said it just happens!  The service center nearest available to me is 1 hour away and I need an appt. With them to ask a simple question!.  Time is a commodity that is becoming more dear to me every day and it seems I am spending a great deal of it trying to solve a somewhat simple question to the experts no more than a 3 minute conversation could set me on the right track but I can't even buy insurance service for my ipad that just converted to ios 7 on its's own!  Sincerely I could use some help
    <E-mail Edited by Host>

  • Can I select the data of the indexes?

    Hi everybody,
    Oracle storages indexes in index type segments as I know.
    Is it possible to see the data of these index segments like a table or view?
    So I would like to see not only the structue of it with:
    select * from dba_segments SG where SG.segment_name = ’index_name’
    I think something like this:
    For example if I have a table named Table1.
    (please don’t see the format of the rowid):
    Rowid....field1
    1_1.......AA
    1_2.......AB
    1_3.......BB
    and I have an index on field1 named ndx_t1_f1.
    Create index ndx_t1_f1 on Table1(field1);
    I would like to see something like this
    (if it is a simple Btree index like the ndx_t1_f1):
    Select * from some_schema.???ndx_t1_f1???
    Rowid..........ParentRowid..........ValuePrefix..........SolutionRowid
    2_1
    2_11............2_1.......................A
    2_12............2_1.......................B
    2_111..........2_11.....................AA......................1_1
    2_112..........2_11.....................AB......................1_2
    2_121..........2_12.....................BB......................1_3
    And if i run:
    select field1 from table1 where filed1 like 'B%'
    oracle can use ndx_t1_f1 index like this:
    2_1 -> 2_12 -> 2_121 -> BB
    Yes, I know, there are some promlems with this imagine, but is it possible, or is it a silly question?
    Thanx: lados.

    Hi,
    You asked: „Why do you want to do that?”
    Well, I have a table T with fields F1, F2, F3 ...
    If I run:
    select F2, T.* from T where F1=12345;
    the result is one record and the value of F2 is ‘A’.
    But if I run:
    select F2, F1 from T where F1=12345;
    the result is one record and the value of F2 is ‘B’.
    And this is the same record. Oppps!!!!!
    I think the cause of the problem is the next:
    I have an index on F1, F2 named ndx_T_F1_F2
    In the second case: oracle uses only the index blocks and no table blocks, because all asked data exists in the index blocks.
    In the first case: oracle uses the table blocks too, because I asked all field.
    And I think there is a corrupted data on the index.
    I created a new index on (F1,F2,F3), and I suggest to use this.
    select /*+index(T, ndx_T_F1_F2_F3)*/ T.F2 from T where F1=12345;
    the result is one record and the value of F2 is ‘A’.
    But what is strange, oracle didn’t realise this inconsistent situation.
    (It could be an earlier crash, I don’t know, I’m new at this workplace)
    I think, the problem can solve with recreating the index ndx_T_F1_F2.
    But it’s a very special situation for me, and I would like to see the corrupted data concretly with my eyes.
    I think, that
    Select * from some_schema.???ndx_t1_f1???
    would I see like a view, but it would based on procedures and not tables.
    It would be enough to me, because I only could see the data in the index.
    But it is impossible as you wrote, isn’t it?
    Thanx: lados.

  • Index (or not) for excluding NULL values in a query

    Hello,
    I have table that can become very large. The table has a varchar2 column (let's call it TEXT) that can contain NULL values. I want to process only the records that have a value (NOT NULL). Also, the table is continuously expanded with newly inserted records. The inserts should suffer as little performance loss as possible.
    My question: should I use an index on the column and if so, what kind of index?
    I have done a little test with a function based index (inspired by this Tom Kyte article: http://tkyte.blogspot.com/2006/01/something-about-nothing.html):
    create index text_isnull_idx on my_table(text,0);
    I notice that if I use the clause WHERE TEXT IS NULL, the index is used. But if I use a clause WHERE TEXT IS NOT NULL (which is the clause I want to use), a full table scan is performed. Is this bad? Can I somehow improve the speed of this selection?
    Thanks in advance,
    Frans

    I build a test case with very simple table with 2 columns and it shows that FTS is better than index access even when above ratio is <= 0.01 (1%):
    DROP TABLE T1;
    CREATE TABLE T1
               C1 VARCHAR2(100)
              ,C2 NUMBER
    INSERT INTO T1 (SELECT TO_CHAR(OBJECT_ID), ROWNUM FROM USER_OBJECTS);
    BEGIN
         FOR I IN 1..100 LOOP
              INSERT INTO T1 (SELECT NULL, ROWNUM FROM USER_OBJECTS);
         END LOOP;
    END;
    CREATE INDEX T1_IDX ON T1(C1);
    ANALYZE TABLE T1 COMPUTE STATISTICS
         FOR TABLE
         FOR ALL INDEXES
         FOR ALL INDEXED COLUMNS
    SET AUTOTRACE TRACEONLY
    SELECT
              C1, C2
         FROM T1 WHERE C1 IS NOT NULL;
    3864 rows selected.
    real: 1344
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=59 Card=3864 Bytes=30912)
       1    0   TABLE ACCESS (FULL) OF 'T1' (Cost=59 Card=3864 Bytes=30912)
    Statistics
              0  recursive calls
              0  db block gets
           2527 consistent gets
           3864 rows processed
    BUT
    SELECT
         --+ FIRST_ROWS
              C1, C2
         FROM T1 WHERE C1 IS NOT NULL;
    3864 rows selected.
    real: 1296
    Execution Plan
       0      SELECT STATEMENT Optimizer=HINT: FIRST_ROWS (Cost=35 Card=3864 Bytes=30912)
       1    0   TABLE ACCESS (BY INDEX ROWID) OF 'T1' (Cost=35 Card=3864 Bytes=30912)
       2    1     INDEX (FULL SCAN) OF 'T1_IDX' (NON-UNIQUE) (Cost=11 Card=3864)
    Statistics
              0  recursive calls
              0  db block gets
           5052 consistent gets
           3864 rows processed
    and just for comparison:
    SELECT * FROM T1 WHERE C1 IS NULL;
    386501 rows selected.
    real: 117878
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=59 Card=386501 Bytes=3092008)
       1    0   TABLE ACCESS (FULL) OF 'T1' (Cost=59 Card=386501 Bytes=3092008)
    Statistics
              0  recursive calls
              0  db block gets
         193850 consistent gets
         386501 rows processedHence you have to benchmark you queries with and w/o index[es]

Maybe you are looking for