<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tanel Poder's blog: Core IT for Geeks and Pros &#187; Design</title>
	<atom:link href="http://blog.tanelpoder.com/category/design/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tanelpoder.com</link>
	<description>Oracle troubleshooting, internals and performance tuning</description>
	<lastBuildDate>Sat, 31 Jul 2010 05:44:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>NULL is not zero!</title>
		<link>http://blog.tanelpoder.com/2009/12/30/null-is-not-zero/</link>
		<comments>http://blog.tanelpoder.com/2009/12/30/null-is-not-zero/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 06:48:15 +0000</pubDate>
		<dc:creator>Tanel Poder</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://blog.tanelpoder.com/?p=518</guid>
		<description><![CDATA[Some time ago I wrote a post about how COUNT(*) and COUNT(column) are semantically different things (link). Such queries may return different results if the column counted has NULLs in it. And the difference comes from that NULL is not a value, it&#8217;s rather a state which says &#8220;value unknown&#8221; or &#8220;no value entered&#8221;. So, [...]]]></description>
			<content:encoded><![CDATA[<p>Some time ago I wrote a post about how COUNT(*) and COUNT(column) are semantically different things (<a href="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cudGFuZWxwb2Rlci5jb20vMjAwOS8wOC8yMS9zZWxlY3QtY291bnQtYW5kLWNvdW50Y29sdW1uLWFyZS1kaWZmZXJlbnQtdGhpbmdzLw==">link</a>). Such queries may return different results if the column counted has NULLs in it. And the difference comes from that NULL is not a value, it&#8217;s rather a state which says &#8220;value unknown&#8221; or &#8220;no value entered&#8221;.</p>
<p>So, you better understand how NULLs interact with your SQL constructs if you call yourself a DBA or a database developer ;-)</p>
<p>Here&#8217;s another example about how misunderstanding NULLs may cause your application to return different results than what was intended.</p>
<p>I will create a little table with TWO rows in it:</p>
<pre>SQL&gt; create table t(a int);
</pre>
<pre>Table created.

SQL&gt; insert into t values(<strong>1</strong>);

1 row created.

SQL&gt; insert into t values(<strong>null</strong>);

1 row created.

SQL&gt; select avg(a) from t;

 AVG(A)
----------
         1
</pre>
<p>When I take an average of the 2 values in these rows I get average of 1.</p>
<p>Now lets update the NULL (no value) to 0 (an actual value of zero).</p>
<pre>SQL&gt; update t set a=0 where a is null;

1 row updated.

SQL&gt; select avg(a) from t;

 AVG(A)
----------
        .5
</pre>
<p>As you see, as we now have an actual value in the other row (as opposed to &#8220;no value&#8221;), the AVG function takes that zero into account.</p>
<p>Hopefully this illustrates once more that NULL does <em>not</em> mean zero or any other value, it means <em>NO value</em>. If you do aggregation functions (count,avg) over NULLs then you must understand that Oracle treats NULLs as no value and doesn&#8217;t account these &#8220;no values&#8221;, thus your queries may behave differently than what your intuition might say (and yes its always good to read documentation about what exactly a given SQL construction/function does in the given database engine instead of relying on &#8220;common sense&#8221;).</p>
<div class="facebook_like_button"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.tanelpoder.com%2F2009%2F12%2F30%2Fnull-is-not-zero%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="padding: 0px 0px; border:none; overflow:hidden; width:450px; height:70px;"></iframe></div> <img src="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=518" width="1" height="1" style="display: none;" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.tanelpoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.tanelpoder.com/2009/12/30/null-is-not-zero/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Measuring what matters</title>
		<link>http://blog.tanelpoder.com/2009/12/22/measuring-what-matters/</link>
		<comments>http://blog.tanelpoder.com/2009/12/22/measuring-what-matters/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 00:58:39 +0000</pubDate>
		<dc:creator>Tanel Poder</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Troubleshooting]]></category>

		<guid isPermaLink="false">http://blog.tanelpoder.com/?p=511</guid>
		<description><![CDATA[Cary Millsap&#8217;s recent post prompted me to write down some of the related thoughts in my head. Here are few of my mantras for systematic troubleshooting and performance tuning, which have materialized in my head over the years of work: Picking the right starting point to troubleshooting and performance tuning is the most important decision [...]]]></description>
			<content:encoded><![CDATA[<p>Cary Millsap&#8217;s <a href="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NhcnltaWxsc2FwLmJsb2dzcG90LmNvbS8yMDA5LzEyL215LXdob2xlLXN5c3RlbS1pcy1zbG93LW5vdy13aGF0Lmh0bWw=" target=\"_blank\">recent post</a> prompted me to write down some of the related thoughts in my head.</p>
<p>Here are few of my mantras for systematic troubleshooting and performance tuning, which have materialized in my head over the years of work:</p>
<ul>
<li>Picking the right starting point to troubleshooting and performance tuning is the most important decision in that process.</li>
<li>Pick the wrong starting point and you end up going in circles.</li>
<li>The scope of your performance data needs to match the scope of your problem, otherwise you end up going in circles.</li>
<li>If you don&#8217;t measure what matters, you may end up fixing what doesn&#8217;t matter.</li>
<li>If you&#8217;re not systematic in your troubleshooting, you may get lucky, but you don&#8217;t want to be dependent on luck! Moreover, you wont&#8217;t <em>need</em> to be lucky if you are systematic in your work!</li>
<li>Performance tuning is overrated. Fixing fundamental design and coding flaws via changing a magic configuration parameter is a dream just like is getting slim and healthy via eating magic diet pills bought from TV shop.</li>
<li>Your response times are too long for only two reasons:</li>
</ul>
<blockquote>
<ol>
<li>You are doing too much work</li>
<li>You are waiting for too much</li>
</ol>
</blockquote>
<p style="padding-left: 30px;">&#8230;both of the above things can be measured in Oracle&#8230;</p>
<ul>
<li>There&#8217;s no such thing as slow database or slow system. How can it be slow independently, without anyone experiencing this slowness?
<ul>
<li>If users say that a database is slow, they must be experiencing that somehow! The only way to experience database slowness is via a connection to it, in which case you&#8217;ll have a session (to measure).</li>
<li>If a monitoring system says that a database is slow, then it must be running and measuring response time of some task just like users do, otherwise it can not reliably say something is slow.</li>
</ul>
</li>
<li>Performance is about one thing and one thing only &#8211; <strong>time</strong>. And time is measured in seconds, not in CPU utilization, number of physical IOs or looks of an execution plan.</li>
</ul>
<p>Here&#8217;s a link to a Cary Millsap&#8217;s awesome post, read it!</p>
<ul>
<li><a href="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NhcnltaWxsc2FwLmJsb2dzcG90LmNvbS8yMDA5LzEyL215LXdob2xlLXN5c3RlbS1pcy1zbG93LW5vdy13aGF0Lmh0bWw=" target=\"_blank\">http://carymillsap.blogspot.com/2009/12/my-whole-system-is-slow-now-what.html</a></li>
</ul>
<p>By the way, as far as database design and writing SQL is concerned here&#8217;s a good chance to learn how to write SQL right from C. J. Date:</p>
<ul>
<li><a href="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL21ldGhvZC1yLmNvbS9lZHVjYXRpb24vMTA3LWNqLWRhdGUtY291cnNl">http://method-r.com/education/107-cj-date-course</a></li>
</ul>
<div class="facebook_like_button"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.tanelpoder.com%2F2009%2F12%2F22%2Fmeasuring-what-matters%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="padding: 0px 0px; border:none; overflow:hidden; width:450px; height:70px;"></iframe></div> <img src="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=511" width="1" height="1" style="display: none;" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.tanelpoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.tanelpoder.com/2009/12/22/measuring-what-matters/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>VLDB 2008 proceedings, Oracle optimizer plan stability, adaptive cursor sharing and SecureFiles</title>
		<link>http://blog.tanelpoder.com/2008/09/05/vldb-2008-proceedings-oracle-optimizer-plan-stability-adaptive-cursor-sharing-and-securefiles/</link>
		<comments>http://blog.tanelpoder.com/2008/09/05/vldb-2008-proceedings-oracle-optimizer-plan-stability-adaptive-cursor-sharing-and-securefiles/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 12:11:45 +0000</pubDate>
		<dc:creator>Tanel Poder</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Internals]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Oracle 11g]]></category>

		<guid isPermaLink="false">http://tanelpoder.wordpress.com/2008/09/05/vldb-2008-proceedings-oracle-optimizer-plan-stability-adaptive-cursor-sharing-and-securefiles/</guid>
		<description><![CDATA[If you&#8217;re interested in leading edge database research, the VLDB 2008 proceedings are publicly available now. Multiple Oracle-specific presentations are available on the industry track page Here are direct links to them: Oracle SecureFiles System Optimizer Plan Change Management: Improved Stability and Performance in Oracle 11g Closing The Query Processing Loop in Oracle 11g (this [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re interested in leading edge database research, the <a href="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly93d3cuc2UuYXVja2xhbmQuYWMubnovY29uZmVyZW5jZXMvVkxEQjIwMDhyZXNvdXJjZXMvcHJlc2VudGF0aW9ucy8=" target=\"_blank\">VLDB 2008 proceedings</a> are publicly available now.</p>
<p>Multiple Oracle-specific presentations are available on the <a href="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly93d3cuc2UuYXVja2xhbmQuYWMubnovY29uZmVyZW5jZXMvVkxEQjIwMDhyZXNvdXJjZXMvcHJlc2VudGF0aW9ucy9hX2luZHVzdHJ5LnhtbA==" target=\"_blank\">industry track page</a></p>
<p>Here are direct links to them:</p>
<ul>
<li><a href="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly93d3cuc2UuYXVja2xhbmQuYWMubnovY29uZmVyZW5jZXMvVkxEQjIwMDhyZXNvdXJjZXMvcHJlc2VudGF0aW9ucy9wYXBlcnMvSTA4LnBwdA==" target=\"_blank\">Oracle SecureFiles System</a></li>
<li><a href="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly93d3cuc2UuYXVja2xhbmQuYWMubnovY29uZmVyZW5jZXMvVkxEQjIwMDhyZXNvdXJjZXMvcHJlc2VudGF0aW9ucy9wYXBlcnMvSTEyLnBwdA==" target=\"_blank\">Optimizer Plan Change Management: Improved Stability and Performance in Oracle 11g</a></li>
<li><a href="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly93d3cuc2UuYXVja2xhbmQuYWMubnovY29uZmVyZW5jZXMvVkxEQjIwMDhyZXNvdXJjZXMvcHJlc2VudGF0aW9ucy9wYXBlcnMvSTE0LnBwdA==" target=\"_blank\">Closing The Query Processing Loop in Oracle 11g</a> <i>(this one is about adaptive cursor sharing)</i></li>
</ul>
<p>Enjoy! :)</p>
<div class="facebook_like_button"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.tanelpoder.com%2F2008%2F09%2F05%2Fvldb-2008-proceedings-oracle-optimizer-plan-stability-adaptive-cursor-sharing-and-securefiles%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="padding: 0px 0px; border:none; overflow:hidden; width:450px; height:70px;"></iframe></div> <img src="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=135" width="1" height="1" style="display: none;" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.tanelpoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.tanelpoder.com/2008/09/05/vldb-2008-proceedings-oracle-optimizer-plan-stability-adaptive-cursor-sharing-and-securefiles/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A gotcha with parallel index builds, parallel degree and query plans</title>
		<link>http://blog.tanelpoder.com/2007/06/23/a-gotcha-with-parallel-index-builds-parallel-degree-and-query-plans/</link>
		<comments>http://blog.tanelpoder.com/2007/06/23/a-gotcha-with-parallel-index-builds-parallel-degree-and-query-plans/#comments</comments>
		<pubDate>Sat, 23 Jun 2007 08:54:10 +0000</pubDate>
		<dc:creator>Tanel Poder</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://tanelpoder.wordpress.com/2007/06/23/a-gotcha-with-parallel-index-builds-parallel-degree-and-query-plans/</guid>
		<description><![CDATA[Reading the following article about PARALLEL hint by Jonathan Lewis made me remember a somewhat related gotcha with parallelism. Often when creating (or rebuilding) an index on a large table, doing it with PARALLEL x option makes it go faster &#8211; usually in case when your IO subsystem is not the bottleneck and you have [...]]]></description>
			<content:encoded><![CDATA[<p>Reading the <a target=\"_blank\" href="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2pvbmF0aGFubGV3aXMud29yZHByZXNzLmNvbS8yMDA3LzA2LzE3L2hpbnRzLWFnYWluLw==">following article </a>about PARALLEL hint by Jonathan Lewis made me remember a somewhat related gotcha with parallelism.</p>
<p>Often when creating (or rebuilding) an index on a large table, doing it with PARALLEL x option makes it go faster &#8211; usually in case when your IO subsystem is not the bottleneck <em>and</em> you have enough spare CPU capacity to throw in.</p>
<p>A small example below:</p>
<pre><code>

Tanel@Sol01&gt; create table t1 as select * from all_objects;

Table created.

Tanel@Sol01&gt; create index i1 on t1(object_id);

Index created.

Tanel@Sol01&gt; exec dbms_stats.gather_table_stats(user, 'T1', cascade=&gt;true, no_invalidate=&gt;false);

PL/SQL procedure successfully completed.

</code></pre>
<p>Ok, for whatever reason I need to rebuild my index, and for speed I do it in parallel:</p>
<pre><code>

Tanel@Sol01&gt; alter index i1 rebuild parallel 4;

Index altered.

Tanel@Sol01&gt;
Tanel@Sol01&gt;
Tanel@Sol01&gt; select
  2     sum(object_id)
  3  from
  4     t1
  5  where
  6     object_id &gt; 60000
  7  /

SUM(OBJECT_ID)
--------------
      13233374

Tanel@Sol01&gt;
Tanel@Sol01&gt; @x

PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------------
Plan hash value: 3900446664

--------------------------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |     1 |     5 |     8   (0)| 00:00:01 |
|   1 |  SORT AGGREGATE   |      |     1 |     5 |            |          |
|*  2 |   INDEX RANGE SCAN| I1   |  2923 | 14615 |     8   (0)| 00:00:01 |
--------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access("OBJECT_ID"&gt;60000)

14 rows selected.
</code></pre>
<p>The execution plan shows a nice serial range scan for above query. Let&#8217;s run the <em>same</em> query with a different value for object_id:</p>
<pre><code>

Tanel@Sol01&gt; select
  2     sum(object_id)
  3  from
  4     t1
  5  where
  6     object_id &gt; 10000
  7  /

SUM(OBJECT_ID)
--------------
    1294174783

Tanel@Sol01&gt;
Tanel@Sol01&gt; @x

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------
Plan hash value: 2596547647

-------------------------------------------------------------------------------------------------------------------
| Id  | Operation                 | Name     | Rows  | Bytes | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
-------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT          |          |     1 |     5 |    19   (0)| 00:00:02 |        |      |            |
|   1 |  SORT AGGREGATE           |          |     1 |     5 |            |          |        |      |            |
|   2 |   PX COORDINATOR          |          |       |       |            |          |        |      |            |
|   3 |    PX SEND QC (RANDOM)    | :TQ10000 |     1 |     5 |            |          |  Q1,00 | P-&gt;S | QC (RAND)  |
|   4 |     SORT AGGREGATE        |          |     1 |     5 |            |          |  Q1,00 | PCWP |            |
|   5 |      PX BLOCK ITERATOR    |          | 42937 |   209K|    19   (0)| 00:00:02 |  Q1,00 | PCWC |            |
|*  6 |       INDEX FAST FULL SCAN| I1       | 42937 |   209K|    19   (0)| 00:00:02 |  Q1,00 | PCWP |            |
-------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   6 - filter("OBJECT_ID"&gt;10000)

18 rows selected.
</code></pre>
<p>What? Suddenly my query turned parallel !</p>
<p>I haven&#8217;t enabled parallelism for my table! How can Oracle go parallel without my consent?</p>
<pre><code>
Tanel@Sol01&gt; select table_name, degree from user_tables  where table_name = 'T1';

TABLE_NAME                     DEGREE
------------------------------ ----------------------------------------
T1                                      1
</code></pre>
<p>The answer lies in the result of next query:</p>
<pre><code>
Tanel@Sol01&gt; select index_name, degree from user_indexes where table_name = 'T1';

INDEX_NAME                     DEGREE
------------------------------ ----------------------------------------
I1                             4

</code></pre>
<p>Parallel index (re)build will persistently set the index parallel degree in data dictionary to the value used during build!</p>
<p>This enables the CBO to be free to consider also parallel query plans and in our second select case a parallel plan seemed to be the best.</p>
<p>Whether this parallel plan actually is the most efficient way to go is a separate question, however this kind of <em>unplanned</em> parallelism may destabilize your system performance, especially as it can kick in only for certain instantiations of your SQL statement. Note that even one parallel-enabled object in your execution plan can parallelize the whole query joining many tables (just as even one table with statistics in a join turns on CBO for the whole cursor).</p>
<p>Combined with bind variable peeking side-effects and way too high parallel_max_servers value (hey it&#8217;s just a max value, let&#8217;s set it to 500), this can bring your OLTP system to knees at very unexpected times.</p>
<p>So, as my database does not have parallelism <em>planned</em> into it, I will eliminate the troublemaker:</p>
<pre><code>Tanel@Sol01&gt; alter index i1 noparallel;

Index altered.

Tanel@Sol01&gt;
Tanel@Sol01&gt; select
  2     sum(object_id)
  3  from
  4     t1
  5  where
  6     object_id &gt; 10000
  7  /

SUM(OBJECT_ID)
--------------
    1294174783

Tanel@Sol01&gt;
Tanel@Sol01&gt; @x

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------
Plan hash value: 129980005

------------------------------------------------------------------------------
| Id  | Operation             | Name | Rows  | Bytes | Cost (%CPU)| Time     |
------------------------------------------------------------------------------
|   0 | SELECT STATEMENT      |      |     1 |     5 |    19   (0)| 00:00:02 |
|   1 |  SORT AGGREGATE       |      |     1 |     5 |            |          |
|*  2 |   INDEX FAST FULL SCAN| I1   | 42937 |   209K|    19   (0)| 00:00:02 |
------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - filter("OBJECT_ID"&gt;10000)

14 rows selected.
</code></pre>
<p>So the key point is that unless your databases have <em>planned and managed</em> parallelism used in them, it&#8217;s worth to run the following query to identify potential troublemakers and disable their parallelism:</p>
<pre><code>
SELECT
	'INDEX' OBJECT_TYPE, OWNER, INDEX_NAME, TRIM(DEGREE)
FROM
	DBA_INDEXES
WHERE
	TRIM(DEGREE) &gt; TO_CHAR(1)
UNION ALL
SELECT
	'TABLE', OWNER, TABLE_NAME, TRIM(DEGREE)
FROM
	DBA_TABLES
WHERE
	TRIM(DEGREE) &gt; TO_CHAR(1)
/
</code></pre>
<p>On my test environment it returned the following rows:</p>
<pre><code>OBJEC OWNER                          INDEX_NAME                     TRIM(DEGREE)
----- ------------------------------ ------------------------------ -------------
INDEX SYS                            UTL_RECOMP_SORT_IDX1           DEFAULT
TABLE TANEL                          T                              4

</code></pre>
<p>From here we see two addtional things:</p>
<ul>
<li>Parallel operations also persist their degree to tables (using alter table move parallel x or CTAS for example)</li>
<li>There&#8217;s a parallel degree DEFAULT &#8211; which is used when you let the appropriate degree to be decided by optimizer</li>
</ul>
<p>On the other hand, if you have planned for parallelism, then you probably want to keep the parallelism for tables and indexes consistent, e.g. enable it for all tables requiring parallelism <em>and</em> their indexes, not just for couple of indexes by accident.</p>
<p><i>Update:</i><br />
Thanks to <a href="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5vcmFjbGUtZGV2ZWxvcGVyLm5ldC8=" target=\"_blank\">Adrian Billington</a> for reminding me that also NOLOGGING flag will stick in data dictionary should you perform nologging operations on an object. You should review those too after rebuilds and reorgs.</p>
<div class="facebook_like_button"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.tanelpoder.com%2F2007%2F06%2F23%2Fa-gotcha-with-parallel-index-builds-parallel-degree-and-query-plans%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="padding: 0px 0px; border:none; overflow:hidden; width:450px; height:70px;"></iframe></div> <img src="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=25" width="1" height="1" style="display: none;" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.tanelpoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.tanelpoder.com/2007/06/23/a-gotcha-with-parallel-index-builds-parallel-degree-and-query-plans/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
