Columns in storage indexes

Hi All,
Exadata storage indexes stores eight columns in a table.
I am bit confused here, what will happen if I am having a table with 24 columns. In this case how does Storage indexes use these 24 columns.
whether three indexes will be created for this table?
Kindly explain.

Thanks for your comment.
The content of blog is depend on previous experience in my customer environment. And now, my office doesn't have exadata machine. so i can't test.
The scenario of Restriction #4 is as in the following.
1) select count(*) from t1 where c1=:b1 --> maybe SI is created for columns c1 and after that time, we can use SI.
2) truncate table t1; --> data_object_id is changed.
3) insert into t1 (many rows)..
4) select count(*) from t1 where c1=:b1; --> SI doesn't work.
so, I think that every time cellsrv start, oracle manages the data_object_id for all objects and if data_object_id is changed then SI doesn't work.
But, Actually i don't know, that is only port specific problem.
Thank you!~
Edited by: seankim on 2013. 4. 30 오전 7:57
Edited by: seankim on 2013. 4. 30 오전 7:58
Edited by: seankim on 2013. 4. 30 오전 7:58

Similar Messages

  • Storage Indexes does not work

    Hi,
    I set kcfisstorageidx_disabled to FALSE and use different variations of conditions on the first column in a table.
    =, >, is null
    SmartScan is used, but storage indexes is not used.
    How can I check that Storage Indexes is globally enabled? I have read only access to exadata.
    Edited by: 793769 on 25.03.2011 6:24

    Hi all,
    I have the same problem.
    I do not know version of cellsrv, Oracle 11.2.0.2.
    Stat 244 is not populated.
    I use some query
    select count(*) from t where n (char column) = 'Z',
    query works 5 sec and returns 0 rows.
    select count(*) from t where n (char column) IS NULL,
    query works 1.5 sec and return 0 rows.
    SmartScan used in both cases. Physical reads bytes the same in both cases.
    but stat 244 = 0
    I suggest Storage Indexes have been used, but how can I check that this happens except stat 244?
    It there some indirect evidence?
    I found that statistic "file io wait time" in the second case (is null) less than in the first case (='Z').

  • Getting error "Column is not indexed " when executing query on ORACLE 10g

    Hi all,
    When executing the below query im getting the error "ORA-20000:Column is not indexed"
    query:
    select xmlelement("nexml:result",xmlattributes('http://namespaces.nextance.com/nex/xml' as "xmlns:nexml"),xmlelement("nexml:value",count(*))).getClobVal()
    from "permission"
    where ( ((contains(object_value,'(searchDocument) inpath(/permission/action)') > 0)) and ((existsNode(object_value,'/permission[resource/resourcekey/@type[. = "document"]]') = 1)) and ((contains(object_value,'(GeneralUser) inpath(/permission/principal/@name)') > 0)) and ((existsNode(object_value,'/permission[principal/@type[. = "group"]]') = 1)) and ((existsNode(object_value,'/permission[type[. = "allow"]]') = 1)) and ((contains(object_value,'(nexip) inpath(/permission/resource/resourcekey/field/@value)') > 0) or (contains(object_value,'(Corporate) inpath(/permission/resource/resourcekey/field/@value)') > 0) or (contains(object_value,'(ProcurementAgreement) inpath(/permission/resource/resourcekey/field/@value)') > 0) or (contains(object_value,'(Procurement) inpath(/permission/resource/resourcekey/field/@value)') > 0) or (contains(object_value,'(SalesAgreement) inpath(/permission/resource/resourcekey/field/@value)') > 0)) )
    Then after checking some forum, i replaced "contains" with "ora:contains" and executed the query. Now im not getting the first error but got a new error "invalid relational operator"
    So please help me in resolving the errors?
    Thanks in advance.

    Anil kumar wrote:
    Hi,
    Thanks for your reply. Could you please explain your solution in detail?Hi,
    I just have a try...
    create table t (id int,my_lob clob)
    begin
    insert into t values(101,'Oracle redwood shores USA');
    insert into t values (102,'HP palo alto USA');
    insert into t values(103,'Capgemini  FRANCE');;
    end;
    create index my_idx on t(my_lob) indextype is ctxsys.context
    select *
    from t
    where contains(my_lob,'USA',1)>0
    Output
    ID      MY_LOB
    101     Oracle redwood shores USA
    102     HP palo alto USA Hope it helps,
    CKLP

  • Adding a column into existing index

    Can I add a column into existing index?
    or do I need to drop the index and recreate one?
    Thanks.

    but there is no way to add a column to an existing table10:43:24 TEST.SQL>create table test10:43:28 2 (
    10:43:29 3 a number
    10:43:32 4 )
    10:43:34 5 tablespace tools
    10:43:36 6 ;
    Table created.
    Elapsed: 00:00:00.06
    10:43:38 TEST.SQL>alter table test add
    10:43:44 2 b date;
    Table altered.
    Elapsed: 00:00:00.68
    10:43:48 TEST.SQL>desc test
    Name Null? Type
    A NUMBER
    B DATE
    10:43:51 TEST.SQL>drop table test;
    Table dropped.Indeed there is.Yoann.

  • Error -90032 occurred at Error in function centref at line 5 column 8: The indexes are out of bounds for the variable you specified

    Sir, 
    i am running a matlab code in mathscript of labview but getting an error
    Error -90032 occurred at Error in function centref at line 5 column 8:  The indexes are out of bounds for the variable you specified
    this code running successfully in matlab 
    please help me in this regard
    a .vi format file is attached named as mfcc_new.vi
    Attachments:
    mfcc2.vi ‏35 KB
    mfcc_new.vi ‏111 KB

    May I see you have 6 inputs to your Mathscript Node. When you test it in Matlab I suposse that you're using some values for this inputs and everything work as expected. Then, run it in Labview using highlight execution, retaining wire values and using single stepping. Check the values which are being inserted to your Mathscript Node and ensure that they are correct. You're having an "indexes out of bounds" mistake, so it probably means that there is something  wrong with the inputs according to your expectations. You can also put the MathScript alone in another VI and insert the inputs you're expecting manually and check in the same way.
    Good luck!

  • Adding column  to existed index syntax or example

    Hi,
    can any one please tell me the syntax or example for adding one more column to existed index.
    Thanks in Advance
    Krishna

    Hello Mr Murali,
    I do not believe you can alter index by adding more columns to it with ALTER command.
    But you can always CREATE a new index with the columns that you need (ONLINE, if necessary) and then DROP existing index.

  • Actual Column Name for Index when Function is used?

    Hi,
    We have some indeces where the column in oracle is actually a function in the form UPPER('column-name'). When I query user_ind_columns I get something like SYS_NC0012$ for the column name. Where would I be able to actually query the actual column it's using in the index? So that I can query the exact column name if need be. Don't ask why cause this is a developer asking me this and they are doing some sort of a comparison between indexes between two application.
    Here is the SQL for the Index and the Table associated with it
    create table BATCH_HEADER2
    PAYMENT_TYPE VARCHAR2(17),
    BATCH_TYPE VARCHAR2(40) not null,
    BATCHNUM NUMBER not null,
    BRANCH VARCHAR2(16),
    BATCH_TIME NUMBER,
    USER_LOB VARCHAR2(16),
    PAYEE_TYPE VARCHAR2(40),
    PROGRESS_RECID NUMBER,
    CHEQUE_TYPE VARCHAR2(60),
    SCANNERBATCHNO NUMBER,
    RECEIPTCOUNT NUMBER
    alter table BATCH_HEADER2
    add constraint PK_BATCH_HEADER2 primary key (BATCH_TYPE, BATCHNUM)
    using index
    tablespace FT1_DATA;
    --Inxes
    create unique index FT1DSTINT.BATCH_HEADER2##BYNUM on FT1DSTINT.BATCH_HEADER2 (UPPER(BATCH_TYPE), BATCHNUM)
    tablespace FT1_DATA
    pctfree 10
    initrans 2
    maxtrans 255
    storage (initial 64K
    minextents 1
    maxextents unlimited);

    From Oracle's standpoint, though, it isn't indexing BATCH_TYPE. It's indexing an arbitrary function that happens to take BATCH_TYPE as an input. As far as Oracle is concerned, you might just as easily be indexing an expression that took a dozen column names as parameters, so it doesn't really make sense for Oracle to try to break down anything beyond the function.
    Of course, you could always parse the expression and extract the column name, but I would be dubious that's the right answer... If a developer is comparing indexes between columns, there is a heck of a lot of difference between an index on BATCH_TYPE, and index on UPPER(BATCH_TYPE) and an index on SOME_OTHER_FUNCTION( BATCH_TYPE ).
    Justin

  • Column that have index

    I need to know what columns that have "ID%" and are NOT NULL from my user "TESTE" dont have a index. I used something like:
    select owner, table_name, index_name from dba_indexes where owner='TESTE' and table_name in (
    select table_name from ALL_TAB_COLUMNS where owner='TESTE' and COLUMN_NAME like 'ID%' and NULLABLE like 'N')
    But this give what columns have, i need the opposite.
    Tks,
    Elber.
    Message was edited by:
    Elber

    Although Sundar's solution may work in your particular case, it may be innacurate if more than one table could have a column with the same name. Fortunately, the fix for that also give you the table name "for free"
    SELECT table_name, column_name
    FROM all_tab_columns
    WHERE owner='TESTE' and
          column_name LIKE 'ID%' and
          nullable LIKE 'N'
    MINUS
    SELECT table_name, column_name
    FROM all_ind_columns
    WHERE index_owner='TESTE' and
          column_name LIKE 'ID%'You could also just add table_name to the select list of Kedruwsky's solution.
    One thing you may want to keep in mind is that both Sundar's and Kedruwsky's solutions, and my modification of Sundar's only check to see if the column is present in an index. It could be the fifth column in a seven column index.
    Depending on what exactly you are looking for, you may want to consider the column_position field in all_ind_columns. If you modify the parts of the queries against all_indexes to include a predicate like:
    column_position = 1it will eliminate only those columns that are on the leading edge of the index. Based on the ID% name, I suspect that you might be looking for primary keys. If that is true, you might want to replace the queries against all_ind_columns with a query against a join of all_constraints and all_cons_columns. Something like:
    SELECT table_name, column_name
    FROM all_tab_columns
    WHERE owner='TESTE' and
          column_name LIKE 'ID%' and
          nullable LIKE 'N'
    MINUS
    SELECT table_name, column_name
    FROM all_constraints c, all_cons_columns cc
    WHERE c.constraint_name = cc.constraint_name and
          c.constraint_type = 'P' and
          c.owner='TESTE' and
          cc.column_name LIKE 'ID%' and
          cc.position = 1HTH
    John

  • Column Order of index on 12M record table

    I have table name
    tablea
    Fields
    kickoff_id int
    and
    status int
    and many others.....
    Now tablea contain 12M records.
    I have query
    Select * from
    tablea
    where
    status =2 and kickoff_id > 0
    status can have three possible values 0,1,2
    and
    kickoff_id can have 0 to 8 values....
    I am planning to make an index on status and kickoff_id
    So what should be preferrable order of index...
    status,kickoff_id
    or
    kickoff_id and status
    Regards
    Mahesh

    I would think the column which restricts the number of rows to a greater extent should come first.
    also, here is someting from Oracle documentation that may help you decide on type of index that will be better suited for
    your requirement.
    ===============================================================================================================
    Cardinality
    The advantages of using bitmap indexes are greatest for low cardinality columns: that is, columns in which the number of distinct values is small compared to the number of rows in the table. If the number of distinct values of a column is less than 1% of the number of rows in the table, or if the values in a column are repeated more than 100 times, then the column is a candidate for a bitmap index. Even columns with a lower number of repetitions and thus higher cardinality can be candidates if they tend to be involved in complex conditions in the WHERE clauses of queries.
    For example, on a table with 1 million rows, a column with 10,000 distinct values is a candidate for a bitmap index. A bitmap index on this column can out-perform a B-tree index, particularly when this column is often queried in conjunction with other columns.
    B-tree indexes are most effective for high-cardinality data: that is, data with many possible values, such as CUSTOMER_NAME or PHONE_NUMBER. In some situations, a B-tree index can be larger than the indexed data. Used appropriately, bitmap indexes can be significantly smaller than a corresponding B-tree index.
    In ad hoc queries and similar situations, bitmap indexes can dramatically improve query performance. AND and OR conditions in the WHERE clause of a query can be quickly resolved by performing the corresponding Boolean operations directly on the bitmaps before converting the resulting bitmap to rowids. If the resulting number of rows is small, the query can be answered very quickly without resorting to a full table scan of the table.
    =============================================================================================================================
    I have table name
    tablea
    Fields
    kickoff_id int
    and
    status int
    and many others.....
    Now tablea contain 12M records.
    I have query
    Select * from
    tablea
    where
    status =2 and kickoff_id > 0
    status can have three possible values 0,1,2
    and
    kickoff_id can have 0 to 8 values....
    I am planning to make an index on status and kickoff_id
    So what should be preferrable order of index...
    status,kickoff_id
    or
    kickoff_id and status
    Regards
    Mahesh

  • Does the order of columns in an index matter?

    Hi,
    I have a table having composite index, five columns. (col1,col2,col3,col4,col5)
    Currently , my index is beginning with the column which having low distinct values and so on.
    ( in my case the first column have 1 distinct values due to functional behavior ). the second column have 3 distinct values , the third column have many distinct value ( half of the table).
    There are many DML queries on this table with different clauses.
    Examples:
    query 1 : where col1 =val1 and col2 = val2
    query 2 : where (col3,col4) in ( select col1,col2 from another_table ) ( for this we can add col1 =val1 and col2 = val2)
    My question is : what this best way to create index on this case ?
    The order of columns on index depends on its distinct values?
    Thanks

    BIJGA wrote:
    Hi,
    I have a table having composite index, five columns. (col1,col2,col3,col4,col5)
    Currently , my index is beginning with the column which having low distinct values and so on.
    ( in my case the first column have 1 distinct values due to functional behavior ). the second column have 3 distinct values , the third column have many distinct value ( half of the table).
    There are many DML queries on this table with different clauses.
    Examples:
    query 1 : where col1 =val1 and col2 = val2
    query 2 : where (col3,col4) in ( select col1,col2 from another_table ) ( for this we can add col1 =val1 and col2 = val2)
    My question is : what this best way to create index on this case ?CREATE INDEX
    The order of columns on index depends on its distinct values? yes
    Handle:     BIJGA
    Status Level:     Newbie (5)
    Registered:     Aug 24, 2009
    Total Posts:     66
    Total Questions:     18 (14 unresolved)
    I extend my condolences to you since you rarely get answers to your questions.

  • Query about XMLTYPE column structured storage in Oracle Xml db

    Dear All,
    DB Version: Oracle 11g (11.2.0.3.0)
    I have an table having one column as XMLTYPE with Structured storage.
    CREATE TABLE Orders
        Order_id NUMBER NOT NULL,
        Order_etc VARCHAR2(100),
        Order_desc XMLType NOT NULL
        XMLTYPE Order_desc STORE AS OBJECT RELATIONAL XMLSCHEMA  "http://localhost/public/xsd/order_desc_xsd.xsd" ELEMENT "OrderState";
    I have then registered the XSD with XML Db schema which is required for Structured storage.
    Before this table creation I had created a table (db_objects) of XMLTYPE and was able to use the below query to check for what all objects the XMLTYPE table got broken into when I registered its XSD.
        SELECT column_name,     
               data_type
        FROM   user_tab_cols
        WHERE  table_name = 'DB_OBJECTS';
    And used below query to look for data stored in Object-Relational structure for my table (DB_OBJECTS) created with XMLTYPE definition.
      SELECT EXTRACTVALUE(xseq.column_value, '/THISROW/OWNER')       AS owner
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_NAME') AS object_name
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_TYPE') AS object_type
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_ID')   AS object_id
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/CREATED')     AS created
        FROM   db_objects do
         ,      TABLE(XMLSEQUENCE(EXTRACT(VALUE(do), '/ROWSET/THISROW'))) xseq 
        WHERE  ROWNUM <= 10;
    Now could someone let me know, how to find how the column (Order_desc) of XMLTYPE was broken down into further objects just like I did for the Table with XMLTYPE (as shown above)?
    Many Thanks.

    First given that you are on 11.2, ExtractValue is deprecated and the documentation lists three options to use instead.  Here is one option (untested)
    SELECT owner, object_name, object_type, object_id, created
      FROM db_objects do,
           XMLTable('/ROWSET/THISROW'
                    PASSING do.object_value
                    COLUMNS
                    -- Set data types accordingly
                    owner        VARCHAR2(20) PATH 'owner',
                    object_name  VARCHAR2(20) PATH 'object_name',
                    object_type  VARCHAR2(20) PATH 'object_type',
                    object_id    VARCHAR2(20) PATH 'object_id',
                    created      VARCHAR2(20) PATH 'created');
    Second, why does column order matter?  You are storing in an object relational method.  As long as the XML is valid per the schema, the Oracle will be able to store the data and later retrieve it as well.  How that data is stored is mostly Oracle internals and should not be touched as it can be changed from version to version.  You can use schema annotation to control how Oracle maps and stores the XML, but nothing in there specifies column order that I am aware of.
    It seems additional details are missing as to what you need the information for so that would help others answer your question.

  • Change Data type column - Performance of Index in Oracle 10g

    Hi,
    I have a table with too many rows (over 2000000 rows) . I have changed datatype (NUMBER to VARCHAR2) of an indexed column (the index is only for this column), using a temporay backup table:
    CREATE TABLE BKTABLE AS SELECT FIELD, ROWID AS IDROW FROM ORIGNALTABLE;
    UPDATE ORIGNALTABLE SET FIELD = NULL;
    ALTER ORIGNALTABLE MODIFY FIELD VARCHAR2(256);
    UPDATE ORIGNALTABLE A SET FIELD = (SELECT FIELD FROM BKTABLE B WHERE B.IDROW = A.IDROW);
    This way worked OK.
    There is any performance knowed issue over an index of ORIGNALTABLE? Need rebuild this index?
    Thks!

    Need rebuild this index? YES
    ALWAYS
    Post Operating System (OS) name & version for DB server system.
    Post results of
    SELECT * from v$version
    or post Oracle version to 4 decimal places

  • 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

  • Schema Design for 10^6+ rows table (Indicator Column / Bitmap Join Index?)

    Hi all,
    I read following suggestion for a SELECT with LEFT OUTER JOIN in a DB2 consulting company paper for a 10 million-rows table:
    SELECT columns
    FROM ACCTS A LEFT JOIN OPT1 O1
    ON      A.ACCT_NO = O1.ACCT_NO
    AND     A.FLAG1 = ‘Y’
    LEFT JOIN OPT2 O2
    ON      A.ACCT_NO = O2.ACCT_NO
    AND     A.FLAG2 = ‘Y’
    WHERE A.ACCT_NO = 1
    For DB2, according to the paper, the following is true: Iff A.FLAG1 <> ‘Y’ Then no Table or Index Access on OPT1 is done. Same for A.FLAG2/OPT2.
    I recreated the situation for ORACLE with the following script and came to some really interesting questions
    DROP TABLE maintbl CASCADE CONSTRAINTS;
    DROP TABLE opt1 CASCADE CONSTRAINTS;
    DROP TABLE opt2 CASCADE CONSTRAINTS;
    CREATE TABLE maintbl
    id INTEGER NOT NULL,
    dat VARCHAR2 (2000 CHAR),
    opt1 CHAR (1),
    opt2 CHAR (1),
    CONSTRAINT CK_maintbl_opt1 CHECK(opt1 IN ('Y', 'N')) INITIALLY IMMEDIATE ENABLE VALIDATE,
    CONSTRAINT CK_maintbl_opt2 CHECK(opt2 IN ('Y', 'N')) INITIALLY IMMEDIATE ENABLE VALIDATE,
    CONSTRAINT PK_maintbl PRIMARY KEY(id)
    CREATE TABLE opt1
    maintbl_id INTEGER NOT NULL,
    adddat1 VARCHAR2 (100 CHAR),
    adddat2 VARCHAR2 (100 CHAR),
    CONSTRAINT PK_opt1 PRIMARY KEY(maintbl_id),
    CONSTRAINT FK_opt1_maintbltable FOREIGN KEY(maintbl_id) REFERENCES maintbl(id)
    CREATE TABLE opt2
    maintbl_id INTEGER NOT NULL,
    adddat1 VARCHAR2 (100 CHAR),
    adddat2 VARCHAR2 (100 CHAR),
    CONSTRAINT PK_opt2 PRIMARY KEY(maintbl_id),
    CONSTRAINT FK_opt2_maintbltable FOREIGN KEY(maintbl_id) REFERENCES maintbl(id)
    INSERT ALL
    WHEN 1 = 1 THEN
    INTO maintbl (ID, opt1, opt2, dat) VALUES (nr, is_even, is_odd, maintbldat)
    WHEN is_even = 'N' THEN
    INTO opt1 (maintbl_id, adddat1, adddat2) VALUES (nr, adddat1, adddat2)
    WHEN is_even = 'Y' THEN
    INTO opt2 (maintbl_ID, adddat1, adddat2) VALUES (nr, ADDdat1, ADDdat2)
    SELECT LEVEL AS NR,
    CASE WHEN MOD(LEVEL, 2) = 0 THEN 'Y' ELSE 'N' END AS is_even,
    CASE WHEN MOD(LEVEL, 2) = 1 THEN 'Y' ELSE 'N' END AS is_odd,
    TO_CHAR(DBMS_RANDOM.RANDOM) AS maintbldat,
    TO_CHAR(DBMS_RANDOM.RANDOM) AS adddat1,
    TO_CHAR(DBMS_RANDOM.RANDOM) AS adddat2
    FROM DUAL
    CONNECT BY LEVEL <= 100;
    COMMIT;
    SELECT * FROM maintbl
    LEFT OUTER JOIN opt1 ON maintbl.id = opt1.maintbl_id AND maintbl.opt1 = 'Y'
    LEFT OUTER JOIN opt2 ON maintbl.id = opt2.maintbl_id AND maintbl.opt2 = 'Y'
    WHERE id = 1;
    Explain plan for "Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi":
    http://i.imgur.com/f0AiA.png
    As one can see, the DB uses a view to index-access the opt tables iff indicator column maintbl.opt1='Y' in the main table.
    Explain plan for "Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production":
    http://i.imgur.com/iKfj8.png
    As one can see, the DB does NOT use the view, instead uses a pretty useless case-statement
    Now my questions:
    1) What does the optimizer do in 11.2 XE?!?
    2) In General: Do you suggest this table-setup? Does your yes/no suggestion depend on the rowcount in the tables? Of course I see the problem with incorrectly updated columns and would NEVER do it if there is another truly relational solution with same performance possibly.
    3) Is there a way to avoid performance issues if I don't use an indicator column in ORACLE? Is this what a [Bitmap Join Index|http://docs.oracle.com/cd/E11882_01/server.112/e25789/indexiot.htm#autoId14] is for?
    Thanks in advance and happy discussing,
    Blama

    Fair enough. I've included a cut-down set of SQL below.
    CREATE TABLE DIMENSION_DATE
    DATE_ID NUMBER,
    CALENDAR_DATE DATE,
    CONSTRAINT DATE_ID
    PRIMARY KEY
    (DATE_ID)
    CREATE UNIQUE INDEX DATE_I1 ON DIMENSION_DATE
    (CALENDAR_DATE, DATE_ID);
    CREATE TABLE ORDER_F
    ORDER_ID VARCHAR2(40 BYTE),
    SUBMITTEDDATE_FK NUMBER,
    COMPLETEDDATE_FK NUMBER,
    -- Then I add the first bitmap index, which works:
    CREATE BITMAP INDEX SUBMITTEDDATE_FK ON ORDER_F
    (DIMENSION_DATE.DATE_ID)
    FROM ORDER_F, DIMENSION_DATE
    WHERE ORDER_F.SUBMITTEDDATE_FK = DIMENSION_DATE.DATE_ID;
    -- Then attempt the next one:
    CREATE BITMAP INDEX completeddate_fk
    ON ORDER_F(b.date_id)
    FROM ORDER_F, DIMENSION_DATE b
    WHERE ORDER_F.completeddate_fk = b.date_id;
    -- which results in:
    -- ORA-01408: such column list already indexed

  • Order of indexed columns in the index

    Hi Gurus,
    I have a small problem in front of me and I wud like to take some inputs
    from you Gurus.Here is question
    1. Is order of the index is important in CBO?
    say
    1.I have a concatenated index on col1,col2
    2.In the sql statement's used in my project I have statements "where
    col1=1 and col2 = 1" as well as
    "where col2=1 and col1=1" and my opinion is that CBO will use the Index
    in both the scenarios( I have cheked RBO for the same and RBO is able to
    use the index) whereas some senior persons out here are telling
    otherwise..... that it will not use the index for "where col2=1 and
    Col1=1)
    pls clarify
    Cheers
    Sriram Kumar

    When I attended an Oracle 8i SQL Statement Tuning Workshop, I believe I understood things as in the response above. However, the class was applicable to Oracle 8.1.5 and I am now using Oracle 8.1.7, so some things may have changed. I have included a test of various scenarios below. I would have expected all except the last one to use the index, because col2 is not the leading edge of the composite index on col1, col2. Much to my surprise it also used the index there.
    SQL> CREATE TABLE test_table AS
      2  SELECT empno col1, mgr col2 FROM emp
      3  /
    Table created.
    SQL> UPDATE test_table
      2  SET    col1 = 1, col2 = 1
      3  WHERE  col1 = 7782
      4  AND    col2 = 7839
      5  /
    1 row updated.
    SQL> CREATE INDEX test_idx
      2  ON test_table (col1, col2)
      3  /
    Index created.
    SQL> ANALYZE TABLE test_table
      2  COMPUTE STATISTICS
      3  FOR TABLE
      4  FOR ALL INDEXES
      5  FOR ALL INDEXED COLUMNS
      6  /
    Table analyzed.
    SQL> SET AUTOTRACE ON EXPLAIN
    SQL> SELECT * FROM test_table
      2  WHERE col1 = 1 AND col2 = 1
      3  /
          COL1       COL2                                      
             1          1                                      
    1 row selected.
    Execution Plan
       0                                                       
    SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1 Bytes=6)  
       1    0                                                  
      INDEX (RANGE SCAN) OF 'TEST_IDX' (NON-UNIQUE) (Cost=1 Card
    =1 Bytes=6)                                                
    SQL> SELECT * FROM test_table
      2  WHERE col2 = 1 AND col1 = 1
      3  /
          COL1       COL2                                      
             1          1                                      
    1 row selected.
    Execution Plan
       0                                                       
    SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1 Bytes=6)  
       1    0                                                  
      INDEX (RANGE SCAN) OF 'TEST_IDX' (NON-UNIQUE) (Cost=1 Card
    =1 Bytes=6)                                                
    SQL> SELECT * FROM test_table
      2  WHERE col1 = 1
      3  /
          COL1       COL2                                      
             1          1                                      
    1 row selected.
    Execution Plan
       0                                                       
    SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1 Bytes=6)  
       1    0                                                  
      INDEX (RANGE SCAN) OF 'TEST_IDX' (NON-UNIQUE) (Cost=1 Card
    =1 Bytes=6)                                                
    SQL> SELECT * FROM test_table
      2  WHERE col2 = 1
      3  /
          COL1       COL2                                      
             1          1                                      
    1 row selected.
    Execution Plan
       0                                                       
    SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1 Bytes=6)  
       1    0                                                  
      INDEX (FULL SCAN) OF 'TEST_IDX' (NON-UNIQUE) (Cost=1 Card=
    1 Bytes=6)                                                 

