<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: indexes in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881474#M676730</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi hema,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We cannot select records from database table using index.&lt;/P&gt;&lt;P&gt;We can select records by using &amp;lt;b&amp;gt;upto n rows addition&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls reward if useful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Sep 2007 06:03:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-26T06:03:17Z</dc:date>
    <item>
      <title>indexes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881470#M676726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone give me an example how to use indexes in select statement in where condition?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Hema&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2007 05:56:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881470#M676726</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-26T05:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: indexes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881471#M676727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;see this example&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF LINE,&lt;/P&gt;&lt;P&gt;COL1 TYPE I,&lt;/P&gt;&lt;P&gt;COL2 TYPE I,&lt;/P&gt;&lt;P&gt;END OF LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ITAB LIKE TABLE OF LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO 2 TIMES.&lt;/P&gt;&lt;P&gt;  LINE-COL1 = SY-INDEX.&lt;/P&gt;&lt;P&gt;  LINE-COL2 = SY-INDEX ** 2.&lt;/P&gt;&lt;P&gt;  APPEND LINE TO ITAB.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LINE-COL1 = 11. LINE-COL2 = 22.&lt;/P&gt;&lt;P&gt;INSERT LINE INTO ITAB INDEX 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERT INITIAL LINE INTO ITAB INDEX 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB INTO LINE.&lt;/P&gt;&lt;P&gt;  WRITE: / SY-TABIX, LINE-COL1, LINE-COL2.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;follow this link for more info.&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3612358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3612358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds,&lt;/P&gt;&lt;P&gt;bharat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2007 06:01:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881471#M676727</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-26T06:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: indexes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881472#M676728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;go through this code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Examples:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%_HINTS ORACLE 'INDEX("&amp;amp;TABLE&amp;amp;"BTCV~I00")'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%_HINTS ORACLE 'ORDERED INDEX("&amp;amp;TABLE 1&amp;amp;","COVA~I03")'&lt;/P&gt;&lt;P&gt;ORACLE 'FIRST_ROWS'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%_HINTS ORACLE 'FIRST_ROWS INDEX("&amp;amp;TABLE 2&amp;amp;",COVA~I03")'&lt;/P&gt;&lt;P&gt;ORACLE 'ORDERED'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table names are faked here; should give you the direction. Google for "oracle hints", specify in the WHERE clause as rhis:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * UP TO 10 ROWS FROM csks&lt;/P&gt;&lt;P&gt;WHERE kokrs &amp;lt;&amp;gt; space AND &lt;/P&gt;&lt;P&gt;kostl &amp;lt;&amp;gt; space&lt;/P&gt;&lt;P&gt;%_HINTS ORACLE 'index(csks"J")'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2007 06:01:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881472#M676728</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-26T06:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: indexes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881473#M676729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is your SELECT statement with INDEX usage -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT bukrs hkont gjahr belnr buzei&lt;/P&gt;&lt;P&gt;monat dmbtr kostl prctr xref3 shkzg budat bldat&lt;/P&gt;&lt;P&gt;FROM bsis&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE itab&lt;/P&gt;&lt;P&gt;WHERE bukrs IN bukrs&lt;/P&gt;&lt;P&gt;AND hkont IN hkont&lt;/P&gt;&lt;P&gt;AND gjahr EQ gjahr&lt;/P&gt;&lt;P&gt;AND monat EQ monat&lt;/P&gt;&lt;P&gt;AND prctr IN prctr&lt;/P&gt;&lt;P&gt;AND kostl IN s_kostl&lt;/P&gt;&lt;P&gt;%_hints oracle 'INDEX("BSIS~ZXX")'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where ZXX is a custom index in BSIS. You can mention appropriate index name here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2007 06:02:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881473#M676729</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-26T06:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: indexes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881474#M676730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi hema,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We cannot select records from database table using index.&lt;/P&gt;&lt;P&gt;We can select records by using &amp;lt;b&amp;gt;upto n rows addition&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls reward if useful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2007 06:03:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881474#M676730</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-26T06:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: indexes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881475#M676731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hema,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Same as how we will mention the other fields in the where clause.The thing is that it is always advisable to use either primary key fields or index fields in the where clause of a select statement to enhance performance.&lt;/P&gt;&lt;P&gt;Suppose there is a table say bkpf.&lt;/P&gt;&lt;P&gt;if it having an indexes a,b,c.&lt;/P&gt;&lt;P&gt;we can use only fields from one index in the where clause.We can't take a field from index a and another field from index b at the same time in a where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2007 06:04:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881475#M676731</guid>
      <dc:creator>kiran_k8</dc:creator>
      <dc:date>2007-09-26T06:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: indexes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881476#M676732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;whenever u r using non primary key fields in where condition of a select staement u have to create secondary indexes for that fields in se11&lt;/P&gt;&lt;P&gt;optimizer will assign the indexes &lt;/P&gt;&lt;P&gt;user has nothing to do with that&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;just write a simple select statement using non primary key fields in where condition&lt;/P&gt;&lt;P&gt;without secondary indexes it wont fetch data once u craete index for particular fields of select statement it will fetch data&lt;/P&gt;&lt;P&gt;reward for use ful points&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Nagesh.Paruchuri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2007 06:09:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881476#M676732</guid>
      <dc:creator>paruchuri_nagesh</dc:creator>
      <dc:date>2007-09-26T06:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: indexes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881477#M676733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I use indexes while joining 2 tables?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2007 06:27:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881477#M676733</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-26T06:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: indexes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881478#M676734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hI &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When a base table has multiple indices, the where clause should be in the order of the index, either a primary or a secondary index. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To choose an index, the optimizer checks the field names specified in the where clause and then uses an index that has the same order of the fields . In certain scenarios, it is advisable to check whether a new index can speed up the performance of a program. This will come handy in programs that access data from the finance tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;indexes&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;INDEXES help to speed up selection from the database. The primary index is always created automatically in the SAP System. It consists of the primary key fields of the database table. If you cannot use the primary index to determine a selection result (for example, WHERE condition may not contain any primary index fields), you can create a secondary index. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use Select Single if all primary key fields are supplied in the Where condition .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If all primary key fields are supplied in the Where condition you can even use Select Single.  Select Single requires one communication with the database system, whereas Select-Endselect needs two.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To read data from several logically connected tables use a join instead of nested Select statements. Joins are preferred only if all the primary key are available in WHERE clause for the tables that are joined. If the primary keys are not provided in join the Joining of tables itself takes time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM EKKO INTO EKKO_WA.&lt;/P&gt;&lt;P&gt;  SELECT * FROM EKAN INTO EKAN_WA&lt;/P&gt;&lt;P&gt;      WHERE EBELN = EKKO_WA-EBELN.&lt;/P&gt;&lt;P&gt;  ENDSELECT.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;The above code can be much more optimized by the code written below.&lt;/P&gt;&lt;P&gt;SELECT P&lt;SUB&gt;F1 P&lt;/SUB&gt;F2 F&lt;SUB&gt;F3 F&lt;/SUB&gt;F4 INTO TABLE ITAB&lt;/P&gt;&lt;P&gt;    FROM EKKO AS P INNER JOIN EKAN AS F&lt;/P&gt;&lt;P&gt;      ON P&lt;SUB&gt;EBELN = F&lt;/SUB&gt;EBELN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;reward if usefull&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2007 06:31:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881478#M676734</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-26T06:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: indexes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881479#M676735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;hema&lt;/P&gt;&lt;P&gt;plz go through this&lt;/P&gt;&lt;P&gt;Indexes - What are they and how can I use them? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An index helps to speed up selection from the database. An index is a sorted copy of selected database table fields. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, you should not define an index for all possible fields in the WHERE condition. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Creating a secondary index &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the transaction ABAP Dictionary Change &amp;amp;#8594; Indexes... &amp;amp;#8594; Create to create an index. To make the index unique, select UNIQUE. To specify the fields that will comprise the index, choose "Choose fields". Then save and activate the index. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When to create an index &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is worth creating a secondary index when: &lt;/P&gt;&lt;P&gt;You want to select table entries based on fields that are not contained in an index, and the response times are very slow. &lt;/P&gt;&lt;P&gt;The EXPLAIN function in the SQL trace shows which index the system is using. You can generate a list of the database queries involved in an action by entering Transaction ST05 and choosing Trace on &amp;amp;#8594; Execute action &amp;amp;#8594; Trace off &amp;amp;#8594; List trace. If you execute the EXPLAIN SQL function on a EXEC, REEXEC, OPEN, REOPEN or PREPARE statement, the system returns a list containing the index used in the database query. &lt;/P&gt;&lt;P&gt;The field or fields of the new secondary index are so selective that each index entry corresponds to at most 5% of the total number of table entries. Otherwise, it is not worth creating the index. &lt;/P&gt;&lt;P&gt;The database table is accessed mainly for reading entries. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward for useful replies&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Nagesh.Paruchuri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2007 06:33:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/indexes/m-p/2881479#M676735</guid>
      <dc:creator>paruchuri_nagesh</dc:creator>
      <dc:date>2007-09-26T06:33:01Z</dc:date>
    </item>
  </channel>
</rss>

