<?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: Problem with table-indexes when using select-options in select in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950106#M1335977</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sorry i was not precise:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to analyze how the statement is executed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one needs the sql statement as it is send to the database (from ST05) and the database specific execution plan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Jul 2009 14:26:17 GMT</pubDate>
    <dc:creator>HermannGahm</dc:creator>
    <dc:date>2009-07-28T14:26:17Z</dc:date>
    <item>
      <title>Problem with table-indexes when using select-options in select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950103#M1335974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is it right that table-indexes will not be used if you take select-options to select data from the database?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in detail:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have build up an table-index for one of our db-tables and test it via an test-programm. The first test with '=' comparisons worked fine. Every key of the index was used; checked via ST05!&lt;/P&gt;&lt;P&gt;e.g.:    SELECT * FROM TABLEA INTO ITAB WHERE keya = '1' AND keyb = '2' AND keyc = '3'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i startet the test with select-options&lt;/P&gt;&lt;P&gt;e.g.:   SELECT * FROM TABLEA INTO ITAB WHERE keya IN seltabA  AND keyb IN seltabB AND keyc IN seltabC.&lt;/P&gt;&lt;P&gt;First of all i just filled the seltabs with only 1 value:    eg:  seltabA=      SIGN = 'I'   OPTION = 'EQ'   LOW = '1'     etc.&lt;/P&gt;&lt;P&gt;Everything worked fine. Every key of the index was used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But now, I putted more than one entries in the seltabs e.g.&lt;/P&gt;&lt;P&gt;seltabA:      SIGN = 'I'   OPTION = 'EQ'   LOW = '1'&lt;/P&gt;&lt;P&gt;                   SIGN = 'I'   OPTION = 'EQ'   LOW = '2'    &lt;/P&gt;&lt;P&gt;                   SIGN = 'I'   OPTION = 'EQ'   LOW = '3'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From now on, the indexed was not used completely (with all keys).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Isn't that strange? How can i use select-options or sel-ranges with using the complete table-indexes?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marcel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2009 13:54:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950103#M1335974</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-28T13:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with table-indexes when using select-options in select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950104#M1335975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; From now on, the indexed was not used completely (with all keys).&lt;/P&gt;&lt;P&gt;&amp;gt; Isn't that strange? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you post the complete sql statement and execution plan, please? &lt;/P&gt;&lt;P&gt;We could give you more details then how your condition is mapped to the index&lt;/P&gt;&lt;P&gt;and how the query is executed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2009 14:04:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950104#M1335975</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2009-07-28T14:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with table-indexes when using select-options in select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950105#M1335976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Hermann,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your answer! Unfortunately these db-tables are custom-created one. I can't imagine that the sql-statement alone could help to analyze this problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here the select-statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   SELECT * FROM /dbcond/01_cond AS dbcond&lt;/P&gt;&lt;P&gt;                   INTO CORRESPONDING FIELDS OF TABLE it_alv_frei&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                  WHERE lifnr       = '0044100226'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                  AND orgid         = '00000040'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                  AND koart_basis   = '1200'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                  AND status        =  '11'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                  AND aenam         IN r_aenam&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;                   WHERE lifnr       IN r_lifnr&lt;/P&gt;&lt;P&gt;                   AND orgid         IN r_orgs&lt;/P&gt;&lt;P&gt;                   AND koart_basis   IN r_koart&lt;/P&gt;&lt;P&gt;                   AND status        IN r_status&lt;/P&gt;&lt;P&gt;                   AND aenam         IN r_aenam&lt;/P&gt;&lt;P&gt;                   AND gewaehr_kowid &amp;lt; 1&lt;/P&gt;&lt;P&gt;                   AND ( status = 00 OR status = 11 OR status = 12 ).&lt;/P&gt;&lt;P&gt;The inactive-variant worked fine (deactivated now with an *); the active one worked fine when there is just one entry in the select-options:&lt;/P&gt;&lt;P&gt;exmaple how to fill r_lifnr.&lt;/P&gt;&lt;P&gt;PERFORM check_lifnr.&lt;/P&gt;&lt;P&gt;        SELECT DISTINCT lifnr  FROM lfa1&lt;/P&gt;&lt;P&gt;        INTO gl_lifnr&lt;/P&gt;&lt;P&gt;        WHERE ktokk IN rs_lifnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          IF NOT gl_lifnr IS INITIAL.&lt;/P&gt;&lt;P&gt;            r_lifnr-low   = gl_lifnr.&lt;/P&gt;&lt;P&gt;            r_lifnr-sign   = 'I'.&lt;/P&gt;&lt;P&gt;            r_lifnr-option = 'EQ'.&lt;/P&gt;&lt;P&gt;            APPEND r_lifnr TO r_lifnr.&lt;/P&gt;&lt;P&gt;          ENDIF.&lt;/P&gt;&lt;P&gt;        ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if i have more than one entries in one of the ranges, the table-index is not useg completely.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marcel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2009 14:22:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950105#M1335976</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-28T14:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with table-indexes when using select-options in select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950106#M1335977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sorry i was not precise:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to analyze how the statement is executed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one needs the sql statement as it is send to the database (from ST05) and the database specific execution plan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2009 14:26:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950106#M1335977</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2009-07-28T14:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with table-indexes when using select-options in select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950107#M1335978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hermann,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i hope this helps:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is the first one, which uses the complete index:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT                                                                      
  "KOWID" , "LIFNR" , "KLPOS" , "ORGID" , "KOART" , "MATNR" , "GLTVON" ,    
  "GLTBIS" , "WERT" , "ABLIF" , "FAKIV" , "AENAM" , "AEDAT" , "AFORM" ,     
  "HERSTELLER" , "ARTGRP" , "OE_FREITXT" , "ARTFREITEXT" , "STATUS" ,       
  "TERDAT"                                                                  