Maybe you are looking for

  • Report for Actual/plan Comaprision

    Hi We have defined power consumption as one of the activity types in KP06 and given a rate for the same. Is there a standard report which would give a difference between the plan and actual data in terms of Aty (KWH Consumed) and Value (In INR) for t

  • AirPort Extreme & USB Hard Drive Time Machine Backups

    Hi everyone. I'm a brand spanking new MacBook Pro owner and am looking at ways to backup my machine and to save my films, photos and files on a wireless network that is available to everyone in my home. I'm the first to admit that I'm not the most co

  • Windows service on 10.5.8 server

    Just went to turn on Windows service in Server Admin on a 10.5.8 server....Did not see a the Windows service as it appears on my other 10.3 and 10.4 servers...Does SMB replace this service?

  • Anyone know how to publish iWeb site to .mac groups?

    Hi all This is my first message here... So... Be patient plz I'm afraid that I know the answer, but I hope that someone can tell me(us) more... Is it true that it is NOT possible to publish a site from iWeb to a .mac group? Why this feature is missin

  • Newbye question : what do I need to just "play" a vm in my laptop ?

    today I have vmware player and a few images. my laptop is Win XP and I can not change that . can Oracle VM substitute vmware on this specific scenario ? (I must keep host OS = win XP). I see this statement at the wiki page: Oracle VM Server: A self-c