<?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: Select Query Taking Long time in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562291#M1754340</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-align: justify; background-color: #ffffff; font-family: Arial; color: #000000;"&gt;1) While using FOR ALL ENTRIES you need to ensure that there exists atleast one row in internal table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-align: justify; background-color: #ffffff; font-family: Arial; color: #000000;"&gt;It may be possible that in the past , the same internal table might get filled with rows and for now due to some exceptions, it remains empty.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-align: justify; background-color: #ffffff; font-family: Arial; color: #000000;"&gt;2) Compute statistcs of the database tables and indexes involved in the query. If your optimization mode is cost-based, then it may well depend on your statistical data of tables and indexes.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-align: justify; background-color: #ffffff; font-family: Arial; color: #000000;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-align: justify; background-color: #ffffff; font-family: Arial; color: #000000;"&gt;Vishram&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Jul 2013 08:40:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2013-07-02T08:40:50Z</dc:date>
    <item>
      <title>Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562285#M1754334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;We have query which is inner join of two tables with for all entries, The query takes long time to run and its almost stuck nothing really happens. This has been running in past successfully. Below is the query:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a~opsl_gl_sys_no INTO CORRESPONDING FIELDS OF TABLE it_sysno&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM oiuh_rv_opsl AS a&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INNER JOIN oiuh_rv_gl AS b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ON a~opsl_gl_sys_no = b~gl_gl_sys_no&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FOR ALL ENTRIES IN it_selection_fields&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE a~opsl_own_no = it_selection_fields-owner_no&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND a~opsl_own_seq_no = it_selection_fields-owner_seq_no&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND b~gl_pd_cd = it_selection_fields-product_code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND b~gl_or_lvl_1_no = ls_company_org1-org_level1_no&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND b~gl_sa_dt &amp;gt;= d_min_time &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND b~gl_sa_dt &amp;lt; d_max_time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If we query the View with same conditions in se16, we get the desired results. But the ABAP code takes lot of time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Pinto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Jul 2013 17:50:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562285#M1754334</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-01T17:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562286#M1754335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How is it_selection_fields filled? If it's by a selection before this bit of code, then including that in your inner join may well improve things. (Inner joins are usually better than FAE).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What are the fields of the available indexes on oiuh_rv_opsl and oiuh_rv_gl?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Run this program with an SQL trace on it (ST05). Then trace SE16 on the view. Compare the execution paths (or post them here, if you have difficult understanding them).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 06:04:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562286#M1754335</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2013-07-02T06:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562287#M1754336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pinto,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before the FAE &lt;SPAN style="color: #333333; font-size: 12px;"&gt;put initial check on &lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;it_selection_fields. More over put the query in ST04 and analyse whether you can leverage any index or not as sugg. by Matthew.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;BR.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 06:12:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562287#M1754336</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-02T06:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562288#M1754337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try to run the query by removing&amp;nbsp; INTO CORRESPONDING FIELDS OF TABLE it_sysno instead use 'INTO TABLE it_sysno'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 06:54:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562288#M1754337</guid>
      <dc:creator>former_member196490</dc:creator>
      <dc:date>2013-07-02T06:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562289#M1754338</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;As per the suggestion from Matthew, try to check if the index is available in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Arial; text-align: justify; background-color: #ffffff;"&gt;Use “SELECT INTO TABLE” rather than “SELECT INTO CORRESPONDING FIELDS OF TABLE”&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Arial; text-align: justify; background-color: #ffffff;"&gt;CHECK that the internal table used in FOR ALL ENTRIES is NOT empty as this will retrieve all entries from the table&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanga Prakash T&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 07:18:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562289#M1754338</guid>
      <dc:creator>ThangaPrakash</dc:creator>
      <dc:date>2013-07-02T07:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562290#M1754339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the query was running successfully in the past and failing now ...may be it_selection_fields has huge number of entries, why don't you use the same join statements on some limited number of entries to check the query basic functioning.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 07:33:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562290#M1754339</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-02T07:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562291#M1754340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-align: justify; background-color: #ffffff; font-family: Arial; color: #000000;"&gt;1) While using FOR ALL ENTRIES you need to ensure that there exists atleast one row in internal table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-align: justify; background-color: #ffffff; font-family: Arial; color: #000000;"&gt;It may be possible that in the past , the same internal table might get filled with rows and for now due to some exceptions, it remains empty.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-align: justify; background-color: #ffffff; font-family: Arial; color: #000000;"&gt;2) Compute statistcs of the database tables and indexes involved in the query. If your optimization mode is cost-based, then it may well depend on your statistical data of tables and indexes.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-align: justify; background-color: #ffffff; font-family: Arial; color: #000000;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-align: justify; background-color: #ffffff; font-family: Arial; color: #000000;"&gt;Vishram&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 08:40:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562291#M1754340</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-02T08:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562292#M1754341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;Matthew Billingham wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Inner joins are usually better than FAE).&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;But many people say and teach othewise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 12:21:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562292#M1754341</guid>
      <dc:creator>former_member191562</dc:creator>
      <dc:date>2013-07-02T12:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562293#M1754342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes they do. And they are wrong. This has been discussed &lt;EM&gt;many&lt;/EM&gt; times on this site, and if I see someone saying that FAE is better than INNER JOIN, their post will be rejected. "FAE better than INNER JOIN" is a myth. It isn't true. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 12:55:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562293#M1754342</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2013-07-02T12:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562294#M1754343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;Neha Sinha wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to run the query by removing&amp;nbsp; INTO CORRESPONDING FIELDS OF TABLE it_sysno instead use 'INTO TABLE it_sysno'&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;There is no essential difference in performance. This is another myth, discussed many times on this site.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Evidence here: &lt;A href="https://scn.sap.com/thread/1714070"&gt;https://scn.sap.com/thread/1714070 &lt;/A&gt;and especially here &lt;A _jive_internal="true" href="https://answers.sap.com/docs/DOC-33976"&gt;http://scn.sap.com/docs/DOC-33976&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 12:56:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562294#M1754343</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2013-07-02T12:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562295#M1754344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;Thanga Prakash wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Arial; text-align: justify; background-color: #ffffff;"&gt;Use “SELECT INTO TABLE” rather than “SELECT INTO CORRESPONDING FIELDS OF TABLE”&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanga Prakash T&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;No, don't. It makes no essential difference to the performance and is more error prone.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Evidence here: &lt;A href="https://scn.sap.com/thread/1714070"&gt;https://scn.sap.com/thread/1714070 &lt;/A&gt;and especially here: &lt;A _jive_internal="true" href="https://answers.sap.com/docs/DOC-33976"&gt;http://scn.sap.com/docs/DOC-33976&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 12:58:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562295#M1754344</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2013-07-02T12:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562296#M1754345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;There is only record in the it_selection_fields internal table, If you directly query the corresponding view there are only 391 records in the database. But still in the code when it encounters this block it gets stuck for long time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAP did some analysis and came back to us saying that OIUH_RV_OPSL statistics has been locked, Can anyone elaborate on this. Can this could be reason for the delay.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Pinto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 15:03:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562296#M1754345</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-02T15:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562297#M1754346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's something to ask your Basis team. Or over in one of the Netweaver spaces.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jul 2013 04:46:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562297#M1754346</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2013-07-03T04:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562298#M1754347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pinto,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your SELECT can be done with database view V_OIUCWOPSL_GL. But you should notice that view field names differ from database table field names (OIUH_RV_GL-GL_SA_DT = V_OIUCWOPSL_GL-SA_DT, ...).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should change your code to view access. But I don't think this will fasten your program. Maybe you have a missing index on database or something like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make a SQL trace of a program run to see the indexes used and post this trace.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Klaus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jul 2013 05:15:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562298#M1754347</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-03T05:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562299#M1754348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Klaus,&lt;/P&gt;&lt;P&gt;This code has been running successfully from past so many years, This query is&amp;nbsp; trying to fetch only for for only owner which has just 391 records. We are just not bale to find the reason, Same query runs successfully in the test env. Are there any basis parameters that i need specifically look for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Pinto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jul 2013 07:42:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562299#M1754348</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-03T07:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562300#M1754349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pinto,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with the growth of database tables all queries without matching database indexes will slow down, if the query causes a &lt;STRONG&gt;full table scan&lt;/STRONG&gt; for fetching the chosen data. In test env you will have less data in both database tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please make a sql trace and show it to us. I think you will find a full table scan on database table &lt;EM&gt;oiuh_rv_gl &lt;/EM&gt;then. This might show us a missing index for the fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;gl_pd_cd &lt;/LI&gt;&lt;LI&gt;gl_or_lvl_1&lt;/LI&gt;&lt;LI&gt;gl_sa_dt&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Klaus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jul 2013 05:14:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562300#M1754349</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-04T05:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562301#M1754350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Klaus.&lt;/P&gt;&lt;P&gt;Find the trace :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD valign="top" width="49%"&gt;&lt;OL style="list-style-type: decimal-leading-zero;"&gt;&lt;LI&gt;&lt;SPAN class="urtxtemphurvt1"&gt;01.07.2013 - 22:31:22 CET - Info for SAP by Thiago Cavalheiro&lt;/SPAN&gt; &lt;/LI&gt;&lt;/OL&gt;&lt;/TD&gt;&lt;TD rowspan="2" valign="top" width="2%"&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;/TD&gt;&lt;TD rowspan="2" valign="top" width="49%"&gt;&lt;P&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD valign="top" width="49%"&gt;&lt;P&gt;_fix_control (7168184) add with value "7168184:OFF"&lt;BR /&gt; _fix_control (13077335) add with value "13077335:ON"&lt;BR /&gt; _fix_control (6120483) add with value "6120483:OFF"&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; ________________________________________________________________________SQL Statement&lt;BR /&gt; &lt;BR /&gt; SELECT&lt;BR /&gt; T_00."OPSL_GL_SYS_NO"&lt;BR /&gt; FROM&lt;BR /&gt; "OIUH_RV_OPSL" T_00 INNER JOIN "OIUH_RV_GL" T_01 ON T_01."MANDT"=:A0&lt;BR /&gt; AND T_00."OPSL_GL_SYS_NO"=T_0&lt;BR /&gt; 1."GL_GL_SYS_NO"&lt;BR /&gt; WHERE&lt;BR /&gt; T_00."MANDT"=:A1 AND T_00."OPSL_OWN_NO"=:A2 AND T_00.&lt;BR /&gt; "OPSL_OWN_SEQ_NO"=:A3 AND T_01."GL_PD_CD"=&lt;BR /&gt; :A4 AND T_01."GL_OR_LVL_1_NO"=:A5 AND T_01."GL_SA_DT"&amp;gt;=:A6 AND T_01.&lt;BR /&gt; "GL_SA_DT"&amp;lt;:A7&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; Execution Plan&lt;BR /&gt; &lt;BR /&gt; Explain from gv$sql_plan: Address: 00000008FB8F4FF0 Hash_value:&lt;BR /&gt; 1863233137 Child_number: 0 Instance_ID: 1&lt;BR /&gt; Sql_id: 8zxj1y1rhxbmj Parse Timestamp: 20130627 11:37:49&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; SELECT STATEMENT ( Estimated Costs = 1,422 , Estimated #Rows = 0 )&lt;BR /&gt; &lt;BR /&gt; 7 FILTER&lt;BR /&gt; Filter Predicates&lt;BR /&gt; &lt;BR /&gt; 6 NESTED LOOPS&lt;BR /&gt; &lt;BR /&gt; 4 NESTED LOOPS&lt;BR /&gt; ( Estim. Costs = 1,421 , Estim. #Rows = 1,826 )&lt;BR /&gt; Estim. CPU-Costs = 11,319,293 Estim. IO-Costs = 1,421&lt;BR /&gt; &lt;BR /&gt; 2 TABLE ACCESS BY INDEX ROWID OIUH_RV_OPSL&lt;BR /&gt; ( Estim. Costs = 325 , Estim. #Rows = 1,826 )&lt;BR /&gt; Estim. CPU-Costs = 2,508,660 Estim. IO-Costs = 325&lt;BR /&gt; 1 INDEX RANGE SCAN OIUH_RV_OPSL~I02&lt;BR /&gt; ( Estim. Costs = 2 , Estim. #Rows = 1,826 )&lt;BR /&gt; Search Columns: 3&lt;BR /&gt; Estim. CPU-Costs = 90,371 Estim. IO-Costs = 2&lt;BR /&gt; Access Predicates&lt;BR /&gt; &lt;BR /&gt; 3 INDEX UNIQUE SCAN OIUH_RV_GL~0&lt;BR /&gt; Search Columns: 2&lt;BR /&gt; Estim. CPU-Costs = 3,229 Estim. IO-Costs = 0&lt;BR /&gt; Access Predicates&lt;BR /&gt; &lt;BR /&gt; 5 TABLE ACCESS BY INDEX ROWID OIUH_RV_GL&lt;BR /&gt; ( Estim. Costs = 1 , Estim. #Rows = 1 )&lt;BR /&gt; Estim. CPU-Costs = 4,825 Estim. IO-Costs = 1&lt;BR /&gt; Filter Predicates&lt;BR /&gt; &lt;BR /&gt; Table OIUH_RV_OPSL&lt;BR /&gt; &lt;BR /&gt; Last statistics date 04/10/2013 05:46&lt;BR /&gt; Analyze Method Sample 451,491 Rows&lt;BR /&gt; Number of rows 150,497,000&lt;BR /&gt; Number of blocks allocated 4,156,342&lt;BR /&gt; Number of empty blocks 10,233&lt;BR /&gt; Average space 6,721&lt;BR /&gt; Chain count 0&lt;BR /&gt; Average row length 174&lt;BR /&gt; Partitioned NO&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; UNIQUE Index OIUH_RV_OPSL~0&lt;BR /&gt; &lt;BR /&gt; Column Name #Distinct&lt;BR /&gt; &lt;BR /&gt; MANDT 1&lt;BR /&gt; OPSL_GL_SYS_NO 150,497,000&lt;BR /&gt; &lt;BR /&gt; Last statistics date 06/12/2013 14:43&lt;BR /&gt; Analyze Method ple 150,923,118 Rows&lt;BR /&gt; Branch levels of B-Tree 3&lt;BR /&gt; Number of leaf blocks 358,434&lt;BR /&gt; Number of rows 150,923,118&lt;BR /&gt; Number of distinct keys 150,923,118&lt;BR /&gt; Average leaf blocks per key 1&lt;BR /&gt; Average data blocks per key 1&lt;BR /&gt; Clustering factor 47,142,511&lt;BR /&gt; Partitioned NO&lt;BR /&gt; Global stats NO&lt;BR /&gt; Compress Prefix length 1&lt;BR /&gt; LAST DDL Date 06/12/2013 20:13&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; NONUNIQUE Index OIUH_RV_OPSL~I02&lt;BR /&gt; &lt;BR /&gt; Column Name #Distinct&lt;BR /&gt; &lt;BR /&gt; MANDT 1&lt;BR /&gt; OPSL_OWN_NO 2,833&lt;BR /&gt; OPSL_OWN_SEQ_NO 100&lt;BR /&gt; OWN_INT_TYPE_CD 17&lt;BR /&gt; OWN_INT_SEQ_NO 48&lt;BR /&gt; OPSL_PAY_CD 3&lt;BR /&gt; &lt;BR /&gt; Last statistics date 06/12/2013 15:03&lt;BR /&gt; Analyze Method ple 150,923,118 Rows&lt;BR /&gt; Branch levels of B-Tree 3&lt;BR /&gt; Number of leaf blocks 695,499&lt;BR /&gt; Number of rows 150,923,118&lt;BR /&gt; Number of distinct keys 82,425&lt;BR /&gt; Average leaf blocks per key 8&lt;BR /&gt; Average data blocks per key 1,612&lt;BR /&gt; Clustering factor 132,942,499&lt;BR /&gt; Partitioned NO&lt;BR /&gt; Global stats NO&lt;BR /&gt; LAST DDL Date 06/12/2013 20:13&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; NONUNIQUE Index OIUH_RV_OPSL~Z01&lt;BR /&gt; &lt;BR /&gt; Column Name #Distinct&lt;BR /&gt; &lt;BR /&gt; MANDT 1&lt;BR /&gt; OPSL_GL_SYS_NO 150,497,000&lt;BR /&gt; OPSL_OWN_NO 2,833&lt;BR /&gt; OPSL_OWN_SEQ_NO 100&lt;BR /&gt; &lt;BR /&gt; Last statistics date 06/12/2013 15:17&lt;BR /&gt; Analyze Method ple 150,923,118 Rows&lt;BR /&gt; Branch levels of B-Tree 3&lt;BR /&gt; Number of leaf blocks 589,921&lt;BR /&gt; Number of rows 150,923,118&lt;BR /&gt; Number of distinct keys 150,923,118&lt;BR /&gt; Average leaf blocks per key 1&lt;BR /&gt; Average data blocks per key 1&lt;BR /&gt; Clustering factor 47,142,511&lt;BR /&gt; Partitioned NO&lt;BR /&gt; Global stats NO&lt;BR /&gt; Compress Prefix length 1&lt;BR /&gt; LAST DDL Date 06/12/2013 20:13&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; Table OIUH_RV_GL has around 1.2 bil rows.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jul 2013 05:52:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562301#M1754350</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-04T05:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Taking Long time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562302#M1754351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pinto,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first it seems you have a "bad" secondary index Z01 on table OIUH_RV_OPSL which contains the primary unique key field OPSL_GL_SYS_NO and additionally the fields OPSL_OWN_NO and OPSL_OWN_SEQ_NO, which are the leading fields of stadard secondary index I02.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For OPSL_GL_SYS_NO is an unique identifier for the primary index and, if it is empty, both other fields are handled with secondary index I02, this additional index Z01 is needless and may slow down your system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also make sure that the internal table &lt;STRONG&gt;it_selection_fields&lt;/STRONG&gt; isn't empty when processing the SELECT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF&amp;nbsp; NOT it_selection_fields[] IS INITIAL.&lt;/P&gt;&lt;P&gt;&amp;nbsp; SELECT ...&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also you have to to the more restricting selection 1st.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe it's more selective to switch table access to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a~opsl_gl_sys_no INTO CORRESPONDING FIELDS OF TABLE it_sysno&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM&amp;nbsp; oiuh_rv_gl AS b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INNER JOIN oiuh_rv_opsl AS a&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ON a~opsl_gl_sys_no = b~gl_gl_sys_no&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FOR ALL ENTRIES IN it_selection_fields&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE b~gl_or_lvl_1_no = ls_company_org1-org_level1_no&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND b~gl_pd_cd = it_selection_fields-product_code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND b~gl_sa_dt &amp;gt;= d_min_time &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND b~gl_sa_dt &amp;lt; d_max_time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND a~opsl_own_no = it_selection_fields-owner_no&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND a~opsl_own_seq_no = it_selection_fields-owner_seq_no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should effect data access from OIUH_RV_GL with index I09 and from OIUH_RV_OPSL with primary key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check this with a sql trace.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Klaus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jul 2013 10:46:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-taking-long-time/m-p/9562302#M1754351</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-04T10:46:26Z</dc:date>
    </item>
  </channel>
</rss>

