<?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: How to replace SELECT DISTINCT; Performace problem. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436612#M1551093</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To answer one of the initial questions: The output should be the same with SELECT DISTINCT and SORT/DELETE. And I can confirm that on some systems the SORT/DELETE might be faster than SELECT DISTINCT. Maybe it's even faster if you select directly into a sorted table, like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: itab TYPE SORTED TABLE OF dtab WITH NON-UNIQUE KEY colum1 colum2.

SELECT column1 column2
FROM dtab
  INTO TABLE itab.

DELETE ADJACENT DUPLICATES FROM itab.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 Nov 2010 12:33:42 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-11-19T12:33:42Z</dc:date>
    <item>
      <title>How to replace SELECT DISTINCT; Performace problem.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436605#M1551086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my code; I am having a SELECT DISTINCT. Since it is found that, the query is tabking much more time to execute, can anybody suggest a way to replace the code.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------" /&gt;&lt;P&gt;The code looks like..&lt;/P&gt;&lt;P&gt;SELECT DISTINCT column1 column2&lt;/P&gt;&lt;P&gt;INTO itab&lt;/P&gt;&lt;P&gt;BYPASSING BUFFER....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I use a code like this..&lt;/P&gt;&lt;P&gt;SELECT column1 column2&lt;/P&gt;&lt;P&gt;INTO...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;followed by SORT itab by column1 column2. and DELETE ADJACENT DUPLICATES COMPARING column1 column2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to know whether both will provide same output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ullas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Nov 2010 10:23:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436605#M1551086</guid>
      <dc:creator>ullas_u2</dc:creator>
      <dc:date>2010-11-15T10:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace SELECT DISTINCT; Performace problem.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436606#M1551087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it would be good or easier to tell only if let us know what fields you are selecting, from which table your selcting and what is your where condition that you are passing to select them. &lt;/P&gt;&lt;P&gt;But still try using group by col1, col2 etc at the end of your SELECT statement to enhance the performance at best. Remember col1 etc specified with GROUP BY clause should be a part of the primary key or atleast a part of the Secondary key (INDEX's) of the table you are fetching from.&lt;/P&gt;&lt;P&gt;Bye.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Nov 2010 10:37:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436606#M1551087</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-11-15T10:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace SELECT DISTINCT; Performace problem.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436607#M1551088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why have you used BYPASSING BUFFER? I can suggest compare the 2 approaches in ABAP Runtime Tool(SE30) "Tips &amp;amp; Tricks" section &amp;amp; check which one is faster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;SUhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Nov 2010 10:42:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436607#M1551088</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-11-15T10:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace SELECT DISTINCT; Performace problem.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436608#M1551089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;BY PASSING BUFFER is must on DISTINCT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also rather than performance, I am afraid about the output. So 1st of all I need to know whether the mentioned logic provides same output or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Ullas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: UllasU on Nov 15, 2010 12:10 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Nov 2010 11:01:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436608#M1551089</guid>
      <dc:creator>ullas_u2</dc:creator>
      <dc:date>2010-11-15T11:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace SELECT DISTINCT; Performace problem.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436609#M1551090</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;There is no need to write the by pass buffer, when you used the distinct it automatically bypass the buffer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when you used the distinct in select sql then system sort table whole table, search and provide the result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Put the &lt;STRONG&gt;Order by&lt;/STRONG&gt; in SQL and try.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Nov 2010 12:28:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436609#M1551090</guid>
      <dc:creator>ravi_lanjewar</dc:creator>
      <dc:date>2010-11-15T12:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace SELECT DISTINCT; Performace problem.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436610#M1551091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;BY PASSING BUFFER is must on DISTINCT&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When using SELECT DISTINCT, SELECT overrides the buffer implicitly!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Nov 2010 12:29:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436610#M1551091</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-11-15T12:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace SELECT DISTINCT; Performace problem.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436611#M1551092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the SELECT DISTINCT can not use the table buffer ....&lt;/P&gt;&lt;P&gt;But, is your table in the table buffer?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so, then you should use your second option, because this can use the table buffer and is at least 10 times faster.&lt;/P&gt;&lt;P&gt;... If the WHERE-clause also fits to the buffer setting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, if the table in only in the database, then you should leave the DISTINCT where it is and chekc the WHERE-clause, whether it can use an index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Nov 2010 16:35:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436611#M1551092</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-11-16T16:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace SELECT DISTINCT; Performace problem.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436612#M1551093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To answer one of the initial questions: The output should be the same with SELECT DISTINCT and SORT/DELETE. And I can confirm that on some systems the SORT/DELETE might be faster than SELECT DISTINCT. Maybe it's even faster if you select directly into a sorted table, like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: itab TYPE SORTED TABLE OF dtab WITH NON-UNIQUE KEY colum1 colum2.

SELECT column1 column2
FROM dtab
  INTO TABLE itab.

DELETE ADJACENT DUPLICATES FROM itab.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Nov 2010 12:33:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-replace-select-distinct-performace-problem/m-p/7436612#M1551093</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-11-19T12:33:42Z</dc:date>
    </item>
  </channel>
</rss>

