<?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: Difference between select single * and select * upto 1 row in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714911#M894272</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;According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key supplied and will try to find most suitable index. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best way to find out is through sql trace or runtime analysis. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mainly: to read data from &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="4738438"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="5019598"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="4915073"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;AK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 Apr 2008 11:27:42 GMT</pubDate>
    <dc:creator>ak_upadhyay</dc:creator>
    <dc:date>2008-04-28T11:27:42Z</dc:date>
    <item>
      <title>Difference between select single * and select * upto 1 row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714905#M894266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi expart&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls tell me Difference between select single * and select * upto 1 row statement .which one is better select statement .&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;Bhabani&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2008 11:17:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714905#M894266</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-28T11:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between select single * and select * upto 1 row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714906#M894267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;search the forum there had bee a thousand thread with exactly the same title.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2008 11:18:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714906#M894267</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-28T11:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between select single * and select * upto 1 row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714907#M894268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bhabani,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE *   ---&amp;gt;   It selects the First Matcing row satisfying the Where Condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while&lt;/P&gt;&lt;P&gt;SELECT * UP TO 1 ROW   ---&amp;gt;   selects all the Records satisfying the given Condition and then it applies aggregation as well as orders and returns the First Record according to these Records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sunil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2008 11:19:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714907#M894268</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-28T11:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between select single * and select * upto 1 row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714908#M894269</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;Here is the difference:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE returns the first matching row for the given condition and it may not be unique, if there are more matching rows for the given condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ... UP TO 1 ROWS retrieves all the matching records and applies aggregation and ordering and returns the first record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Inorder to check for the existence of a record then it is better to use SELECT SINGLE than using SELECT ... UP TO 1 ROWS since it uses low memory and has better performance."&lt;/P&gt;&lt;P&gt;According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Ruthra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2008 11:20:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714908#M894269</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-28T11:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between select single * and select * upto 1 row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714909#M894270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mainly: to read data from &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mainly: to check if entries exist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Single &lt;/P&gt;&lt;P&gt;You need to mention all the key fields of the table. &lt;/P&gt;&lt;P&gt;No END SELECT required.&lt;/P&gt;&lt;P&gt;More performance compared to upto 1 row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where as UP to 1 row.&lt;/P&gt;&lt;P&gt;YOu can use if you do not have all the primiary key fields available. &lt;/P&gt;&lt;P&gt;END SELECT requeired.&lt;/P&gt;&lt;P&gt;Since all keys are not passing, possiblities of have other rows which satisfies the condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Statement with EndSelect is a loop, which in a single run retrieves a single Record. This Record has to be stored in a Work Area and then appended into an Internal Table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Statements without EndSelect is not a loop and it retrieves the whole Record set matching the Criteria in a single shot and has to be Stored in an Internal Table Directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The most important thing to remember about the SELECT SINGLE is&lt;/P&gt;&lt;P&gt;There are several things to remember:&lt;/P&gt;&lt;P&gt;1) It retrieves only one row&lt;/P&gt;&lt;P&gt;2) It does not need an ENDSELECT statement&lt;/P&gt;&lt;P&gt;3) THE FULL KEY OF THE TABLE MUST BE INCLUDED IN &lt;/P&gt;&lt;P&gt;THE WHERE CLAUSE OF THE SELECT STATEMENT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kiran Sure&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2008 11:24:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714909#M894270</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-28T11:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between select single * and select * upto 1 row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714910#M894271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ,&lt;/P&gt;&lt;P&gt;frnd like these type SQL performance issues u check in &lt;/P&gt;&lt;P&gt;goto environmenty &lt;DEL&gt;&amp;gt; examples&lt;/DEL&gt;-&amp;gt; performance examples,&lt;/P&gt;&lt;P&gt;u have differancess between all types SQL statements, then read the documentation and click on easure time choose the best one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; regards,&lt;/P&gt;&lt;P&gt;chandu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REWARD if useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2008 11:25:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714910#M894271</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-28T11:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between select single * and select * upto 1 row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714911#M894272</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;According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key supplied and will try to find most suitable index. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best way to find out is through sql trace or runtime analysis. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mainly: to read data from &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="4738438"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="5019598"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="4915073"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;AK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Apr 2008 11:27:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714911#M894272</guid>
      <dc:creator>ak_upadhyay</dc:creator>
      <dc:date>2008-04-28T11:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between select single * and select * upto 1 row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714912#M894273</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Select Single * &lt;/P&gt;&lt;P&gt;It will fetch the first matching row in the database that fulfill the where clause if this result in multiple records only the first one will be returned.&lt;/P&gt;&lt;P&gt;Select...up to 1 Rows&lt;/P&gt;&lt;P&gt;The database selects all the relevant records that are defined by the where clause, applies any &lt;/P&gt;&lt;P&gt;aggregate, ordering or grouping functions to them and then returns the first record of the resultset.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manjunath M&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 10:29:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-1-row/m-p/3714912#M894273</guid>
      <dc:creator>former_member632800</dc:creator>
      <dc:date>2019-10-10T10:29:16Z</dc:date>
    </item>
  </channel>
</rss>