FROM                                                                        
  "/dbcon/01_con"                                                        
WHERE                                                                       
  "MANDT" = ? AND "LIFNR" = ? AND "ORGID" = ? AND "KOART_BASIS" = ? AND     
  "STATUS" = ? AND "GEWAEHR_KOWID" &amp;lt; ? AND ( "STATUS" = ? OR "STATUS" = ? OR
  "STATUS" = ? )  WITH UR                  

RESULT: 5 IXSCAN /dbcon/01_con05 #key columns:  4 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the second one, which does not use the complete index! The 3 ranges are filled each with 2 values. Remember; when i fill them each with only one value, the result is the same as you can see above(/dbcon/01_con05 #key columns:  4):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT                                                                      
  "KOWID" , "LIFNR" , "KLPOS" , "ORGID" , "KOART" , "MATNR" , "GLTVON" ,    
  "GLTBIS" , "WERT" , "ABLIF" , "FAKIV" , "AENAM" , "AEDAT" , "AFORM" ,     
  "HERSTELLER" , "ARTGRP" , "OE_FREITXT" , "ARTFREITEXT" , "STATUS" ,       
  "TERDAT"                                                                  
FROM                                                                        
  "/dbcon/01_con"                                                        
WHERE                                                                       
  "MANDT" = ? AND "LIFNR" IN ( ? , ? ) AND "ORGID" IN ( ? , ? ) AND         
  "KOART_BASIS" IN ( ? , ? ) AND "GEWAEHR_KOWID" &amp;lt; ? AND ( "STATUS" = ? OR  
  "STATUS" = ? OR "STATUS" = ? )  WITH UR                                   
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and here the access-plan&lt;/P&gt;&lt;P&gt;                                                                      &lt;/P&gt;&lt;P&gt;   0 SELECT STATEMENT ( Estimated Costs =  5,139E+01 [timerons] )                                                                                &lt;/P&gt;&lt;P&gt;5     1 RETURN                                                                                &lt;/P&gt;&lt;P&gt;5     2 NLJOIN                                                                                &lt;/P&gt;&lt;P&gt;5     3 [O] TBSCAN                                                                                &lt;/P&gt;&lt;P&gt;5     4 SORT                                                                                &lt;/P&gt;&lt;P&gt;5 TBSCAN GENROW                                                                                &lt;/P&gt;&lt;P&gt;5     6 &amp;lt;i&amp;gt; FETCH /dbcon/01_con                                                                                &lt;/P&gt;&lt;P&gt;7 IXSCAN /dbcon/01_con05 #key columns:  2    &lt;/P&gt;&lt;P&gt;                                                                      &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see, only 2 keys were taken for indexed selection!&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;MArcel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Marcel Ebert on Jul 28, 2009 5:25 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2009 15:25:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950107#M1335978</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-28T15:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with table-indexes when using select-options in select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950108#M1335979</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;i made it a little bit mor readable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; SELECT ... FROM "/dbcon/01_con" WHERE "MANDT" = ? AND "LIFNR" = ? AND "ORGID" = ? AND "KOART_BASIS" = ? AND "STATUS" = ? AND "GEWAEHR_KOWID" &amp;lt; ? AND ( "STATUS" = ? OR "STATUS" = ? OR "STATUS" = ? ) WITH UR RESULT: 

