<?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: help in performance in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843494#M1318434</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What Nafran and Karthik suggested is of course correct and maybe the best solution, But if you want to query a table with around 1milion records there should be some other performance aspects considered too.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MODIFY&lt;/STRONG&gt; is ok (as it would handle INSERT + UPDATE at once - so access to DB is also perfomed once per each full table key). On the other hand you have to transport all the fields within &lt;EM&gt;work area&lt;/EM&gt; which you are modifying DB from. So here performance might be "licking". While &lt;STRONG&gt;UPDATE&lt;/STRONG&gt; allows you to transport only necessary fields (those selected and those queried), &lt;STRONG&gt;INSERT&lt;/STRONG&gt; works similary to &lt;STRONG&gt;MODIFY&lt;/STRONG&gt; in terms of transports (as data must come from work area too). So here, for testing performance, you could use &lt;STRONG&gt;trial and error&lt;/STRONG&gt; approach, I mean first do your coding with MODIFY and check the results using &lt;EM&gt;ABAP runtime analysis&lt;/EM&gt; ( &lt;STRONG&gt;SE30&lt;/STRONG&gt; ) then rebuilt it to work with UPDATE + INSERT and check again the results. In real time examples it still depends on different factors how DB Optimizer will access DB. Trully it is never known until runtime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Jun 2009 07:48:03 GMT</pubDate>
    <dc:creator>MarcinPciak</dc:creator>
    <dc:date>2009-06-29T07:48:03Z</dc:date>
    <item>
      <title>help in performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843485#M1318425</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;i want to know if from performace side ,if it's good to select data and see if it's need to be update,or update any way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g. i get data on user and my quesion is if to do select single and see if the user is exist and if the user exist see if i need to update his data on my DB tables&lt;/P&gt;&lt;P&gt; or create it anyway.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Jun 2009 09:34:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843485#M1318425</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-28T09:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: help in performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843486#M1318426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Generally every step that requires some communication with DB affects application performance. If you requirement involves couple (houndreds) users at most the performance quality shouldn't get worse too much. If on the other hand you are worinkg on huge data structures (where DB table has milions of records) this could drastically affect it. &lt;/P&gt;&lt;P&gt;If you use select single providing entire primaty key, the access to DB is really good as index is used (most probably).  If, on the other hand, you ommit any field form primary key in query, it will work as usual SELECT ENDSELECT query. &lt;/P&gt;&lt;P&gt;As for the example you gave, you can use UPDATE+INSERT statements instead of combination of SELECT SINGLE + UPDATE. It could look like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
UPDATE dbtab SET field1 = ...
                                field2 = ...
                   WHERE field3 = ...  "this statment works like SELECT + UPDATE (so only those records which fullfills where condition are to be udpdated i.e. if user exists)
if sy-subrc = 0.
   "if no record updated, create it
  INSERT dbtab FROM wa.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Of course this is just example solution. It must always depend on certain conditons, like (as I said above) how many records are affected. If it is for single users, performance should not be the primary aspect to consider.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Jun 2009 10:33:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843486#M1318426</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-06-28T10:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: help in performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843487#M1318427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the table is up to 1,000,000 records  what do u think it's good to do for performance aspects ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Jun 2009 20:32:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843487#M1318427</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-28T20:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: help in performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843488#M1318428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I think  in your case its better to use modify since that would take care of both insert and modify, because on other ways you have to select and check and its a over head.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nafran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jun 2009 03:30:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843488#M1318428</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-29T03:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: help in performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843489#M1318429</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;STRONG&gt;MODIFY dbtab&lt;/STRONG&gt; statement will solve your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;See F1 help&lt;/STRONG&gt; for Modify, it will update if record already exists otherwise insert a new record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Usage;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;MODIFY db_table FROM TABLE itab.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Karthik D&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jun 2009 03:46:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843489#M1318429</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-29T03:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: help in performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843490#M1318430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Karthik,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a way to know if the modify statement do update or insert or noting ?&lt;/P&gt;&lt;P&gt;since this data is important in my case&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jun 2009 05:25:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843490#M1318430</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-29T05:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: help in performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843491#M1318431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; There is a way to know if the modify statement do update or insert or noting ?&lt;/P&gt;&lt;P&gt;&amp;gt; since this data is important in my case&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you don't have to bother about that while using MODIFY. But there is no way to find how many lines are inserted and updated as MODIFY only return &lt;STRONG&gt;sy-subrc&lt;/STRONG&gt; as 0(all internal table lines processed) or 4(Some lines are not processed) and &lt;STRONG&gt;sy-dbcnt&lt;/STRONG&gt; will be having the number of lines successfully processed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Karthik D&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jun 2009 05:31:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843491#M1318431</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-29T05:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: help in performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843492#M1318432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The MODIFY statement sets sy-dbcnt to the number of processed lines. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then if you want you cant get the count of a primary key and number of entries and reduce it from the early one but i think your asking this to put a message if that's the case don't do it just convince the client that you will give the number of processed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nafran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jun 2009 05:45:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843492#M1318432</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-29T05:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: help in performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843493#M1318433</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;The indirect way is to find the number of records of the dbtable before and after modify using SELECT COUNT(*) statement, so that you can calculate as;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Inserted rows  = Previous record count - current record count.
Updated Rows = internal table record count - Inserted Rows.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Karthik D&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jun 2009 05:49:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843493#M1318433</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-29T05:49:27Z</dc:date>
    </item>
    <item>
      <title>Re: help in performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843494#M1318434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What Nafran and Karthik suggested is of course correct and maybe the best solution, But if you want to query a table with around 1milion records there should be some other performance aspects considered too.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MODIFY&lt;/STRONG&gt; is ok (as it would handle INSERT + UPDATE at once - so access to DB is also perfomed once per each full table key). On the other hand you have to transport all the fields within &lt;EM&gt;work area&lt;/EM&gt; which you are modifying DB from. So here performance might be "licking". While &lt;STRONG&gt;UPDATE&lt;/STRONG&gt; allows you to transport only necessary fields (those selected and those queried), &lt;STRONG&gt;INSERT&lt;/STRONG&gt; works similary to &lt;STRONG&gt;MODIFY&lt;/STRONG&gt; in terms of transports (as data must come from work area too). So here, for testing performance, you could use &lt;STRONG&gt;trial and error&lt;/STRONG&gt; approach, I mean first do your coding with MODIFY and check the results using &lt;EM&gt;ABAP runtime analysis&lt;/EM&gt; ( &lt;STRONG&gt;SE30&lt;/STRONG&gt; ) then rebuilt it to work with UPDATE + INSERT and check again the results. In real time examples it still depends on different factors how DB Optimizer will access DB. Trully it is never known until runtime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jun 2009 07:48:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-performance/m-p/5843494#M1318434</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-06-29T07:48:03Z</dc:date>
    </item>
  </channel>
</rss>

