<?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 Performance of UPDATE statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-update-statement/m-p/5885698#M1325667</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.  I have the following statement running against a table with about 55 million records.  It has taken close to 36 hours to run:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    update  /xyz/t_transaction set state   =   ' '   where key  =   3. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    commit work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The goal is to clear all values for this column for the entire table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table has about 35 columns and has two indexes on date fields.  The date fields are heavily searched in other programs.  The STATE field is a type CHAR 20 and stores at most 5 different character values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Transaction DB02 shows more than 300,000,000 row scans, far more than the amount of records in the table.  The underlying DB is Oracle on Solaris and we have STATS running 3 times a week on the entire DB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone suggest tips for improving performance?  There are no other keys in the table other than 3.  Would removing the where clause improve performance?  We also thought of temporarily removing the indexes and adding them back after the program runs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Anthony&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Jul 2009 22:14:36 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-07-23T22:14:36Z</dc:date>
    <item>
      <title>Performance of UPDATE statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-update-statement/m-p/5885698#M1325667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.  I have the following statement running against a table with about 55 million records.  It has taken close to 36 hours to run:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    update  /xyz/t_transaction set state   =   ' '   where key  =   3. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    commit work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The goal is to clear all values for this column for the entire table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table has about 35 columns and has two indexes on date fields.  The date fields are heavily searched in other programs.  The STATE field is a type CHAR 20 and stores at most 5 different character values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Transaction DB02 shows more than 300,000,000 row scans, far more than the amount of records in the table.  The underlying DB is Oracle on Solaris and we have STATS running 3 times a week on the entire DB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone suggest tips for improving performance?  There are no other keys in the table other than 3.  Would removing the where clause improve performance?  We also thought of temporarily removing the indexes and adding them back after the program runs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Anthony&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jul 2009 22:14:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-update-statement/m-p/5885698#M1325667</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-23T22:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: Performance of UPDATE statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-update-statement/m-p/5885699#M1325668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anthony,&lt;/P&gt;&lt;P&gt;&lt;/P&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; Transaction DB02 shows more than 300,000,000 row scans, far more than the amount of records in the table.  The underlying DB is Oracle on Solaris and we have STATS running 3 times a week on the entire DB.&lt;/P&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what do you mean by "row scans" ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What i understood from your mail...:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the table /xyz/t_transaction has 55 million records and 35 collumns.&lt;/P&gt;&lt;P&gt;2 indexes on date fields are defined. the field state is NOT in any index and&lt;/P&gt;&lt;P&gt;the field key is NOT in any index. all records have key = 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the above is true the update:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
update /xyz/t_transaction set state = ' ' where key = 3. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;should perform a full table scan updating the state column in all rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The runtime of such an update directly depends on the number of blocks allocated&lt;/P&gt;&lt;P&gt;for that table. All blocks up to the HWM (high water mark), including empty blocks if &lt;/P&gt;&lt;P&gt;there are some, have to be read and updated. No indexes will be touched (key is not&lt;/P&gt;&lt;P&gt;indexed and state is not indexed as well).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Therefore removing the indexes will not make any difference. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Removing the where condition from the update will not change anything as well &lt;/P&gt;&lt;P&gt;since all columns have key 3 a full table scan should be performed in any case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you post your table satistics? How much blocks are allocated for the table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would assume the readtime of this query roughly as &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;nr of blocks allocated x time for reading one block (sequential multiblock i/o) + a little bit&lt;/P&gt;&lt;P&gt;of update overhead per block. Logging times will come on top of that (i ignored them in&lt;/P&gt;&lt;P&gt;the beginning).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the  time per block should not be higher than 20 - 25 milli seconds (depending on your i/o subsystem).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How often do you have to run that query? Regularly or only once?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to get more details what causes that run time (i/O, logging, might be enques or something else as well, ...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On 10g use the active session history for details on 9i you have to use extende sql trace.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Hermann Gahm on Jul 24, 2009 2:47 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2009 07:34:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-update-statement/m-p/5885699#M1325668</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2009-07-24T07:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Performance of UPDATE statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-update-statement/m-p/5885700#M1325669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hermann&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply.  My table stats are below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tablespace = PSAPSR3&lt;/P&gt;&lt;P&gt;Header File = 6&lt;/P&gt;&lt;P&gt;Header Blocks = 331,499.00&lt;/P&gt;&lt;P&gt;Size (MB) = 16,225.00&lt;/P&gt;&lt;P&gt;Extents = 442&lt;/P&gt;&lt;P&gt;Blocks = 2,076,800&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We only run this infrequently but we still would like to understand why it performs this way.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table currently has 58,250,000 records.  It has 55 columns.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this seem within range of normal processing times or can it be improved?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anthony&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jul 2009 19:30:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-update-statement/m-p/5885700#M1325669</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-27T19:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: Performance of UPDATE statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-update-statement/m-p/5885701#M1325670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anthony,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;58250000 records in 36 hours =  ~2,2 milli seconds per record. (quite good)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to understand where the time is spent you have to use the active session&lt;/P&gt;&lt;P&gt;history in ORACLE 10g or the extended SQL trace in ORACLE 9i. I assume that the time&lt;/P&gt;&lt;P&gt;is mostly spent on I/O and or logging. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I/O is the bottleneck Parallel Execution could be an option to run the query faster but here &lt;/P&gt;&lt;P&gt;you would need native sql.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If logging is the bottleneck the configuration (log files and log realted parameters) can be checked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In any case you need the help of an DBA i guess.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2009 08:02:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-update-statement/m-p/5885701#M1325670</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2009-07-28T08:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Performance of UPDATE statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-update-statement/m-p/5885702#M1325671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Hermann!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2009 15:33:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-update-statement/m-p/5885702#M1325671</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-28T15:33:41Z</dc:date>
    </item>
  </channel>
</rss>

