index composite index of single column vs?

I just wonder what are the differences between the following?

create table (test)

person_id number

name varchar2 (50).

name varchar2 (50)

);

create index my_indx on test (name);

create index my_indx2 on test (family name);

OR

create index my_indx3 on test (name, first name);

OR

create index my_indx4 on test (name, name);

What are the differences between these three index?

When to create full name in same (composite index) columns in order to scan of systematic index should I use two of them in the where clause?

My last question is, is the order for the composite index?

Thanks in advance.

Hello

the difference between the 3 case is quite simple:

(1) on the first and last name predicates can be solved through scan of the index systematic range

(2) predicates on name can be solved through systematic index scan range, predicates on names can only use indexes skip scan (which is about NDV (name) times less efficient than a scan of normal range, where NDV (name) is the number of distinct values in the name column)

((3) same as 2) with swapped name

(Not that if a query involves both a name and a surname, then box 1) would have to choose between a scan interval index 'fat' and a join of the index. (Anyway it's going to be more expensive than 2) or 3) (who are going to be just as effective in this case).

Best regards

Nikolai

Tags: Database

Similar Questions

  • index on the column of low cardinality

    Hello
    Standard edition Oracle 10.2

    I have a 'status' column in my table. table contains about 100000 records.
    The possible values of status will be 1 or 2 (digital). This column will be 5 to 10 percent of the population, and the rest is null.

    Because it is seems that bitmap index is candidate for low cardinality column, but this picture has high of DML operations. SO by web research I learned about this bitmap causes problems of blocking on high DML operations.

    So I think that B-tree is only option left. Can you suggest a good index to improve performance on such a column?

    You don't need an index based on a function, do you think?

    You have a STATUS column where a small percentage of values is not null.

    To effectively access these lines whose STATUS is non-zero, simply create an index on the column State.

    This should be plenty effective.

    The effectiveness of this index (or the fbi if she was forced) is based on the fact that an index b-tree contains entry when the value is null (or all of the values in the case of a composite).

    There are those that 100000 is small and 5-10% is not particularly selective and you tell the width of the table, etc., so, even with the index here, it might not if used - i.e. depending on the circumstances it might be more efficient to do a FTS.

    It depends on what you want to do.

    See:
    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:4433887271030
    http://richardfoote.WordPress.com/2008/05/12/index-scan-or-full-table-scan-the-magic-number-magic-dance/

    Published by: Dom Brooks on February 10, 2011 12:58

  • unique index on two columns

    Hi all
    I want a unique index on two columns, but when I try this it will show me
      1  CREATE UNIQUE INDEX sale_order_no
      2*   ON sale_order (sale_order_no, season_year)
    SQL> /
      ON sale_order (sale_order_no, season_year)
         *
    ERROR at line 2:
    ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found
    I want to do not overlap with the combination of these two

    Plaese Guide
    Thanks and greetings
    Vikas

    You would this behavior if SALE_ORDER_NO has NULL values. If it contains NULL values, a unique single-column index will succeed but an index unique multi-column will fail when it finds duplicates in SEASON_YEAR.

    See:

    SQL> create table dummy_objects (object_id  number, object_owner varchar2(30), object_name varchar2(30));
    
    Table created.
    
    SQL> insert into dummy_objects values (0,'HEMANT','TABLE_A');
    
    1 row created.
    
    SQL> insert into dummy_objects values (1,'HEMANT','TABLE_B');
    
    1 row created.
    
    SQL> insert into dummy_objects values (NULL,'HEMANT','NULL_1');
    
    1 row created.
    
    SQL> insert into dummy_objects values (NULL,'HEMANT','NULL_2');
    
    1 row created.
    
    SQL> create unique index dummy_objects_u1 on dummy_objects(object_id);
    
    Index created.
    
    SQL> drop index dummy_objects_u1;
    
    Index dropped.
    
    SQL> create unique index dummy_objects_u2 on dummy_objects(object_id, object_owner);
    create unique index dummy_objects_u2 on dummy_objects(object_id, object_owner)
                                            *
    ERROR at line 1:
    ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found
    
    SQL>
    

    Hemant K Collette
    http://hemantoracledba.blogspot.com

  • Get the index of the column of table removed

    Is there a way to get the index of the column in a 2D table that has been deleted? In my application, the user has the possibility to use the right click option 'remove a column' on a 2D picture, but I would like to use this information to remove the same column in a different table programmatically. Is this possible?

    There is a file published in the documents of the community that refers to a location in a sheet of the user has clicked.  Use it like the image below.

    https://decibel.NI.com/content/docs/doc-22434

  • Best Index on a column with low cardinality on a high DML activity table?

    I wanted to ask a question about the indices? I have a table which is the main table in the my system it holds nearly 65 000-1000000 rows on any average day. Each line has a (mandatory) batch, it can be 6 different status which is held in the state table. The distribution of status id in the master table is shown below. There is no index on this column, it has a low cardinality, but there are many dml moves in this table. However the State is the main request, the report runs against, so it made a full table scan every time. Users run their applications via an interactive report on Apex 4.0 and it runs slowly. It seemed to be a lock on the $ wwv_FLOW_PREFERENCES caused by this slow execution of interactive report query in this table for and is it locking associated with a slow interactive report query?

    SELECT * from Main_Table where batch =: b2

    A full table scan is done in this case.

    Distribution of status id in the main table

    0.12%

    Reopened pending

    1.01%

    Current

    0.17%

    Pending

    0.01%

    Closed not resolved

    96,44%

    Closed

    2.24%

    Open

    Database

    Database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production

    PL/SQL Release 12.1.0.2.0 - Production

    CORE Production 12.1.0.2.0

    AMT for Linux: Version 12.1.0.2.0 - Production

    NLSRTL Version 12.1.0.2.0 - Production

    How about a LIST partition on batch column?

  • Oracle Spatial Index on a column NOT NULL

    I'm using the Oracle 11 g with data space init.

    I have a SDO_GEOM column in a table that has NULL values for some records. I have to run spatial query based on this column so the need of a spatial index on it. Is it possible to create a Spatial Index on a column SDO_GEOM even if some of them have the NULL value and results of spatial query?


    Thank you
    Alan

    Published by: user3883362 on 29 April 2013 05:59

    Alan,

    Is it possible to create a Spatial Index on a column SDO_GEOM even if some of them are NULL

    Yes.

    SQL> CREATE TABLE test (ID NUMBER PRIMARY KEY, geom MDSYS.SDO_GEOMETRY);
    
    Table created.
    
    -- "insert a row with non-NULL geometry"
    SQL> INSERT INTO test VALUES (1, SDO_GEOMETRY('POINT (6000000 2100000)', 40986));
    
    1 row created.
    
    -- "insert a row with NULL geometry"
    SQL> INSERT INTO test VALUES (2, NULL);
    
    1 row created.
    
    SQL> CREATE INDEX test_spx ON test (geom) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    
    Index created.
    

    .. .and getting results of spatial query

    Yes, assuming that your data is valid.

    -- "Creates a 10' buffer around the point we previsouly inserted then applies SDO_INSIDE"
    SQL> SELECT ID, SDO_INSIDE(geom, SDO_GEOM.SDO_BUFFER(geom, 10, 1)) FROM test;
    1 TRUE --"our point geometry"
    2 FALSE --"our NULL"
    
    2 rows selected.
    

    If you encounter problems here, I think you can use the functions that are choking in NULL values, for example, the conversion of NULL in WKT geometry.

    How do you access data (sqlplus, application, custom, etc.)? What is the query, and we see a few examples of data?

    Kind regards
    Noel

  • decide how to add indexes on the column

    Hi all

    I get about confious using index

    When should I decide to add index?

    http://docs.Oracle.com/CD/E11882_01/server.112/e25789/indexiot.htm#CNCPT811

    In general, consider creating an index on a column in any of the following situations:
    
        The indexed columns are queried frequently and return a small percentage of the total number of rows in the table.
    
        A referential integrity constraint exists on the indexed column or columns. The index is a means to avoid a full table lock that would otherwise be required if you update the parent table primary key, merge into the parent table, or delete from the parent table.
    
        A unique key constraint will be placed on the table and you want to manually specify the index and all index options.
    
  • Index on two columns becomes the index of function?

    Hello, I create a unique index with two columns, a number (9) and a date.

    It becomes an index of feature based with the number column and a column sys hidden (date).

    When I do queries that use this index the autotrace tells me it does things like this:

    sys_nc00001$ > SYS_OP_DESCEND (datevalue)
    sys_nc00001$ IS NOT NULL

    How is he did not have a normal index?

    Use of ESCR does this.

    Of http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5010.htm

    Oracle database processes Index descending as if they were focused on the index function.

  • Indexing of a column based on content types

    Hello

    Is it possible to create an index of text only for certain content. For example, I have a table of CONTENTS
    create table CONTENT
    (
    Identification number,
    CONTENT_TYPE_ID number 4,
    Clob DATA
    )

    with different content_type_ids say 10, 20, 30, etc. I need to create a text index on the column of DATA for content_type_id = 10. Can anyone help me please with an example? Thanks in advance

    Concerning
    REDA

    Another method would be to use the format column in the database using table IGNORE to disregard the documents you do not want to index.

    SQL> alter table CONTENT add fmt varchar2(10);
    
    Table altered.
    
    SQL> update CONTENT set fmt='IGNORE' where  content_type_id != 10;
    
    2 rows updated.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> create index content_idx
     on content (data)
     indextype is ctxsys.context
     parameters ('format column fmt')
    /
    
    Index created.
    

    -Edwin

  • index on the column using custom function

    Can we create index on the column using custom function?

    http://www.dbasupport.com/Oracle/ora8/FBI.shtml

    Kind regards
    Kaila Mahesh

  • Yosemite stuck in a single column, view column for the finder discovers all files

    I use Yosemite on a MacBook Air and I am an old user of Mac since 1989. Today, I can not go single column, all files display even if the menu or the icon indicates that I should see display multi-column.   Y at - it a known bug, or a way to reset this?  Thank you.

    It is normally enough to 'reset ':

    Apple-> Forcequit menu: relaunch the Finder.

    If this does not help:

    Restart the mac in shift: starts in mode safe, slow, connection; When logged in, restart normally.

    Lex

  • Trying to create a Section to multiple columns with Sections of the single column before and after

    Is there a way to create a section break that is not default to a new page after I created columns on a page.  I created the columns and under them, I want to return to the normal formatting for the rest of the single page.  See picture attached.

    Any rejection of Pages v5 has a break of presentation which was present in the Pages ' 09 v4.3. This will allow you to transition to several columns and back to single column on the same page. In the v5 Pages, you can insert 3 text boxes and change the 3-column layout in the Middle text box. You use the toolbar item Insert to inject column breaks when you want to start a new list in the next column. I'll show this screenshot below.

    You can fake your layout in Pages v5 using 3 text boxes and setting 3 columns in the Central text area. Better to show the mode of provision for this and in a text box, the column outlines are not displayed. After each column list, you then choose column break the Insert point toolbar menu to move to the next column, add a list, repeat. Each column will expand downwards. Click on the following to enlarge.

    Pages ' 09 v4.3 using layout breaks Pages using 3 text boxes V5.6.1                                                      

      

  • Remove the clicked point of Listbox (single column)

    Hello

    It seems a lot of posts on clear lines of the programmatically multicolumn listbox but not the only column listboxes.

    Woth the help of Martins and GerdW, helped me build a subset of a ListBox with items clicked in a reference list

    Make a table of items clicked in a list

    . How it adds a feature to delete just in case rather than the deletion of the entire list and do it all over again.

    Thanks in advance.

    Have an array of strings to the "REF" enter in the list box and store it on a shift register. When you remove an item (for example, for an event), remove this item from the list (using the removal of the table) and write back to the property Ref of the listbox. A single-column list box works exactly the same way as a multicolumn listbox.

    (Excuse the broken links to properties - what happens when you create an excerpt)

  • Divided into a single column

    Hello

    I need to split into single column in the format below:

    SELECT '6500,1100,3200,1233,9000' FROM DUAL;

    Result:

    6500

    1100

    3200

    1233

    9000

    For 11g and above:

    Select regexp_substr (6500, 1100, 3200, 1233, 9000', ' [^,] +', 1, level) suite

    of the double

    connect by level<= regexp_count('6500,1100,3200,1233,9000',="" ',')="" +="">

    For 10g:

    Select regexp_substr (6500, 1100, 3200, 1233, 9000', ' [^,] +', 1, level) suite

    of the double

    connect by level<= length="" (regexp_replace="" ('6500,1100,3200,1233,9000',="" '[^,]+'))="" +="">

    or (if there is no empty entries):

    Select regexp_substr (6500, 1100, 3200, 1233, 9000', ' [^,] +', 1, level) suite

    of the double

    connect regexp_substr (6500, 1100, 3200, 1233, 9000', ' [^,] +', 1, level) is not null

    RESULT
    6500
    1100
    3200
    1233
    9000

    5 selected lines.

  • Two foreign keys of a table in a single column

    Hi gurus

    I wonder that can we add two foreign keys of a table on a single column, I think the answer is, but what should be the reason behind this?

    Appreciate if someone there explain to me...

    Concerning

    Muzz

    Hello Muzz,

    Perhaps the example of human Chen reveals a design error.
    If a student has a 'teacher_id' "teacher" FK and FK for "emp" becaue each teacher is an EMP, I guess that the correct design would be to have only the FK of 'teacher' and to have another pointing to the 'emp' table in the 'teacher' tabe FK

    But we can imagine comical situations...
    CREATE TABLE PEOPLE (id NUMBER of KEY PRIMARY, name VARCHAR2 (20 CHAR),...);
    CREATE TABLE SCIENTIST (id people KEY PRIMARY NUMBER (id) REFERENCES, discipline VARCHAR2 (20 CHAR),...);
    CREATE TABLE POLICEMAN (id REFERENCES to KEY PRIMARY NUMBER (id), hire_date people DATE,...);

    First table = all.
    2nd: a subset of the first, with people having the profile of 'scientific '...
    3rd: a subset of the first, with people being a policeman.
    It might be people first table and in none of the 2nd and 3rd, 1st and 2nd, 1st and 3rd only or in the 3 tables.

    Then we can have a fourth table of 'something' referring to a person who must be a scientist and a police officer.

    Here is a sqlplus session illustrating; the last piece: I try inserting several lines in xxxx, only the last is accepted.

    SQL > CREATE TABLE PEOPLE (id NUMBER of the PRIMARY KEY, name VARCHAR2 (20 CHAR));
    Table created.

    SQL > CREATE TABLE SCIENTIST (people of REFERENCES of KEY PRIMARY NUMBER id (id), discipline VARCHAR2 (20 CHAR));
    Table created.

    SQL > CREATE TABLE POLICEMAN (people of REFERENCES of KEY PRIMARY NUMBER id (id), DATE hire_date);
    Table created.

    SQL > CREATE TABLE XXXX (id PRIMARY KEY NUMBER, people_id NUMBER, any other VARCHAR2 (30 CHAR));
    Table created.

    SQL > ALTER TABLE ADD CONSTRAiNT fk_xxsci FOREIGN KEY (people_id) scientific xxxx REFERENCES (id);
    Modified table.

    SQL > ALTER TABLE ADD CONSTRAiNT fk_xxpol FOREIGN KEY (people_id) police xxxx REFERENCES (id);
    Modified table.

    SQL > INSERT INTO person VALUES (100, 'John');
    1 line of creation.

    SQL > INSERT INTO person VALUES (120, 'Mary');
    1 line of creation.

    SQL > INSERT INTO person VALUES (103, 'Tom');
    1 line of creation.

    SQL > INSERT INTO person VALUES (123, "Bruno");
    1 line of creation.

    SQL > INSERT INTO VALUES of scientific (120, 'Chemistry');
    1 line of creation.

    SQL > INSERT INTO scientific VALUES (123, 'Mathematics');
    1 line of creation.

    SQL > INSERT INTO VALUES of policeman (103, DATE ' 2001-04-01');
    1 line of creation.

    SQL > INSERT INTO VALUES of policeman (123, DATE ' 1998-07-01');
    1 line of creation.

    SQL > INSERT INTO xxxx VALUES (1, 456, "nothing");
    ERROR on line 1:
    ORA-02291: integrity constraint (SYS. FK_XXPOL) violated - key parent not found

    SQL > INSERT INTO xxxx VALUES (1, 100, "only to people");
    ORA-02291: integrity constraint (SYS. FK_XXPOL) violated - key parent not found

    SQL > INSERT INTO xxxx VALUES (1, 120, "only the learned");
    ORA-02291: integrity constraint (SYS. FK_XXPOL) violated - key parent not found

    SQL > INSERT INTO xxxx VALUES (1, 103, "only police officer");
    ORA-02291: integrity constraint (SYS. FK_XXSCI) violated - key parent not found

    SQL > INSERT INTO xxxx VALUES (1, 123, 'ok');
    1 line of creation.

    Best regards

    Bruno Vroman.

Maybe you are looking for

  • Need to move files from Nikon D3 image to iPhoto

    I had a photographer here today to take a few mountain landscape photos of my property that he had wanted to do for a long time.  Today, I agreed to let it shoot as much as he would like, under one condition: that I get copies of all the raw images i

  • I do not understand the iTunes libraries.

    Can someone please explain how to use the libraries of iTunes for me? I have a folder music on my mac with all the 23 GB of my music from my old computer inside. But iTunes makes a new folder named "iTunes 1" and stuck 15 GB of my music in there. Not

  • LTE: Where my updates to the OS?

    XT1527 I bought my phone directly from Motorola and I am a customer of T-Mobile. The phone is came with Android 5.0.2 and some time later I received v 5.1 OTA. Who sent it? Motorola, Google, T-Mobile?

  • Ladies of the Internet do not work with windows 7

    new asus laptop internet ladies work well, cannot play more than once and must find new opp! Tried what is recommended on this site does not need help

  • HP G62 Notebook PC: HP G62 fan questions

    Hey there! I am the owner of relatively satisfied a HP G62 laptop, which is between three and four years. I'm very happy with it, but the fan was strange for months and he has now got so bad that I decided to do something. Whenever I turn it on after