{"id":793,"date":"2006-05-03T12:00:00","date_gmt":"2006-05-03T12:00:00","guid":{"rendered":"http:\/\/orcldoug.com\/blog\/?p=793"},"modified":"2006-05-03T12:00:00","modified_gmt":"2006-05-03T12:00:00","slug":"a-minor-parallel-execution-problem","status":"publish","type":"post","link":"http:\/\/orcldoug.com\/blog\/2006\/05\/03\/a-minor-parallel-execution-problem\/","title":{"rendered":"A Minor Parallel Execution Problem"},"content":{"rendered":"<p>We have a problem on one of the data warehouse databases at work. There is an overnight resource profile in place that is designed to stop any users from running long-running queries while other activities are happening. The main limit is on logical_reads_per_call, for example (and this is just a simple example I&#8217;ve been playing with at home)<\/p>\n<pre>SQL&gt; alter profile default limit logical_reads_per_call 10000;<br\/><p><\/p><br\/>Profile altered.<\/pre>\n<p>Now I&#8217;ll connect to the testuser account and look at the table I&#8217;m going to test this with &#8211; DUDE (why it&#8217;s called that should become clearer when I blog about DUDE soon)<\/p>\n<pre>SQL&gt; select table_name, blocks from user_tables where table_name = 'DUDE';<br\/><p><\/p><br\/>TABLE_NAME                         BLOCKS<br\/>------------------------------ ----------<br\/>DUDE                                25431<\/pre>\n<p>So you can see that the table DUDE consists of 25431 blocks. Therefore, if I try to perform a full table scan of it, I&#8217;ll hit the limit.<\/p>\n<pre>SQL&gt; set autotrace trace statistics<br\/>SQL&gt; select count(*) from dude;<br\/>select count(*) from dude<br\/>*<br\/>ERROR at line 1:<br\/>ORA-02395: exceeded call limit on IO usage<\/pre>\n<p>But, if I try the same query using parallel execution, it doesn&#8217;t exceed the limit.<\/p>\n<pre>SQL&gt; select \/*+ parallel(dude, 2) *\/ count(*) from dude;<br\/><p><\/p><br\/>Statistics<br\/>----------------------------------------------------------<br\/>       27  recursive calls<br\/>        3  db block gets<br\/>    25537  consistent gets<br\/>    25403  physical reads<br\/>      672  redo size<br\/>      414  bytes sent via SQL*Net to client<br\/>      385  bytes received via SQL*Net from client<br\/>        2  SQL*Net roundtrips to\/from client<br\/>        1  sorts (memory)<br\/>        0  sorts (disk)<br\/>        1  rows processed<\/pre>\n<p>And even if I reduce the limit to 500 :-<\/p>\n<pre>SQL&gt; connect \/ as sysdba<br\/>Connected.<br\/>SQL&gt; alter profile default limit logical_reads_per_call 500;<br\/><p><\/p><br\/>Profile altered.<br\/><p><\/p><br\/>SQL&gt; connect testuser\/testuser<br\/>Connected.<br\/>SQL&gt; set autotrace trace statistics<br\/>SQL&gt; select \/*+ parallel(dude, 2) *\/ count(*) from dude;<br\/><p><\/p><br\/>Statistics<br\/>----------------------------------------------------------<br\/>        6  recursive calls<br\/>        0  db block gets<br\/>    25536  consistent gets<br\/>    25403  physical reads<br\/>        0  redo size<br\/>      414  bytes sent via SQL*Net to client<br\/>      385  bytes received via SQL*Net from client<br\/>        2  SQL*Net roundtrips to\/from client<br\/>        1  sorts (memory)<br\/>        0  sorts (disk)<br\/>        1  rows processed<\/pre>\n<p>There are only two slaves in use, each of which is clearly reading more than 500 blocks, but I assume that because they&#8217;re background processes, their statistics aren&#8217;t included.<\/p>\n<p>I&#8217;m still digging around with this, but I&#8217;m interested in hearing anyone else&#8217;s experiences because this is causing us a problem because just when we want to limit system load, some of the most resource-hungry SQL statements are being executed and not limited, because they&#8217;re using PX. I can think of several solutions to this, but it would appear that the existing approach isn&#8217;t going to work.<\/p>\n<p><span style=\"font-weight: bold\">Additional info<br \/><\/span>I missed this off the original post. At work  I was using x$ksuru to try to work out what was going on. These are the results I&#8217;m getting locally, which show that the original slaves are exceeding the limit that&#8217;s still in place. (Note that this is on a bigger table, though, to give me more chance to monitor the changes)<\/p>\n<p><\/p>\n<pre>select * from x$ksuru<br\/>where addr IN (select saddr from v$px_session where qcsid = &amp;parent)<br\/>and ksurind = 4<br\/><p><\/p><br\/>SQL&gt; \/<br\/>Enter value for parent: 1073<br\/>old   2: where addr IN (select saddr from v$px_session where qcsid = &amp;parent)<br\/>new   2: where addr IN (select saddr from v$px_session where qcsid = 1073)<br\/><p><\/p><br\/>ADDR           INDX    INST_ID   KSUSEIDL    KSURIND    KSURUSE<br\/>-------- ---------- ---------- ---------- ---------- ----------<br\/>7D0532C4       1069          1          1          4      50090<br\/>7D057D94       1073          1          1          4         26<br\/>7D05DB18       1078          1          1          4      49302<br\/><p><\/p><br\/>SQL&gt; \/<br\/>Enter value for parent: 1073<br\/>old   2: where addr IN (select saddr from v$px_session where qcsid = &amp;parent)<br\/>new   2: where addr IN (select saddr from v$px_session where qcsid = 1073)<br\/><p><\/p><br\/>ADDR           INDX    INST_ID   KSUSEIDL    KSURIND    KSURUSE<br\/>-------- ---------- ---------- ---------- ---------- ----------<br\/>7D0532C4       1069          1          1          4      55499<br\/>7D057D94       1073          1          1          4         26<br\/>7D05DB18       1078          1          1          4      54508<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>We have a problem on one of the data warehouse databases at work. There is an overnight resource profile in place that is designed to stop any users from running long-running queries while other activities are happening. The main limit is on logical_reads_per_call, for example (and this is just a simple example I&#8217;ve been playing&hellip; <a class=\"more-link\" href=\"http:\/\/orcldoug.com\/blog\/2006\/05\/03\/a-minor-parallel-execution-problem\/\">Continue reading <span class=\"screen-reader-text\">A Minor Parallel Execution Problem<\/span><\/a><\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-793","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":1000,"url":"http:\/\/orcldoug.com\/blog\/2006\/06\/18\/saving-optimiser-stats-10g\/","url_meta":{"origin":793,"position":0},"title":"Saving Optimiser Stats &#8211; 10g","date":"June 18, 2006","format":false,"excerpt":"In my previous blog I showed how you can save your current optimiser stats into a seperate table whenever you refresh them, so that they can be restored should the new statistics lead to poor SQL execution plans. Oracle have added an improved version of this facility to 10g (which\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1017,"url":"http:\/\/orcldoug.com\/blog\/2006\/07\/13\/alter-table-move-and-table-stats\/","url_meta":{"origin":793,"position":1},"title":"alter table &#8230; move and table stats","date":"July 13, 2006","format":false,"excerpt":"Howard Rogers left a comment on my last blog, showing an example of using alter table ... move on a 10gR2 database on Linux. In his example, unlike mine, the table rebuild did not nullify the table's statistics. I admit I was surprised myself when I ran my example yesterday\u2026","rel":"","context":"With 4 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1019,"url":"http:\/\/orcldoug.com\/blog\/2006\/07\/14\/alter-table-move-and-table-stats-part-ii\/","url_meta":{"origin":793,"position":2},"title":"alter table &#8230; move and table stats (part II)","date":"July 14, 2006","format":false,"excerpt":"Following up on another comment from Howard, I took the initrans change off the alter table ... move so that it was the most basic variation and then ran it on 8i, 9i and 10g. I've trimmed lots of the output this time, but I have the log files if\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1016,"url":"http:\/\/orcldoug.com\/blog\/2006\/07\/12\/table-reorgs-and-statistics\/","url_meta":{"origin":793,"position":3},"title":"Table reorgs and statistics","date":"July 12, 2006","format":false,"excerpt":"While working on the ITL deadlock problem (which looks like it's been fixed by the initrans increase and table rebuild), the developers highlighted another table as hitting this problem in the past. When I investigated, I found that initrans had already been set to 6 so this had obviously happened\u2026","rel":"","context":"With 10 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1568,"url":"http:\/\/orcldoug.com\/blog\/2010\/02\/28\/statistics-on-partitioned-tables-part-4\/","url_meta":{"origin":793,"position":4},"title":"Statistics on Partitioned Tables &#8211; Part 4","date":"February 28, 2010","format":false,"excerpt":"In the last post I illustrated the problems you can run into when you rely on Oracle to aggregate statistics on partitions or subpartitions to generate estimated Global Statistics at higher levels of the table. Until there are statistics for all of the relevant structures then aggregation won't take place\u2026","rel":"","context":"With 3 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1570,"url":"http:\/\/orcldoug.com\/blog\/2010\/02\/28\/statistics-on-partitioned-tables-part-5\/","url_meta":{"origin":793,"position":5},"title":"Statistics on Partitioned Tables &#8211; Part 5","date":"February 28, 2010","format":false,"excerpt":"Actually, before looking at any recent features, let me introduce one more aspect of the existing aggregation approach used by Oracle. The examples used to date have been based on INSERTing new rows into subpartitions and, although that's the approach used for some of our tables and will suit some\u2026","rel":"","context":"With 18 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts\/793","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/comments?post=793"}],"version-history":[{"count":0,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/posts\/793\/revisions"}],"wp:attachment":[{"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/media?parent=793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/categories?post=793"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/orcldoug.com\/blog\/wp-json\/wp\/v2\/tags?post=793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}