<?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: Using parallel cursor in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266585#M780669</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Siegfried,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your blog is quite good..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, In my scenario, record count was &amp;gt; 200000, which i changed to double cursor method with Read Binary..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I never compared performance with sorted table..&lt;/P&gt;&lt;P&gt;Thanks for info.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohaiyuddin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Jan 2008 09:26:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-01-11T09:26:04Z</dc:date>
    <item>
      <title>Using parallel cursor</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266578#M780662</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;           I just want to know the functionality of the Parallel cursor in a report program.Kindly also porvide the explanation and the sample code for the same&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the diferrence between Double cursor read and using parallel cursor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;krishna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 14:51:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266578#M780662</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T14:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using parallel cursor</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266579#M780663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please see this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[The Performance of Nested Loops|/people/rob.burbank/blog/2006/02/07/performance-of-nested-loops]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 14:56:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266579#M780663</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T14:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using parallel cursor</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266580#M780664</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;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;STRONG&gt;&amp;amp;      Form  parallel_cursor&lt;/STRONG&gt;&amp;amp;--&lt;DEL&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;**       text*&lt;/DEL&gt;--&lt;P&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;*FORM parallel_cursor. DATA: bkpf_index LIKE sy-tabix,       bseg_index LIKE sy-tabix. CLEAR: bkpf_reads,        bseg_reads. GET TIME FIELD start_time. SORT: bkpf_tab BY bukrs belnr gjahr,       bseg_tab BY bukrs belnr gjahr. bseg_index = 1. LOOP AT bkpf_tab   INTO bkpf_lin.   bkpf_reads = bkpf_reads + 1.   LOOP AT bseg_tab INTO bseg_lin FROM bseg_index.     IF bseg_lin-bukrs &amp;lt;&amp;gt; bkpf_lin-bukrs OR        bseg_lin-belnr &amp;lt;&amp;gt; bkpf_lin-belnr OR        bseg_lin-gjahr &amp;lt;&amp;gt; bkpf_lin-gjahr.       bseg_index = sy-tabix.       EXIT.     ELSE.       bseg_reads = bseg_reads + 1.     ENDIF.   ENDLOOP. ENDLOOP. GET TIME FIELD end_time. difference = end_time - start_time. WRITE: /001 'Time for parallel cursor  :', difference,        /005 'Number of BKPF reads  :', bkpf_reads,        /005 'Number of BSEG reads  :', bseg_reads.ENDFORM.                    " parallel_cursor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2008 04:05:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266580#M780664</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-10T04:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using parallel cursor</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266581#M780665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Krishna,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parallel Cursor is method to drastically improve performance over nested Loop. Nested Loop - directly multiplies time of execution for each loop. Example : It outer loop takes 50 ms per iteration and inner loop takes 100 ms per iteration (average) and there are 1000 records in outer loop, 500 records in inner loop - time of execution will be &lt;/P&gt;&lt;P&gt;50ms * 1000 * 100ms * 500 = 2500000000 ms = 2500000 s = 41666 mins !!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parallel Cursor Example : Go to se30 --&amp;gt; Tips and Trick --&amp;gt; Internal Tables --&amp;gt; Simple Algorithms --&amp;gt; Nested Loops ....&lt;/P&gt;&lt;P&gt;You will be able to find simple example with execution time compared.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Double cursor read is modification of parallel cursoe. in parallel cursor you have read statement in outer loop. Hence this can read one record from inner table. If you have more than 1 record (that too variable numbers), you can use double cursor. &lt;/P&gt;&lt;P&gt;Double cursor will implement nested loop with modification that inner table will be sorted and after read and checking sy-subrc looping at inner table FROM SY-TABIX...Again check in inner loop condition which you have provided in Read. If condition does not come true, exit inner loop...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Double cursor example : (highlighted portion is enhancement from parallel cursor)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab_in by Matnr doc_no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab_out.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;read table itab_in with key matnr= ... doc_no = ..&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;loop at itab_in.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if itab_in-mater = itab_out-matnr and itab_in-doc_no = itab_out-doc_no.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;inner loop processing&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;else.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;exit.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endloop.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohaiyuddin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2008 06:23:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266581#M780665</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-10T06:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using parallel cursor</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266582#M780666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; Parallel Cursor is method to drastically improve performance over nested Loop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is simply not true.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would always recommend you to use for nested loops&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ optimized reads inside (binary search, sorted table or hashed tables) inside&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ if you need another loop inside then, sorted table or read binary search loop from index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Beware, that there is no need to sorted the table which is used for the loop, it will not help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read more in my blog:&lt;/P&gt;&lt;P&gt;Measurements on internal tables: Reads and Loops:&lt;/P&gt;&lt;P&gt;/people/siegfried.boes/blog/2007/09/12/runtimes-of-reads-and-loops-on-internal-tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parallel cursor will not really help much, they are bit better but only for very large internal tables,&lt;/P&gt;&lt;P&gt;and you should not forget that there both tables must be sorted. If they the tables are anyway sorted,&lt;/P&gt;&lt;P&gt;then you get some improvement, if they must be sorted then the improvement is low.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parallel cursor is much more difficult to program and to test, therefore I would generally recommend it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have results, but not published.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2008 09:11:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266582#M780666</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-10T09:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using parallel cursor</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266583#M780667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Siegfried,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe i might have exaggeratted the statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, sorted table will have good performance, but I have Improved performance of 5 programs which took 8-10 Hours with nested loops (along with select in loop)..Removing all these improved it's execution time so much that it too 1-2 minutes for execution !!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohaiyuddin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jan 2008 06:34:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266583#M780667</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-11T06:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: Using parallel cursor</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266584#M780668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Mohaiyuddin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as I said, if you use loop and inside the loop a read without binary search, then you get runtimes which&lt;/P&gt;&lt;P&gt;scale quadratically with the number of lines in the internal tables, i.e. for a table with 10.000 lines with&lt;/P&gt;&lt;P&gt;100.000.000 !!!  This will kill you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using a read binary search or sorted search goes down to n * logn = 4 * 10.000 ... which is already&lt;/P&gt;&lt;P&gt;Using hashed is even better.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And parallel cursor is even a smaller factor in front of the linear factor. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&amp;gt; they are all close to linear, there is not dramatic difference between the good solutions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Therefore it is not necessary to use parallel cursor as long as the size of the internal tables is not larger&lt;/P&gt;&lt;P&gt;than several 10.000 lines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;see more about nonlinearity:&lt;/P&gt;&lt;P&gt;/people/siegfried.boes/blog/2007/02/12/performance-problems-caused-by-nonlinear-coding&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jan 2008 08:56:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266584#M780668</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-11T08:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using parallel cursor</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266585#M780669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Siegfried,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your blog is quite good..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, In my scenario, record count was &amp;gt; 200000, which i changed to double cursor method with Read Binary..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I never compared performance with sorted table..&lt;/P&gt;&lt;P&gt;Thanks for info.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohaiyuddin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jan 2008 09:26:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266585#M780669</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-11T09:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using parallel cursor</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266586#M780670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thankyou all for your replies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jan 2008 14:35:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-parallel-cursor/m-p/3266586#M780670</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-11T14:35:24Z</dc:date>
    </item>
  </channel>
</rss>

