<?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 SELECT statement takes long time in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-takes-long-time/m-p/3487111#M838395</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the following code, if the T_QMIH-EQUNR contains blank or space values ,SELECT statement takes longer time to acess the data from OBJK table. If it T_QMIH-EQUNR contains values other than blank, performance is good and it fetches data very fast.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Already we have indexes for EQUNR in OBJK table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only for blank entries , it takes much time.Can anybody tell why it behaves for balnk entries?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not T_QMIH[] IS INITIAL.&lt;/P&gt;&lt;P&gt;        SORT T_QMIH BY EQUNR.&lt;/P&gt;&lt;P&gt;        REFRESH T_OBJK.&lt;/P&gt;&lt;P&gt;        SELECT EQUNR OBKNR&lt;/P&gt;&lt;P&gt;          FROM OBJK INTO TABLE T_OBJK&lt;/P&gt;&lt;P&gt;          FOR ALL ENTRIES IN T_QMIH&lt;/P&gt;&lt;P&gt;          WHERE OBJK~TASER = 'SER01' AND&lt;/P&gt;&lt;P&gt;         OBJK~EQUNR = T_QMIH-EQUNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ajay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Mar 2008 10:51:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-12T10:51:09Z</dc:date>
    <item>
      <title>SELECT statement takes long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-takes-long-time/m-p/3487111#M838395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the following code, if the T_QMIH-EQUNR contains blank or space values ,SELECT statement takes longer time to acess the data from OBJK table. If it T_QMIH-EQUNR contains values other than blank, performance is good and it fetches data very fast.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Already we have indexes for EQUNR in OBJK table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only for blank entries , it takes much time.Can anybody tell why it behaves for balnk entries?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not T_QMIH[] IS INITIAL.&lt;/P&gt;&lt;P&gt;        SORT T_QMIH BY EQUNR.&lt;/P&gt;&lt;P&gt;        REFRESH T_OBJK.&lt;/P&gt;&lt;P&gt;        SELECT EQUNR OBKNR&lt;/P&gt;&lt;P&gt;          FROM OBJK INTO TABLE T_OBJK&lt;/P&gt;&lt;P&gt;          FOR ALL ENTRIES IN T_QMIH&lt;/P&gt;&lt;P&gt;          WHERE OBJK~TASER = 'SER01' AND&lt;/P&gt;&lt;P&gt;         OBJK~EQUNR = T_QMIH-EQUNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ajay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 10:51:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-takes-long-time/m-p/3487111#M838395</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T10:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT statement takes long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-takes-long-time/m-p/3487112#M838396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in select if u use primary key like in objk table OBKNR, OBZAE then it will improve performance in select statement&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 10:55:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-takes-long-time/m-p/3487112#M838396</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T10:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT statement takes long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-takes-long-time/m-p/3487113#M838397</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;&lt;/P&gt;&lt;P&gt;You can use the field QMIH-QMNUM with OBJK-IHNUM &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in QMIH table, EQUNR is not primary key, it will have multiple entries&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so to improve the performance use one dummy internal table for QMIH  and sort it on EQUNR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from d_qmih and use the same in for all entries &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will improve the performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also use the fields in sequence of the index and primary keys also in select&lt;/P&gt;&lt;P&gt;if not T_QMIH[] IS INITIAL.&lt;/P&gt;&lt;P&gt; SORT T_QMIH BY EQUNR.&lt;/P&gt;&lt;P&gt;REFRESH T_OBJK.&lt;/P&gt;&lt;P&gt;SELECT EQUNR OBKNR&lt;/P&gt;&lt;P&gt;FROM OBJK INTO TABLE T_OBJK&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN T_QMIH&lt;/P&gt;&lt;P&gt;WHERE  IHNUM =  T_QMIH-QMNUM&lt;/P&gt;&lt;P&gt;OBJK~TASER = 'SER01' AND&lt;/P&gt;&lt;P&gt;OBJK~EQUNR = T_QMIH-EQUNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this and let me know&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 10:56:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-takes-long-time/m-p/3487113#M838397</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T10:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT statement takes long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-takes-long-time/m-p/3487114#M838398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The number of entries with the blank value might be huge. To get rid of this better follow the below approach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Better you retrieve all the data into single internal table then segregate internal table data based on blank entries and non blank entries. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps to improve performance.......&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 10:59:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-takes-long-time/m-p/3487114#M838398</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T10:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT statement takes long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-takes-long-time/m-p/3487115#M838399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ajay &lt;/P&gt;&lt;P&gt;As u have used EQUNR in the where condition, for blank values it selects all the values where EQUNR is blank. so it will surely take time to execute. The only thing u can do is add some more fields in where condition from that table if possible. Or u have to avoid blank entries and write a seperate coding for selecting blank values alone and append it to ur internal table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 11:02:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-takes-long-time/m-p/3487115#M838399</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T11:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT statement takes long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-takes-long-time/m-p/3487116#M838400</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;use all the keys  possibe in the select statement and use binary search in the sort statement . then u will get the best performance . this u can check in the tcode  st05.  use  this  select statement  in the st05 and watch it first and give all the keys possibel then observe  , u will find out the performance.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;venkat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 11:07:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-takes-long-time/m-p/3487116#M838400</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T11:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT statement takes long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-takes-long-time/m-p/3487117#M838401</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;Thanks. I have hardcoded for TASER. I am not supposed to Modify the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For huge volume of Non Blank Entries, It takes lesser time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only for Blank Entries, It takes a lot time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;aJAY&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 11:13:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-takes-long-time/m-p/3487117#M838401</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T11:13:02Z</dc:date>
    </item>
  </channel>
</rss>