5 IXSCAN /dbcon/01_con05 #key columns: 4 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; SELECT "... FROM "/dbcon/01_con" WHERE "MANDT" = ? AND "LIFNR" IN ( ? , ? ) AND "ORGID" IN ( ? , ? ) AND "KOART_BASIS" IN ( ? , ? ) AND "GEWAEHR_KOWID" &amp;lt; ? AND ( "STATUS" = ? OR "STATUS" = ? OR "STATUS" = ? ) WITH UR 

0 SELECT STATEMENT ( Estimated Costs = 5,139E+01 [timerons] ) 5 
1 RETURN 5 
2 NLJOIN 5 
3 [O] TBSCAN 5 
4 SORT 
5 TBSCAN GENROW 5 
6 &amp;lt;i&amp;gt; FETCH /dbcon/01_con 
7 IXSCAN /dbcon/01_con05 
#key columns: 2 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ok, this is DB2 for LUW (DB6). If oyu mark the IXSCAN and click the details button in the left top corner,&lt;/P&gt;&lt;P&gt;you can see the details for this step. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your index is MANDT, LIFNR, ORGID, KOART_BASIS? This 4 columns?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like two of the inlists are used seargable only. Which doesn't necessarily mean a bad thing.&lt;/P&gt;&lt;P&gt;I don't know the "rules" when this happens.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you compare the time per record needed in ST05 for both statements, is there a big difference?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2009 15:51:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950108#M1335979</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2009-07-28T15:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with table-indexes when using select-options in select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950109#M1335980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Hermann,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sorry to be a bit late! Thanks alot your your very helpful answers! We decided to take it as it is!&lt;/P&gt;&lt;P&gt;After rebuilding the index we do not  have any performance-problems anymore, although the index does not use all of the key-columns in some cases!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will close now the thread!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marcel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Jul 2009 06:48:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950109#M1335980</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-31T06:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with table-indexes when using select-options in select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950110#M1335981</link>
      <description>&lt;P&gt;I have the same question as SAP documentation of the select statement says as a NOTE ..at the bottom. that relational operators that are not "=" will not be utilized for an index.. in other words any statement compare using = will be used for index selection until a non = is encountered and any subsquent conditions will be ignored as pertaining to index selection and utilization...  SAP..  am i reading this correctly?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 01:37:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-table-indexes-when-using-select-options-in-select/m-p/5950110#M1335981</guid>
      <dc:creator>dflintstud1</dc:creator>
      <dc:date>2020-02-07T01:37:22Z</dc:date>
    </item>
  </channel>
</rss>

