Which Index to create on column ?

Hi Guys,
I have a table, which has some no. of columns. In that, one column is of Varchar2(1) which contains the value either 'Y' or 'N' and there are two other columns which contains the sequential numbers and these are unique values. So the data is like below.
Col1     Col2     Col3
1     1     Y
1     2     Y
1     3     N
1     4     N
2     5     N
2     6     Y
2     7     Y
2     8     YThese are the three main columns that will be used in all the queries with other tables, and there scenarios also when only col3 will be used in the queries.
My problem is how do I create index on this table, 1) should I create a Bit map index on Col3 and Btree index on col1 and col2
or 2) I should create btree index on all the three columns.
In case of 1, how the index can be used to improve the performance of the query, do we need to give some hint so that both the indexes are used to execute the statement.
Much appreciate your help.
Thanks in advance.
Vinod.

If this table has frequent concurrent inserts and updates then you should probably stear well clear of a bitmap index.
Presumably you are constraining the unique values with a primary key which means that you're going to have an index on 1 and 2 anyway.
With column 3, unless there is a large skew in the distribution of data between Y and N, it's unlikely that an index is going to prove particularly useful.
With a YN column, as it is a low cardinality column, it can often be a good candidate for being the leading column in a composite index such that queries on columns 2 and 3 in the index can use a skip scan. However given that cols 1 and 2 are already indexed, if there are no other columns in the table, it doesn't sound justifiable.
But if you have the various queries that will be used against this table, it's a good idea to test the various scenarios and compare performance between the various approaches. But bear in mind that the concurrent activity against bitmaps is key.

