How to lookup index

I'm very new to SQL Server and especially relational data so the question I have is very complex for me, but it's something I've been tasked with. I have a small database acting as an infrastructure inventory into which I'm importing data. The database has
a table called 'vcenters' storing all vcenters and the primary key from this links to the foreign key in several other related tables (e.g. hosts, VMs, Clusters).
CREATE TABLE [dbo].[vcenters](
[vCenterID] [int] NOT NULL,
[vCenterName] [varchar](20) NOT NULL,
[CustomerID] [varchar](10) NOT NULL,
CONSTRAINT [PK_vcenters] PRIMARY KEY CLUSTERED
[vCenterID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[vcenters] WITH CHECK ADD CONSTRAINT [FK_vcenters_Customers] FOREIGN KEY([CustomerID])
REFERENCES [dbo].[Customers] ([CustomerID])
GO
So the vcenters table contains an numeric index field which is auto-incremented each time data is inserted (1,2,3 etc) and a name field. When I go to import the name into one of the other linked tables I instead need to look up the index from the vcenters
table and insert the numeric value but I don't know how to do this?
CREATE TABLE [dbo].[Hosts](
[HostID] [int] NOT NULL,
[HostName] [varchar](25) NOT NULL,
[vCenterID] [int] NOT NULL,
CONSTRAINT [PK_Hosts_1] PRIMARY KEY CLUSTERED
[HostID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Hosts] WITH CHECK ADD CONSTRAINT [FK_Hosts_vcenters] FOREIGN KEY([vCenterID])
REFERENCES [dbo].[vcenters] ([vCenterID])
GO
I understand inner joins but if anyone could help with this then I'd appreciate it. If I'm not making myself clear then please say where and I'll elaborate. Oh, and I'm using SQL Server Express 2014 (as a testbed).
Thanks in advance
Adam

You never mentioned what your source is but if you are hand writing inserts or generating them you could do something like this.
INSERT INTO Hosts (HostName, vCenterID)
VALUES ('MyName',(Select vCenterID from vcenters WHERE vCenterName = 'yourName'))
This does make the assumption that vCenterName is a unique field, to be sure of it I would but a unique index on this field on the table. Also your DDL is missing the key word IDENTITY after your primary key columns, this lets Sql Server auto increment the
id with each new record and assign it as the value. It is probably a good idea to use this for Hosts as well.
CREATE TABLE [dbo].[vcenters](
[vCenterID] [int] IDENTITY NOT NULL,
[vCenterName] [varchar](20) NOT NULL,
-- additional columns
CONSTRAINT [PK_vcenters] PRIMARY KEY CLUSTERED
[vCenterID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
GO
-- unique constraint on vcentername
CREATE UNIQUE NONCLUSTERED INDEX [IX_vcenters_vecenterName] ON [dbo].[vcenters]
[vCenterName] ASC
GO
-Igor

Similar Messages

  • How to specify index for cache in coherence-cache-config.xml

    Hi All,
    We want to apply indexing on cache data.
    Suppose i have a EMPLOYEE object in coherence cache.
    and i want to use employeeID for indexing purpose.
    Can anybody help me to achieve this at Congregational level i.e. using xml file (coherence-cache-config.xml) .
    Edited by: 981644 on Jan 16, 2013 1:51 AM

    Hi,
    I've posted some [url http://coherence.oracle.com/download/attachments/14647422/add-index-namespace.jar]code and the [url http://coherence.oracle.com/download/attachments/14647422/add-index-namespace-src.jar]source. It depends on coherence common version 2.3.0.39174 however I believe it will work with 2.0.0.23649 also. Coherence common library can be downloaded from [url http://coherence.oracle.com/display/INC10/coherence-common]here
    Note: This is purely an example on how to achieve index creation via a cache configuration file and is not a part of the product thus is not covered by product support.
    Here is an example cache configuration that uses the namespace:
    <cache-config xmlns:service="class://com.oracle.coherence.environment.extensible.ServiceOperations">
        <caching-scheme-mapping>
            <service:index-add cache-name="dist-indexes">
                <extractor>
                    <class-name>ReflectionExtractor</class-name>
                    <init-params>
                        <init-param>
                            <param-type>string</param-type>
                            <param-value>getName</param-value>
                        </init-param>
                    </init-params>
                </extractor>
            </service:index-add>
            <!-- Simplified POF Config -->
            <service:index-add cache-name="dist-indexes" pof-enabled="true">
                <pof-index>8,16,32</pof-index>
            </service:index-add>
            <!-- This should not be counted based on system-property override -->
            <service:index-add cache-name="dist-indexes" pof-enabled="true" enabled="{tangosol.index.add}">
                <pof-index>8,16,31</pof-index>
            </service:index-add>
            <!-- Explicit POF Config -->
            <service:index-add cache-name="dist-indexes">
                <extractor>
                    <class-name>PofExtractor</class-name>
                    <init-params>
                        <init-param>
                            <param-type>{class}</param-type>
                            <param-value>null</param-value>
                        </init-param>
                        <init-param>
                            <param-type>{object}</param-type>
                            <param-value>
                                <class-name>com.tangosol.io.pof.reflect.SimplePofPath</class-name>
                                <init-params>
                                    <init-param>
                                        <param-type>{int[]}</param-type>
                                        <param-value>1,2,4</param-value>
                                    </init-param>
                                </init-params>                     
                            </param-value>
                        </init-param>
                    </init-params>
                </extractor>
            </service:index-add>
        </caching-scheme-mapping>
    </cache-config>Thanks,
    Harvey

  • How to enforce index in oracle query

    Hi all
    how to enforce index in oracle query
    Regards

    Use INDEX hint to force Optimizer to use the specfied index.
    You really need to investigate why Optimizer doesn't choose the index. Remember, INDEX SCAN are not always GOOD.
    Jaffar

  • How to view Index fragmentation in sap ecc6 ?

    how to view Index fragmentation in sap ecc6 ?

    Hi Haimiao,
    You can use brtools to get required information. For relevant steps use the link below
    https://help.sap.com/saphelp_nw04/helpdata/en/08/5742154ae611d1894f0000e829fbbd/content.htm
    Regards,
    Deepak Kori

  • Dbxml:lookup-index fails with edge-element-presence

    The custom xquery function dbxml:lookup-index seems broken for edge-element-presence indices when a namespace is specified:
    dbxml> lookupedge edge-element-presence 'http://ceridwen.us/default' node11 'http://ceridwen.us/default' node1
    1 objects returned for eager index lookup 'edge-element-presence'
    dbxml> q "declare default element namespace 'http://ceridwen.us/default'; dbxml:lookup-index('test', 'node11', 'node1')"
    0 objects returned for eager expression 'declare default element namespace 'http://ceridwen.us/default'; dbxml:lookup-index('test', 'node11', 'node1')'
    dbxml> q "declare default element namespace 'http://ceridwen.us/default'; dbxml:lookup-index('test', 'node11')"
    2 objects returned for eager expression 'declare default element namespace 'http://ceridwen.us/default'; dbxml:lookup-index('test', 'node11')'Dbxml-2.5.16, OSX 10.6.4
    Edited by: jralls on Aug 22, 2010 12:22 PM

    Is this what you need?
    dbxml> listin
    Default Index: node-element-presence-none edge-element-presence-none
    Index: node-element-equality-string node-element-equality-double for node {http://ceridwen.us/test}:dataType
    Index: node-attribute-equality-string node-attribute-equality-double for node {http://ceridwen.us/test}:elemType
    Index: node-attribute-equality-string node-attribute-equality-double for node {}:first
    Index: node-attribute-equality-string node-attribute-equality-double for node {http://ceridwen.us/test}:first
    Index: edge-attribute-equality-string node-attribute-equality-string node-attribute-equality-double for node {http://www.w3c.org/1999/xlink}:href
    Index: node-element-equality-string node-element-equality-double for node {http://ceridwen.us/test}:name
    Index: unique-node-metadata-equality-string for node {http://www.sleepycat.com/2002/dbxml}:name
    Index: node-element-equality-string node-element-equality-double for node {http://ceridwen.us/default}:node11
    Index: node-element-equality-string node-element-equality-double for node {http://ceridwen.us/default}:node12
    Index: node-element-equality-string node-element-equality-double for node {http://ceridwen.us/default2}:node2
    Index: node-element-equality-string node-element-equality-double for node {http://ceridwen.us/default}:node311
    Index: node-element-equality-string node-element-equality-double for node {http://ceridwen.us/default}:node312
    Index: node-element-equality-string node-element-equality-double for node {http://ceridwen.us/default}:node321
    Index: node-element-equality-string node-element-equality-double for node {http://ceridwen.us/default}:node322
    Index: node-element-equality-string node-element-equality-double for node {http://ceridwen.us/test}:ref
    Index: edge-attribute-equality-string node-attribute-equality-string node-attribute-equality-double for node {http://www.w3c.org/1999/xlink}:role
    Index: node-attribute-equality-string node-attribute-equality-double for node {http://www.w3c.org/1999/xlink}:second
    Index: node-attribute-equality-string node-attribute-equality-double for node {http://www.w3c.org/1999/xlink}:title
    Index: node-attribute-equality-string node-attribute-equality-double for node {http://www.w3c.org/1999/xlink}:type
    20 indexes found.This comes from
        DbXml::XmlContainer cnt = sto->getContainer();
        DbXml::XmlTransaction txn = m_mgr->createTransaction();
        try {
         DbXml::XmlUpdateContext uc = m_mgr->createUpdateContext();
         std::string xlink_uri("http://www.w3c.org/1999/xlink");
         std::string href("href");
         std::string role("role");
         std::string attr_eq("edge-attribute-equality-string");
         std::string node_pr("edge-element-presence-none");
         cnt.addIndex(txn, xlink_uri, href, attr_eq, uc);
         cnt.addIndex(txn, xlink_uri, role, attr_eq, uc);
         cnt.addDefaultIndex(txn, node_pr, uc);
         txn.commit();
        catch(DbXml::XmlException& e) {
         logError() << "XmlStorage: Opening container  " << name.sstr() << "  threw "
                 << e.what() << endl;
         throw;
        }There are only two documents in the container:
    <t:TestDoc xmlns:t="http://ceridwen.us/test" t:first="an attribute" xmlns:xlink="http://www.w3c.org/1999/xlink" xlink:second="another attribute">
       This is the root node of a test document
       <t:name>The Test Document</t:name>
       <t:dataType>TestDocument</t:dataType>
       <node1 xmlns="http://ceridwen.us/default" first="a node attribute">This element has 2 subnodes
           <node11>This is the first element under node 1</node11>
           <node12>This is the second element under node 1</node12>
       </node1>
       <node2 xmlns="http://ceridwen.us/default2">This element has three text nodes</node2>
       <node2 xmlns="http://ceridwen.us/default2">This is the second text node</node2>
       <node2 xmlns="http://ceridwen.us/default2">This element is the last one</node2>
       <Table xmlns="http://ceridwen.us/default">
          <t:DataRow t:elemType="Instance">
             <node311>First List Element</node311>
             <node312>Second List Element</node312>
          </t:DataRow>
          <t:DataRow t:elemType="Instance">
             <node321>Another First List Element</node321>
             <node322>Another Second List Element</node322>
          </t:DataRow>
       </Table>
       <?XmlStorage-html default-html?>
       <!--This is a gratuitous comment for testing.-->
    </t:TestDoc>
    <t:TestDoc xmlns:t="http://ceridwen.us/test" t:first="an attribute" xmlns:xlink="http://www.w3c.org/1999/xlink" xlink:second="another attribute">
       This is the root node of a test document
       <t:name>The Test Document</t:name>
       <t:dataType>TestDocument</t:dataType>
       <node1 xmlns="http://ceridwen.us/default" first="a node attribute">
          This element has 2 subnodes
          <node11>This is the first element under node 1</node11>
          <node12>This is the second element under node 1</node12>
       </node1>
       <node2 xmlns="http://ceridwen.us/default2">This element has three text nodes</node2>
       <node2 xmlns="http://ceridwen.us/default2">This is the second text node</node2>
       <node2 xmlns="http://ceridwen.us/default2">This element is the last one</node2>
       <Table xmlns="http://ceridwen.us/default">
          <t:DataRow t:elemType="Instance">
             <node311>First List Element</node311>
             <node312>Second List Element</node312>
          </t:DataRow>
          <t:DataRow t:elemType="Instance">
             <node321>Another First List Element</node321>
             <node322>Another Second List Element</node322>
          </t:DataRow>
       </Table>
       <?XmlStorage-html default-html?>
       <!--This is a gratuitous comment for testing.-->
       <t:ref xlink:href="dbxml:/test/The%20Test%20Document00000001" xlink:role="data:text/plain,reference" xlink:title="The Test Document"xlink:type="simple"/>
    </t:TestDoc>(Aside: It would be really nice if the dbxml shell's print command had a "pretty" option!)

  • How to judge index health

    Hi
    i just want to know how to judge index is healthy
    i know i should look at
    BLEVEL , LEAF_BLOCKS , DISTINCT_KEYS , CLUSTERING_FACTOR
    in dba_indexes
    but how to calculate from this value the health of an index
    I know that BLEVEL should be 3 or less , any other rules?
    Thanks very much

    Thanks for all replies , BLEVEL is 4 or more means u need to rebuild ur index.
    After reading , i am including example of more jnior dbas to help them understand , wen i can say that clustering factor is good or bad for an index
    Ex:
    suppose i have T1 table , and i have Id.T1 indexed with index called IDX1 ,
    IF
    select blocks from dba_tables where table_name ='T1';
    = or close to
    select clustering_factor from dba_indexes where index_name = 'IDX1';
    then the clustering factor is very good. because that means each visit to 1 index block
    will nearly fetch 1 data block from the table (data in the table is not randomly inserted accoring to the indexed column(ID))
    but if the select clustering_factor from dba_indexes where index_name = 'IDX1';
    is much higher than the blocks of the table and nearly = to the number of index entries (or the count(distinct values to the indxed column) (ID) )
    then the clustering factor is very bad and the CBo may prefer to Full table scan rather than access the table by index

  • How to stop indexing certain set of documents in Fast search for sharepoint 2010

    Hello
    Can someone help me to understand how to drop documents with the state as archived at the time of indexing, i meant how to stop indexing those documents in fast search for sharepoint 2010.
    Shweta
    Me

    Have you tried adding it to the exclude list?
    Include a file type in the content index (FAST Search
    Server 2010 for SharePoint)
    This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.

  • What is partition ? how to create partition ? how to maintain indexes ?

    HI experts,
    What is the  use of peartion table
    how to create partition ?
    how to create index ? how to maintain ?
    Thanks in Advance!
    Vijay

    Read
    Partitioned Tables and Indexes
    Create Partitioned Tables and Indexes
    SQL Server Index and Statistics Maintenance
    Many Thanks & Best Regards, Hua Min

  • How to utilize index in selection statement

    hi
    how to utilize index in selection statement and how is it reduces performance whether another alternative is there to reduce performance .
    thanks

    Hi Suresh,
    For each SQL statement, the database optimizer determines the strategy for accessing data records. Access can be with database indexes (index access), or without database indexes (full table scan).The cost-based database optimizer determines the access strategy on the basis of:
    *Conditions in the WHERE clause of the SQL statement
    *Database indexes of the table(s) affected
    *Selectivity of the table fields contained in the database indexes
    *Size of the table(s) affected
    *The table and index statistics supply information about the selectivity of table fields, the selectivity of combinations of table fields, and table size.     Before a database access is performed, the database optimizer cannot calculate the exact cost of a database access. It uses the information described above to estimate the cost of the database access.The optimization calculation is the amount by which the data blocks to be read (logical read accesses) can be reduced. Data blocks show the level of detail in which data is written to the hard disk or read from the hard disk.
    <b>Inroduction to Database Indexes</b>
    When you create a database table in the ABAP Dictionary, you must specify the combination of fields that enable an entry within the table to be clearly identified. Position these fields at the top of the table field list, and define them as key fields.
    After activating the table, an index is created (for Oracle, Informix, DB2) that consists of all key fields. This index is called a primary index. The primary index is unique by definition. As well as the primary index, you can define one or more secondary indexes for a table in the ABAP Dictionary, and create them on the database. Secondary indexes can be unique or non-unique. Index records and table records are organized in data blocks.
    If you dispatch an SQL statement from an ABAP program to the database, the program searches for the data records requested either in the database table itself (full table scan) or by using an index (index unique scan or index range scan). If all fields requested are found in the index using an index scan, the table records do not need to be accessed.
    A data block shows the level of detail in which data is written to the hard disk or read from the hard disk. Data blocks may contain multiple data records, but a single data record may be spread across several data blocks.
    Data blocks can be index blocks or table blocks. The database organizes the index blocks in the form of a multi-level B* tree. There is a single index block at root level, which contains pointers to the index blocks at branch level. The branch blocks contain either some of the index fields and pointers to index blocks at leaf level, or all index fields and a pointer to the table records organized in table blocks. The index blocks at leaf level contain all index fields and pointers to the table records from the table blocks.
    The pointer that identifies one or more table records has a specific name. It is called, for example, ROWID for Oracle databases. The ROWID consists of the number of the database file, the number of the table block, and the row number within the table block.
    The index records are stored in the index tree and sorted according to index field. This enables accelerated access using the index. The table records in the table blocks are not sorted.
    An index should not consist of too many fields. Having a few very selective fields increases the chance of reusability, and reduces the chance of the database optimizer selecting an unsuitable access path.
    <b>Index Unique Scan</b>
    If, for all fields in a unique index (primary index or unique secondary index), WHERE conditions are specified with '=' in the WHERE clause, the database optimizer selects the access strategy index unique scan.
    For the index unique scan access strategy, the database usually needs to read a maximum of four data blocks (three index blocks and one table block) to access the table record.
    <b><i>select * from VVBAK here vbeln = '00123' ......end select.</i></b>
    In the SELECT statement shown above, the table VVBAK is accessed. The fields MANDT and VBELN form the primary key, and are specified with '=' in the WHERE clause. The database optimizer therefore selects the index unique scan access strategy, and only needs to read four data blocks to find the table record requested.
    <b>Index Range Scan</b>
    <b><i>select * from VVBAP here vbeln = '00123' ......end select.</i></b>
    In the example above, not all fields in the primary index of the table VVBAP (key fields MANDT, VBELN, POSNR) are specified with '=' in the WHERE clause. The database optimizer checks a range of index records and deduces the table records from these index records. This access strategy is called an index range scan.
    To execute the SQL statement, the DBMS first reads a root block (1) and a branch block (2). The branch block contains pointers to two leaf blocks (3 and 4). In order to find the index records that fulfill the criteria in the WHERE clause of the SQL statement, the DBMS searches through these leaf blocks sequentially. The index records found point to the table records within the table blocks (5 and 6).
    If index records from different index blocks point to the same table block, this table block must be read more than once. In the example above, an index record from index block 3 and an index record from index block 4 point to table records in table block 5. This table block must therefore be read twice. In total, seven data blocks (four index blocks and three table blocks) are read.
    The index search string is determined by the concatenation of the WHERE conditions for the fields contained in the index. To ensure that as few index blocks as possible are checked, the index search string should be specified starting from the left, without placeholders ('_' or %). Because the index is stored and sorted according to the index fields, a connected range of index records can be checked, and fewer index blocks need to be read.
    All index blocks and table blocks read during an index range scan are stored in the data buffer at the top of a LRU (least recently used) list. This can lead to many other data blocks being forced out of the data buffer. Consequently, more physical read accesses become necessary when other SQL statements are executed
    <b>DB Indexex :Concatenation</b>
         In the concatenation access strategy, one index is reused. Therefore, various index search strings also exist. An index unique scan or an index range scan can be performed for the various index search strings. Duplicate entries in the results set are filtered out when the search results are concatenated.
    <i><b>Select * from vvbap where vbeln in ('00123', '00133', '00134').
    endselect.</b></i>
    In the SQL statement above, a WHERE condition with an IN operation is specified over field VBELN. The fields MANDT and VBELN are shown on the left of the primary index. Various index search strings are created, and an index range scan is performed over the primary index for each index search string. Finally, the result is concatenated.
    <b>Full Table Scan</b>
    <b><i>select * from vvbap where matnr = '00015'.
    endselect</i></b>
    If the database optimizer selects the full table scan access strategy, the table is read sequentially. Index blocks do not need to be read.
    For a full table scan, the read table blocks are added to the end of an LRU list. Therefore, no data blocks are forced out of the data buffer. As a result, in order to process a full table scan, comparatively little memory space is required within the data buffer.
    The full table scan access strategy is very effective if a large part of a table (for example, 5% of all table records) needs to be read. In the example above, a full table scan is more efficient than access using the primary index.
    <i><b>In Brief</b></i>
    <i>Index unique scan:</i> The index selected is unique (primary index or unique secondary index) and fully specified. One or no table record is returned. This type of access is very effective, because a maximum of four data blocks needs to be read.
    <i>Index range scan:</i> The index selected is unique or non-unique. For a non-unique index, this means that not all index fields are specified in the WHERE clause. A range of the index is read and checked. An index range scan may not be as effective as a full table scan. The table records returned can range from none to all.
    <i>Full table scan:</i> The whole table is read sequentially. Each table block is read once. Since no index is used, no index blocks are read. The table records returned can range from none to all.
    <i>Concatenation:</i> An index is used more than once. Various areas of the index are read and checked. To ensure that the application receives each table record only once, the search results are concatenated to eliminate duplicate entries. The table records returned can range from none to all.
    Regards,
    Balaji Reddy G
    ***Rewards if answers are helpful

  • How to reorganization index in new tablespace

    How to reorganization index in new tablespace? for size? for? number of extents? or both?

    What's Oracle version?
    Why you want to reorg your index?
    You could rebuild your index
    alter index <index_name> rebuild tablespace <tablespace_name>check Jonathan's note regarding index rebuild,
    http://jonathanlewis.wordpress.com/2008/02/09/index-rebuild-10g/

  • How to enforce index

    Hi Guys,
    How to enforce index ?
    Say for example,
    select max(dt) from emp
    emp table has an index called 'id1'.
    I want to enforce this index for the above query. How ?
    Inputs are welcome !

    Your index on ID is worthless for this query.
    You would have to add an index on your DT column. Even then, the index will only be used if you have a NOT NULL constraint on the column (or add "and dt is not null" to your query):
    SQL> explain plan for
      2  select min(dt), max(dt) from emp;
    Explained.
    | Id  | Operation            |  Name       | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT     |             |     1 |     8 |   194 |
    |   1 |  SORT AGGREGATE      |             |     1 |     8 |       |
    |   2 |   TABLE ACCESS FULL  | EMP         | 91000 |   710K|   194 |
    SQL> alter table emp modify (dt not null);
    Table altered.
    SQL> explain plan for
      2  select min(dt), max(dt) from emp;
    Explained.
    | Id  | Operation             |  Name       | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT      |             |     1 |     8 |    39 |
    |   1 |  SORT AGGREGATE       |             |     1 |     8 |       |
    |   2 |   INDEX FAST FULL SCAN| EMP_DT      | 91000 |   710K|    39 |
    ---------------------------------------------------------------------Still, even without an index a full table scan of 91000 rows takes < 1 second even on my laptop. How are you getting 21 seconds?

  • How to create indexes on ODS ?

    Hello friends ,
    Need some help .
    Could any one please let me know how to create indexes on ODS ?
    How Indexes are useful on ODS ?
    Thanks in advance
    Regards

    Dear Akshay,
    Below is the information about indexes and there creation for ODS.
    You can search a table for data records that satisfy certain search criteria faster using an index.
    An index can be considered a copy of a database table that has been reduced to certain fields. This copy is always in sorted form. Sorting provides faster access to the data records of the table, for example using a binary search. The index also contains a pointer to the corresponding record of the actual table so that the fields not contained in the index can also be read.
    The primary index is distinguished from the secondary indexes of a table. The primary index contains the key fields of the table and a pointer to the non-key fields of the table. The primary index is created automatically when the table is created in the database.
    You can also create further indexes on a table in the ABAP Dictionary. These are called secondary indexes.Under Indexes, you can create secondary indexes by using the context menu in order to improve the load and query performance of the ODS object This is necessary if the table is frequently accessed in a way that does not take advantage of the sorting of the primary index for the access.
    The database system sometimes does not use a suitable index for a selection, even if there is one. The index used depends on the optimizer used for the database system. You should therefore check if the index you created is also used for the selection (see How to Check if an Index is Used).).
    Creating an additional index could also have side effects on the performance. This is because an index that was used successfully for selection might not be used any longer by the optimizer if the optimizer estimates (sometimes incorrectly) that the newly created index is more selective.
    The indexes on a table should therefore be as disjunct as possible, that is they should contain as few fields in common as possible. If two indexes on a table have a large number of common fields, this could make it more difficult for the optimizer to choose the most selective index.
    Leaving content frame.
    With Regards,
    Prafulla Singh

  • How to create indexes using CREATE TABLE statement

    Hi,
    Can anyone please tell me how to create indexes using CREATE TABLE staement? This point is part SQL Expert exam (1Z0-047) and please guide me to use which books for this particular exam.
    Thanks in advance.

    Can anyone please tell me how to create indexes using CREATE TABLE staement?e.g. creating a primary key or a unique constraint will generate indexes along with the create table syntax:
    SQL> create table t (a integer primary key, b integer unique)
    Table created.
    SQL> select   index_name, index_type, uniqueness
      from   user_indexes
    where   table_name = 'T'
    INDEX_NAME                     INDEX_TYPE                  UNIQUENES
    SYS_C0016575                   NORMAL                      UNIQUE  
    SYS_C0016574                   NORMAL                      UNIQUE  
    2 rows selected.

  • Regarding how to use index , please give me some example if possible

    Hello everybody:
           Thank you all for your help in  advance .
           would you please tell me how to use index, please give me  some example if possible.  couldn't thank you more!
          best regards .
         Frank

    Index is used for faster access of data base tables.
    An index helps to speed up selection from the database. An index is a sorted copy of selected database table fields.
    The primary index is always automatically created in an ABAP-based SAP system. It consists of the primary key fields of the database table. This means, for each combination of the index fields exists a maximum of one record in the table. This kind of index is called a UNIQUE index.
    If the primary index cannot be used to determine selection result, (for example, the WHERE condition does not contain any primary index fields), the system searches the whole table. To prevent this, and determine the selection result by searching through a restricted number of database records, you can create a secondary index.
    However, you should not define an index for all possible fields in the WHERE condition.
    Check this thread..u have more details.
    In which situation we can use the reading of  index

  • How bit map index works?

    I am not getting an example for bitmap index mechanism.
    Supposing their is a table T1 with column c1 having records
    Y
    N
    N
    Y
    Y
    N
    and i query the table like
    select * from t1 where c1 = 'Y'
    How bit map index functions?
    thanks,
    Vinodh

    I think you should check the google's new feature to explore -> [How bitmap Index Works|http://www.google.co.in/search?hl=en&rlz=1G1GGLQ_ENIN333&q=how+bitmap+index+works&meta=&aq=0&oq=how+bitma]
    Regards.
    Satyaki De.

Maybe you are looking for

  • Default value for choice list in af:query panel

    Hi all, I have af:queryPanel in which i made one choicelist with static list.i want to have the first value of the static list as a default value to the field in af:queryPanel.how can i achieve this. I am using jdev11.1.1.5 Thanks in advance

  • Running out of handles in LabVIEW 7.1

    Hi, I'm having a problem with a LabVIEW 7.1 application running on Linux (2.6.12). About once a week the application crashes locking up the entire system. While reproducing the problem at the office, it looked like the application ran out of handles.

  • Daemon Threads: Can you explain this behaviour

    Hey All, Please refer to code segment given below. As per the defination of Daemon threads it should terminate when all other user threads die. In this case it should terminate when main thread ends as thread2 has not been initiated yet. The result i

  • API to create Descriptive Elements with Catalogs

    We need to add new descriptive elements on Item Catalogs programmatically. Could someone please guide with appropriate API`s or any other loader process. Also please note this is not assigning values for descriptive elements under items. This is only

  • JSF 2 resources folder for js and css files

    Hello, Could I change somehow default 'resources' folder for h:outputStylesheet and h:outputScript tags