<?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: SQL Trace Analysis in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-trace-analysis/m-p/3920646#M939409</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;to explain the difference is very simple here::&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is this information&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;( Estim. Costs = 72,542 , Estim. #Rows = 568 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;( Estimated Costs = 38 , Estimated #Rows = 2 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The optimizer expects much higher costs to determine the the rows you want and it expects much higher numbers of rows coming back.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First you should check whether the statistics of your test system are up-to-date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See explain, double click on table U(usually with blue background) then you get statistcial information, about selectivity and with a date.&lt;/P&gt;&lt;P&gt;Check whether this data are recently updated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try again, maybe you will get no full table scan up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise add index hint and try again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Jun 2008 10:43:54 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-02T10:43:54Z</dc:date>
    <item>
      <title>SQL Trace Analysis</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-trace-analysis/m-p/3920644#M939407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the SELECT statement: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT DISTINCT vbak~vbeln                           &lt;/P&gt;&lt;P&gt;                  vbkd~zzvextzau                             &lt;/P&gt;&lt;P&gt;                  vbak~auart                                &lt;/P&gt;&lt;P&gt;         INTO TABLE zauth_itab                               &lt;/P&gt;&lt;P&gt;         FROM vbak                                           &lt;/P&gt;&lt;P&gt;         INNER JOIN vbap                                   &lt;/P&gt;&lt;P&gt;                 ON vbap&lt;SUB&gt;mandt = vbak&lt;/SUB&gt;mandt                 &lt;/P&gt;&lt;P&gt;                AND vbap&lt;SUB&gt;vbeln = vbak&lt;/SUB&gt;vbeln                 &lt;/P&gt;&lt;P&gt;         INNER JOIN vbup                                     &lt;/P&gt;&lt;P&gt;                 ON vbup&lt;SUB&gt;mandt = vbak&lt;/SUB&gt;mandt                &lt;/P&gt;&lt;P&gt;                AND vbup&lt;SUB&gt;vbeln = vbak&lt;/SUB&gt;vbeln                  &lt;/P&gt;&lt;P&gt;         INNER JOIN vbkd                                     &lt;/P&gt;&lt;P&gt;                 ON vbkd&lt;SUB&gt;mandt = vbak&lt;/SUB&gt;mandt                  &lt;/P&gt;&lt;P&gt;                AND vbkd&lt;SUB&gt;vbeln = vbak&lt;/SUB&gt;vbeln                  &lt;/P&gt;&lt;P&gt;                AND vbkd~posnr = 0                      &lt;/P&gt;&lt;P&gt;         WHERE vbak~vbeln     IN s_vbeln                     &lt;/P&gt;&lt;P&gt;         AND   vbap~matnr     IN s_matnr                   &lt;/P&gt;&lt;P&gt;         AND   vbap~kondm     IN s_kondm                               &lt;/P&gt;&lt;P&gt;         AND   vbak~auart     IN s_auart                   &lt;/P&gt;&lt;P&gt;         AND   vbak~vkorg     IN s_vkorg                   &lt;/P&gt;&lt;P&gt;         AND vbak~guebg IN r_guebg                          &lt;/P&gt;&lt;P&gt;       AND ( vbak~gueen     &amp;gt; sy-datum OR                    &lt;/P&gt;&lt;P&gt;             vbak~gueen     = 0 )                            &lt;/P&gt;&lt;P&gt;         AND   vbup~rfsta     EQ 'C'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why is there a difference in the execution flow between the dev't box and sys test box? The code is exactly the same and it is the same Transport Request.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ran SQL Trace (Trans ST05) for both boxes and found a difference:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why is it that in the TEST BOX, the first exec was TABLE ACCESS FULL but in the DEV BOX it is INDEX RANGE SCAN?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result of Execution Flow (from SQL Trace ST05) in System Test Box:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT STATEMENT   ( Estimated Costs = 72,542 , Estimated #Rows = 568 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; -  11 SORT UNIQUE&lt;/P&gt;&lt;P&gt;       ( Estim. Costs = 72,542 , Estim. #Rows = 568 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    -  10  FILTER &lt;/P&gt;&lt;P&gt;     &lt;/P&gt;&lt;P&gt;       -   9  NESTED LOOPS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;           -  7  NESTED LOOPS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              -  4  NESTED LOOPS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                 -  1  TABLE ACCESS FULL  VBAK&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                 -  3  TABLE ACCESS BY INDEX ROWID  VBKD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                    -  2  INDEX UNIQUE SCAN  VBKD~0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              - 6  TABLE ACCESS BY INDEX ROWID VBUP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                 -  5  INDEX RANGE SCAN VBUP~0&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;            -  8   INDEX RANGE SCAN VBAP~0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result of Execution Flow (from SQL Trace ST05) in Development Box:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT STATEMENT   ( Estimated Costs = 38 , Estimated #Rows = 2 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; -  12 SORT UNIQUE&lt;/P&gt;&lt;P&gt;       ( Estim. Costs = 38 , Estim. #Rows = 2 )&lt;/P&gt;&lt;P&gt;       Estim. CPU-Costs = 4 Estim. IO-Costs = 38&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    -  11  FILTER &lt;/P&gt;&lt;P&gt;     &lt;/P&gt;&lt;P&gt;       -   10  NESTED LOOPS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;           -   8  NESTED LOOPS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;               -  5  NESTED LOOPS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                  -  2  TABLE ACCESS BY INDEX ROWID  VBAK&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                     -  1  INDEX RANGE SCAN  VBKAK~Z05&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                  -  4  TABLE ACCESS BY INDEX ROWID  VBKD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                     -  3  INDEX UNIQUE SCAN  VBKD~0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;               -  7  TABLE ACCESS BY INDEX ROWID VBUP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                  -  6  INDEX RANGE SCAN VBUP~0&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;             -  9   INDEX RANGE SCAN VBAP~0&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Jun 2008 10:06:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-trace-analysis/m-p/3920644#M939407</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-02T10:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Trace Analysis</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-trace-analysis/m-p/3920645#M939408</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;Index is picked by the optimiser at the runtime it is not possible to know which one will be picked until runtime. &lt;/P&gt;&lt;P&gt;In your case, the development system u have Z05 index which is partially or fully satisfying your WHERE condition.&lt;/P&gt;&lt;P&gt;Check for the index in ur test system. if u want , u can force the optimiser to pick the index u want using %_oracle hints.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pls avoid SELECT DISTINCT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;madhu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Jun 2008 10:27:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-trace-analysis/m-p/3920645#M939408</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-02T10:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Trace Analysis</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-trace-analysis/m-p/3920646#M939409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;to explain the difference is very simple here::&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is this information&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;( Estim. Costs = 72,542 , Estim. #Rows = 568 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;( Estimated Costs = 38 , Estimated #Rows = 2 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The optimizer expects much higher costs to determine the the rows you want and it expects much higher numbers of rows coming back.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First you should check whether the statistics of your test system are up-to-date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See explain, double click on table U(usually with blue background) then you get statistcial information, about selectivity and with a date.&lt;/P&gt;&lt;P&gt;Check whether this data are recently updated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try again, maybe you will get no full table scan up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise add index hint and try again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Jun 2008 10:43:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-trace-analysis/m-p/3920646#M939409</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-02T10:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Trace Analysis</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-trace-analysis/m-p/3920647#M939410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks both!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was wondering if the points were added? I tried to reward both of you points. Thank you so much! I hope the points were rewarded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Che&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Jun 2008 11:09:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-trace-analysis/m-p/3920647#M939410</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-02T11:09:57Z</dc:date>
    </item>
  </channel>
</rss>