Similar Messages

  • Which index  I should create  Btree or Bitmap  index?

    I have table with columns c1,c2,c3
    I want to create index on column c1
    which index I should create Btree or Bitmap index
    the column contain 50% unique values and 50% duplicate values
    If Btree why?
    If Bitmap Why?
    I know that
    Btree is used when there more unique values (high cardinality)
    Bitmap is used when there less unique values (low cardinality)

    read this -
    Deadlocks with Bitmap Indexes
    Bitmap indexes were designed to be used solely within data warehouses, i.e. where the vast majority of the database activity is reading data,
    and there's very little (or no) data modification, except for batch processes which occasionally re-populate the warehouse.
    Each "row" in the bitmap index contains references to potentially many different rowids, in contrast to a B*-tree index which references a single rowid.
    It should be obvious, therefore, that, since the transactional mechanism is the same for all database operations, that any DML on a table which impacts the bitmap index may end up locking (or attempting to lock) many different "rows" within the index.
    This is the key concept with deadlocks in bitmap indexes, you're not being deadlocked on the underlying table, but on the index blocks. Courtesy - http://www.oratechinfo.co.uk/deadlocks.html
    hope u got it now...

  • How to create a dynamic RTF report which creates dynamic columns based on dynamic column selection from a table?

    Hi All,
    Suppose I have table, whose structure changes frequently on daily basis.
    For eg. desc my_table gives you following column name on Day 1
    SQL > desc my_table;
    Output
    Name
    Age
    Phone
    On Day 2, two more columns are added, viz, Address and Salary.
    SQL > desc my_table;
    Output
    Name
    Age
    Phone
    Address
    Salary
    Now I want to create an Dynnamic RTF report which would fetch data from ALL columns from my_table on daily basis. For that I have defined a concurrent program with XML as output type and have attached a data template/data definition to it which takes in XML as input and gives final output of conc program in EXCEL layout. I am able to do this for constant number of columns, but dont know how to do it when the number of columns to be displayed changes dynamically.
    For Day 1 my XML file should be like this.
    <?xml version="1.0" encoding="UTF-8"?>
    <dataTemplate name="XYZ" description="iExpenses Report" Version="1.0">
    <dataQuery>
    <sqlStatement name="Q2">
    <![CDATA[
    SELECT Name
    ,Age
    ,Phone
    FROM my_table
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="G_my_table" source="Q2">
      <element name="Name" value="Name" />
      <element name="Age" value="Age" />
      <element name="Phone" value="Phone" />
    </group>
    </dataStructure>
    </dataTemplate>
    And my Day 1, EXCEL output from RTF template should be like this.
    Name     Age     Phone
    Swapnill     23     12345
    For Day 2 my XML file should be like this. With 2 new columns selected in SELECT clause.
    <?xml version="1.0" encoding="UTF-8"?>
    <dataTemplate name="XYZ" description="iExpenses Report" Version="1.0">
    <dataQuery>
    <sqlStatement name="Q2">
    <![CDATA[
    SELECT Name
    ,Age
    ,Phone
    ,Address
    ,Salary
    FROM my_table
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="G_my_table" source="Q2">
      <element name="Name" value="Name" />
      <element name="Age" value="Age" />
      <element name="Phone" value="Phone" />
      <element name="Address" value="Address" />
      <element name="Salary" value="Salary" />
    </group>
    </dataStructure>
    </dataTemplate>
    And my Day 2, EXCEL output from RTF template should be like this.
    Name     Age     Phone     Address     Salary
    Swapnill     23     12345         Madrid     100000
    Now, I dont know below things.
    Make the XML dynamic as in on Day 1 there must be 3 columns in the SELECT statement and on Day 2, 5 columns. I want to create one dynamic XML which should not be required to be changed if new columns are added in my_table. I dont know how to create this query and also create their corresponding elements below.
    Make the RTF template dyanamic as in Day1 there must 3 columns in EXCEL output and on Day 2, 5 columns. I want to create a Dynamic RTF template which would show all the columns selected in Dynamic XML.I dont know how the RTF will create new XML tags and how it will know where to place it in the report. Means, I can create RTF template on Day 1, by loading XML data for 3 columns and placing 3 XML tags in template. But how will it create and place tags for new columns on Day 2?
    Hope, you got my requirement, its a challenging one. Please let me know how I can implement the required solution using RTF dynamically without any manual intervention.
    Regards,
    Swapnil K.
    Message was edited by: SwapnilK

    Hi All,
    I am able to fulfil above requirement. Now I am stuck at below point. Need your help!
    Is there any way to UPDATE the XML file attached to a Data Definition (XML Publisher > Data Definition) using a standard package or procedure call or may be an API from backend? I am creating an XML dynamically and I want to attach it to its Data Definition programmatically using SQL.
    Please let me know if there is any oracle functionality to do this.
    If not, please let me know the standard directories on application/database server where the XML files attached to Data Definitions are stored.
    For eg, /$APPL_TOP/ar/1.0/sql or something.
    Regards,
    Swapnil K.

  • How to create index on a varchar column that represent date?

    Hello there,
    I have a column in my table that is a VARCHAR2 and represent a datetime like '2010-08-23 19:00:00' I want to create an index on it and with an specific large like '2010-08-23 19' so i can filter per HOURS.
    Any one knows the sentence for this?
    Thanx in advance

    Vladimir Zakharychev wrote:
    I'd highly recommend you heed the advice given: store dates as DATE, numbers as NUMBER, strings as VARCHAR2. I can't imagine any valid reason for storing dates like that (except the undisputable "because I want it that way.") You are likely to see all sorts of inefficiencies with your current design (it will not sort correctly, for example, because it will sort strings, not dates, and the rules for sorting them are different.) The function-based index you created will only work if your query will use that same exact function you created the index on.Not to mention that there is no way the database can enforce the "date" data to actually be a valid date . . . and there will come a time that the application *will not" enforce it ...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to create a concatenated index with a long column (Urgent!!)

    We have a situation where we need to create a concatenated unique
    index with one of the columns as a "long" datatype. Oracle does
    not allow a lot of things with long columns.
    Does anyone know if this is possible or if there is a way to get
    around it.
    All help is appreciated!!!!

    From the Oracle SQL Reference ...
    "You cannot create an index on columns or attributes whose
    type is user-defined, LONG, LONG RAW, LOB, or REF,
    except that Oracle supports an index on REF type columns
    or attributes that have been defined with a SCOPE clause."
    Doesn't mention CLOB or BLOB types, so perhaps you
    should consider using one of those types instead. I have a
    feeling that the LONG type is now deprecated.

  • How can i know which index will be used when executing the query ?

    1 ) I have query in which i have 3-4 tables but there multiple index on one column .
    so how can i know which index will be used when executing the query ?
    2) I have a query which ia taking too much time . how can i know which table is taking too much time ?
    3) Please Provide me some document of EXplain plan ?

    Hi Jimmy,
    Consider the below example
    /* Formatted on 2011/02/04 21:59 (Formatter Plus v4.8.8) */
    CREATE TABLE FIRST AS
    SELECT * FROM all_objects;
    UPDATE FIRST
    SET object_name = 'TEST'
    WHERE owner != 'SCOTT';
    CREATE INDEX idx_first ON FIRST(object_name);
    SELECT *
    FROM FIRST
    WHERE object_name = 'TEST';
    It has not used index
    Execution Plan
    Plan hash value: 2265626682
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 58678 | 7334K| 163 (4)| 00:00:02 |
    |* 1 | TABLE ACCESS FULL| FIRST | 58678 | 7334K| 163 (4)| 00:00:02 |
    /* Formatted on 2011/02/04 21:59 (Formatter Plus v4.8.8) */
    SELECT *
    FROM FIRST
    WHERE object_name = 'emp';
    This has used the index
    Execution Plan
    Plan hash value: 1184810458
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 128 | 1 (0)| 00:00:01 |
    | 1 | TABLE ACCESS BY INDEX ROWID| FIRST | 1 | 128 | 1 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | IDX_FIRST | 1 | | 1 (0)| 00:00:01 |
    From this we can come to the conclusion that, whether to use one index or not by oracle
    would also depend on the data which is present in the table. This has to be this way as
    we see in the bind peeking, if oracle sticks to only one plan, say only use the full table
    scan, it would be a performance hit when it searches for the second query ie where object_name
    ='emp';
    2.
    If we have a query like below.
    select * from emp
    where upper(ename) = upper(:p_ename);
    Evenif we have the index on ename column, oracle wouldn't be able to use the index, as there is a function in the predicate column. If you need oracle to use the index, we need to create a function based index as below.
    Create index idx_ename on emp(upper(ename));
    Regards,
    Cool

  • Which index will it take and why ?

    Hi, 
    I have a table Employee and i have an index on EmpID on this table. Now i have created a view EmpView on this table. I have created an index on this view for the same column EmpID.
    Now my question is If i query select * from Empview where empId = something then which index will it consider and why?? 
    Thanks in advance
    Balaji 
    Balaji - BI Developer

    Good day Balaji
    Prasad 
    1. How long it took you to write the question in the forum?
    You are asking about specific case in your database. I am sure that you could open click on the Execution Plan button and get a faster answer and much more accurate for your specific database. Not always the forum is the best and faster solution, sometimes
    you can get it yourself.
    Regarding the "why", it is a good question :-)
    please post DDL+DML
    2. As other mentioned if you want help regarding a query then we need to be able to reproduce the situation. Instead of stories on your tables, you could post the DDL+DML queries :-) that mean the create table (with indexes) query and the insert sample
    data query. With this information we can click the Execution Plan button in our server :-)
    Moreover, with DDL+DML we might suggest a better solution
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • Which index rebuild?

    Hi,
    i have question about index rebuild
    how can findout which index rebulid?

    Generally speaking, none of your indexes will need rebuilding, so forget all about them and let them do their work without fiddling with them.
    Right: there will always be a few exceptions to such general rules. There are no easy rules to follow, though, despite what some so-called experts will tell you.
    Classically, you are supposed to do analyze index blah validate structure and then query the view INDEX_STATS. If DEL_LF_ROWS divided by LF_ROWS is greater than about 0.25 (that is, 25% of the index is marked as deletable but hasn't been lately), and if that ratio doesn't improve by itself over the course of the next few days, then the index might be considered a candidate for a rebuild.
    Rather less classically, but rather more practicably, if you have metrics for how queries are supposed to perform and you regularly track against those metrics, then when the metric indicates a slow-down, you might at least investigate whether the index has blown out and could do with a bit of re-compaction.
    You might also reasonably rebuild your index if moving it into archive partitions or soon-to-be read-only tablespace, for then you will want the index to be as compact as possible.
    You might also very reasonably drop indexes before a bulk load and therefore equally reasonably re-create them after the load.
    Similarly, if you discover you got the order of columns wrong (because your queries always want to select things by column S and D, but your index is built on columns D, G and S), then you will be looking to drop and re-create the index from scratch.
    But most indexes really don't need routine maintenance.

  • Index usage depends on columns selected

    Hi, somehow cannot understand why index is not used, please help.
    in Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
    1.     Included only indexed column and got a perfect plan
    explain plan for2 select s.x_cnt
    3 from reported_summary s
    4 where s.x_cnt>0;
    PLAN_TABLE_OUTPUT
    Plan hash value: 2674489506
    | Id | Operation | Name | Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 306 (8)|
    |* 1 | INDEX FAST FULL SCAN| S_NUI01 | 306 (8)|
    Predicate Information (identified by operation id):
    1 - filter("s"."x_CNT">0)
    2.     Included some other column and got TABLE ACCESS FULL
    explain plan for2 select s.x_cnt,s.ru_id
    3 from reported_summary s
    4 where s.x_cnt>0;
    PLAN_TABLE_OUTPUT
    Plan hash value: 2142873335
    | Id | Operation | Name | Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 2421 (3)|
    |* 1 | TABLE ACCESS FULL| REPORTED_SUMMARY | 2421 (3)|
    Predicate Information (identified by operation id):
    1 - filter("s"."x_CNT">0)
    3.     Included all other columns and got TABLE ACCESS FULL as well
    explain plan for2 select s.x_cnt,s.*
    3 from reported_summary s
    4 where s.x_cnt>0;
    PLAN_TABLE_OUTPUT
    Plan hash value: 2142873335
    | Id | Operation | Name | Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 2421 (3)|
    |* 1 | TABLE ACCESS FULL| REPORTED_SUMMARY | 2421 (3)|
    Predicate Information (identified by operation id):
    1 - filter("s"."x_CNT">0)
    Thanks a lot

    Thanks all, just to clarify
    "select s.x_cnt from reported_summary s..." is using index;
    "select 'Y' y from reported_summary s..." is using index;
    "select <any ohter column> from reported_summary s..." is causing TABLE ACCESS FULL;
    no differences in where clause, no order by at all
    the index script is
    CREATE INDEX S_NUI01 ON REPORTED_SUMMARY (OFFSET_CNT) TABLESPACE X_INDEXES;
    jgarry, thanks for the answer, the only problem that I have clone of the database (32 bit) with same CBO parameters
    where it does not behave this way:
    explain plan for2 select s.offset_cnt
    3 from reported_summary s
    4 where s.offset_cnt>0;
    PLAN_TABLE_OUTPUT
    Plan hash value: 2359470296
    | Id | Operation | Name | Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 9 (0)|
    |* 1 | INDEX RANGE SCAN| S_NUI01 | 9 (0)|
    Predicate Information (identified by operation id):
    1 - access("s"."OFFSET_CNT">0)
    explain plan for2 select s.offset_cnt,s.ru_id
    3 from reported_summary s
    4 where s.offset_cnt>0;
    PLAN_TABLE_OUTPUT
    Plan hash value: 3732627180
    | Id | Operation | Name | Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 67 (0)|
    | 1 | TABLE ACCESS BY INDEX ROWID| REPORTED_SUMMARY | 67 (0)|
    |* 2 | INDEX RANGE SCAN | S_NUI01 | 9 (0)|
    Predicate Information (identified by operation id):
    2 - access("s"."OFFSET_CNT">0)
    Thanks again.

  • Index creation on Blob column

    I am new to InterMedia. I am trying to create an index on a blob column. I am getting a error -
    Can you please suggest me the solution of this problem.
    Thanks.......
    The following statement(s) failed to execute successfully.
    CREATE INDEX temp.ind1 ON temp.student(MOL) INDEXTYPE IS CTXSYS.CONTEXT PARAMETERS('')
    ORA-29855: error occurered in the execution of ODCINDEXCREATE routine
    ORA-20000: interMedia Text error:
    DRG-50704: Net8 listener is not running or cannot start external procedures
    ORA-28575: unable to open RPC connection to external procedure agent
    ORA-06512: at "CTXSYS.DRUE", line 122
    ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 34
    ORA-06512: at line 1
    null

    Listner problems probably. Please check the FAQ at http://technet.oracle.com/products/text/

  • How do I create multiple columns with bullets in pages

    I'm trying to figure out how to create multiple columns within a document in which I bullet information...

    At the point you wish to change to two columns, Insert > Columns and then in the Layout Inspector, select the number of columns. After the insertion point, you will also need to insert another Column Change to return the following paragraphs to single column.
    Then Select the text to be bulleted and in the Text Inspector > List tab select the type of bullets.
    Note: This creates two columns that flow together. This can be tricky if you add any text later.
    If you wish to ensure alignment, create a two column text table and remove the lines with the Graphic Inspector > Lines > No Lines option and insert your text in each column and apply the bullets as above.
    This will create a text box - you then need to ensure it moves with the text by electing "Object Moves With Text" in the Wrpa Inspector.
    Message was edited by: bwfromspring hill

  • How can I create a column to numerically order all the items?

    As a first time user of Numbers, I created a table of info which I imported from Address book.
    Everything looks good.
    I would like to be able to see how many addresses I have on the table.
    I looked at the Numbers 08 manual, and went to Preferences, then Auto correction, then -automatically detect lists.
    The manual says to choose something on Table Inspector- but I couldn't find it.
    I did choose - have Press Return to automatically move to next cell.
    I created a column before the first column on my table ( which was last name) and typed 1.
    I thought that when I pressed return it would automatically type in 2 and 3 and so on.
    But I guess I missed a step.
    Any suggestion?

    Hi Rosie,
    It's not clear whether you want to Number the names or Count the names. I'll give you the solution for each.
    To number the entries, begin as you have done, typing a "1" in the first cell, and hitting Return. Then type a "2" in the second cell. Now select both cells and grab the little circle in the lower right corner of the selection rectangle, pulling it down to continue the sequence that you have begun typing.
    To count the number of entries without numbing them, here is one pretty easy way...
    Click on the column label over the last names, which will select the entire column. Then click on the Function Icon on the Toolbar and select Count. This will insert a Footer Row in your Table, and will display the number "0". The zero count is because you have no numbers values in the column. To edit the function to display the count of text items, Names, we need to edit the Function from COUNT to COUNTA. Just click on the footer cell to select it, then click in the Formula Bar, just above the Column Labels, and place your text cursor behind the "T" in COUNT and type an "A". Then hit Return. Now your new footer cell will show your count of names.
    Post back if you have questions.
    Jerry

  • Created by column value is not showing in XSLT List View After Migration To 2013

    Hello All,
    In my XSLT Created By Column value is not showing. Please help me with this problem. My code is simple I have custom column in XSLT name as 'Reported By' in which I want to show 'Created By' column value. but it is not showing. please help me with that.
    Thanks in advance

    hi
    is anyone has answer for this question.
    thanks...!!!!

  • "Created By" Column is showing empty in SharePoint List

    Hello All,
    I have created a custom list and enabled the "Created By" and "Created" Column to be shown in the list.
    All the users are able to see the "Created" Column populated, but the "Created By" column is blank, no value is populated to it.
    But the Farm Administrator is able to see the values for "Created By" column in the List. I tried providing full control to the Users, provided all permissions, but still the users are unable to see this column populated. I have no clues what to
    be done.
    So I tried a workaround specified in the forum ie., by using a column with calculated value =[Me]. But this gives the login name and not the Proper name, which is not helpful for me. I just want a column which displays who created the item.
    Please help me regarding this issue.
    Thanks,
    Shanky

    Hi Alex,
    Yes, I have checked them too.
    1. This is happening with all lists, as I have modified the permission for the users to the lists only to :
    Add Items
    View Items
    Open Items
    View application Pages
    View Pages
    Open
    This is to make sure that the users wont modify the list or delete it or its items.
    2. This is happening with all the items in the list, not only for other people's items but also for current user's item as well.

  • How to get the index of a h:column element?

    Hi!
    I'd like to know how to get the index of a <h:column> element.
    Here is the code of what I'm trying to do:
    <h:column>
         <a:commandLink
              value="#{familyAction.familyDocsByPrj}"
              action="#{homeAction.search(ROW_INDEX)}"
              reRender="rightAppPanel" />
    </h:column>When clicking a row, I'd like to make a "search" depending on the selected row.
    Does anybode know how to do that?
    Thanks a lot :)

    Thanks a lot for all your answers! :)
    I finally got to do something with my little knowledge =P
    I created a new class containing all the data needed for the dataTable (including a "String id").
    And that's what I get:
    <h:column>
         <a:commandLink
              value="#{familyAction.familyDocsByPrj.name}"
              action="#{homeAction.search(familyAction.familydocsByPrj.id)}"
              reRender="rightAppPanel" />
    </h:column>

Maybe you are looking for

  • Adobe Photoshop CS5.1 (64 Bit) trial  issue with license agreement

    when i click on accept in the adobe software license agreement the window disappears for a few seconds then reappears aking me to accept the agreement again. I am running Windows 7 Home premium Any help on this issue is appreciated. thanks!

  • Work Flow preview issue in SBWP

    Hi Friends, We have issue related to SBWP. When a work item is selected in SAP inbox, we are not able to to see any thing on the SAP preview window at the bottom. It shows only the white blank screen. Can any one please help. Regards, Rohit

  • Fileupload in Tableview Iterator

    Dear Forum Members, I am using CL_HTMLB_Fileupload Element in my Table View Iterator. I am using MVC Based solution. How can i bind filename with model data so that data is passed to model in Do_handle_data. I want to upload the same file to DMS Syst

  • Right click in safari 4.0.3 always causing alert sound

    Hi, I've just come across this issue, whenever I right click directly in any web page of safari 4.0.3 (by directly I mean, without any text selected, and not in the input field), an alert sound appears. I've tried checking my mouse settings, repairin

  • Labview task scheduler

    Hello,  I have a main LabVIEW test program that runs constantly, and a LabVIEW program set that generates test reports and FTP transfers. The test report generation and FTP transfer programs are currently geared to be a Windows Scheduled Task - but t