<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: What does it Mean when a Select Statement in Oracle is using 100% CPU?</title>
	<atom:link href="http://hoopercharles.wordpress.com/2013/02/14/what-does-it-mean-when-a-select-statement-in-oracle-is-using-100-cpu/feed/" rel="self" type="application/rss+xml" />
	<link>http://hoopercharles.wordpress.com/2013/02/14/what-does-it-mean-when-a-select-statement-in-oracle-is-using-100-cpu/</link>
	<description>Miscellaneous Random Oracle Topics: Stop, Think, ... Understand</description>
	<lastBuildDate>Mon, 13 May 2013 14:10:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2013/02/14/what-does-it-mean-when-a-select-statement-in-oracle-is-using-100-cpu/#comment-5262</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Fri, 15 Feb 2013 11:33:26 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=6866#comment-5262</guid>
		<description><![CDATA[I thought that I would explore the following question a little:
&lt;i&gt;1. What does it mean when a Select statement in Oracle is using 100% CPU?&lt;/i&gt;

One of my first questions would be how was it determined that a SELECT statement was using 100% CPU?  The duration of the 100% CPU usage, if in fact it existed, is also important.  Does the server only have a single CPU core, or is the query implementing parallel query?  What more important task is interrupted when the query uses a lot of CPU time?

It might be worthwhile to look at a couple of execution plans that were previously provided by a reader (see: http://hoopercharles.wordpress.com/2011/01/03/no_query_transformation-hint-is-ignored-well-almost-ignored/#comment-2597 )
&lt;pre&gt;
SQL_ID  3u689tu6mfkdw, child number 0
-------------------------------------
select count(*) from kso.little_skew a left outer join kso.little_skew
b on a.pk_col = b.pk_col
 
Plan hash value: 1386718486
 
---------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation                   &#124; Name        &#124; Rows  &#124; Bytes &#124;TempSpc&#124; Cost (%CPU)&#124; Time     &#124;
---------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT            &#124;             &#124;       &#124;       &#124;       &#124;  4984 (100)&#124;          &#124;
&#124;   1 &#124;  SORT AGGREGATE             &#124;             &#124;     1 &#124;    12 &#124;       &#124;            &#124;          &#124;
&#124;*  2 &#124;   HASH JOIN OUTER           &#124;             &#124;  1210K&#124;    13M&#124;    18M&#124;  4984   (1)&#124; 00:01:00 &#124;
&#124;   3 &#124;    TABLE ACCESS STORAGE FULL&#124; LITTLE_SKEW &#124;  1100K&#124;  6445K&#124;       &#124;  1546   (1)&#124; 00:00:19 &#124;
&#124;   4 &#124;    TABLE ACCESS STORAGE FULL&#124; LITTLE_SKEW &#124;  1100K&#124;  6445K&#124;       &#124;  1546   (1)&#124; 00:00:19 &#124;
---------------------------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   2 - access(&quot;A&quot;.&quot;PK_COL&quot;=&quot;B&quot;.&quot;PK_COL&quot;)
&lt;/pre&gt;
 
&lt;pre&gt;
SQL_ID  6x3g2dtmwgvyu, child number 0
-------------------------------------
select /*+ NO_QUERY_TRANSFORMATION */ count(*) from kso.little_skew a
left outer join kso.little_skew b on a.pk_col = b.pk_col
 
Plan hash value: 2156590542
 
---------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation                     &#124; Name        &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
---------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT              &#124;             &#124;       &#124;       &#124;  1703M(100)&#124;          &#124;
&#124;   1 &#124;  SORT AGGREGATE               &#124;             &#124;     1 &#124;       &#124;            &#124;          &#124;
&#124;   2 &#124;   VIEW                        &#124;             &#124;    12G&#124;       &#124;  1703M  (1)&#124;999:59:59 &#124;
&#124;   3 &#124;    NESTED LOOPS OUTER         &#124;             &#124;    12G&#124;    67G&#124;  1703M  (1)&#124;999:59:59 &#124;
&#124;   4 &#124;     TABLE ACCESS STORAGE FULL &#124; LITTLE_SKEW &#124;  1100K&#124;  6445K&#124;  1546   (1)&#124; 00:00:19 &#124;
&#124;   5 &#124;     VIEW                      &#124;             &#124; 11001 &#124;       &#124;  1548   (1)&#124; 00:00:19 &#124;
&#124;*  6 &#124;      TABLE ACCESS STORAGE FULL&#124; LITTLE_SKEW &#124; 11001 &#124; 66006 &#124;  1548   (1)&#124; 00:00:19 &#124;
---------------------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   6 - filter(&quot;A&quot;.&quot;PK_COL&quot;=&quot;B&quot;.&quot;PK_COL&quot;)
&lt;/pre&gt;

Is it the 100 in the Cost (%CPU) column that is of concern?  Both of the above execution plans show the same (100) value on the first line of the execution plans.

(&lt;i&gt;Edit Feb 15, 2013&lt;/i&gt; - I just noticed that Tanel Poder posted a related blog article yesterday that describes an approach to troubleshooting excessive CPU utilization for a SQL statement: http://blog.tanelpoder.com/2013/02/14/troubleshooting-high-cpu-usage-with-poor-mans-stack-profiler-in-a-one-liner/ )]]></description>
		<content:encoded><![CDATA[<p>I thought that I would explore the following question a little:<br />
<i>1. What does it mean when a Select statement in Oracle is using 100% CPU?</i></p>
<p>One of my first questions would be how was it determined that a SELECT statement was using 100% CPU?  The duration of the 100% CPU usage, if in fact it existed, is also important.  Does the server only have a single CPU core, or is the query implementing parallel query?  What more important task is interrupted when the query uses a lot of CPU time?</p>
<p>It might be worthwhile to look at a couple of execution plans that were previously provided by a reader (see: <a href="http://hoopercharles.wordpress.com/2011/01/03/no_query_transformation-hint-is-ignored-well-almost-ignored/#comment-2597" rel="nofollow">http://hoopercharles.wordpress.com/2011/01/03/no_query_transformation-hint-is-ignored-well-almost-ignored/#comment-2597</a> )</p>
<pre>
SQL_ID  3u689tu6mfkdw, child number 0
-------------------------------------
select count(*) from kso.little_skew a left outer join kso.little_skew
b on a.pk_col = b.pk_col
 
Plan hash value: 1386718486
 
---------------------------------------------------------------------------------------------------
| Id  | Operation                   | Name        | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
---------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |             |       |       |       |  4984 (100)|          |
|   1 |  SORT AGGREGATE             |             |     1 |    12 |       |            |          |
|*  2 |   HASH JOIN OUTER           |             |  1210K|    13M|    18M|  4984   (1)| 00:01:00 |
|   3 |    TABLE ACCESS STORAGE FULL| LITTLE_SKEW |  1100K|  6445K|       |  1546   (1)| 00:00:19 |
|   4 |    TABLE ACCESS STORAGE FULL| LITTLE_SKEW |  1100K|  6445K|       |  1546   (1)| 00:00:19 |
---------------------------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   2 - access("A"."PK_COL"="B"."PK_COL")
</pre>
<pre>
SQL_ID  6x3g2dtmwgvyu, child number 0
-------------------------------------
select /*+ NO_QUERY_TRANSFORMATION */ count(*) from kso.little_skew a
left outer join kso.little_skew b on a.pk_col = b.pk_col
 
Plan hash value: 2156590542
 
---------------------------------------------------------------------------------------------
| Id  | Operation                     | Name        | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT              |             |       |       |  1703M(100)|          |
|   1 |  SORT AGGREGATE               |             |     1 |       |            |          |
|   2 |   VIEW                        |             |    12G|       |  1703M  (1)|999:59:59 |
|   3 |    NESTED LOOPS OUTER         |             |    12G|    67G|  1703M  (1)|999:59:59 |
|   4 |     TABLE ACCESS STORAGE FULL | LITTLE_SKEW |  1100K|  6445K|  1546   (1)| 00:00:19 |
|   5 |     VIEW                      |             | 11001 |       |  1548   (1)| 00:00:19 |
|*  6 |      TABLE ACCESS STORAGE FULL| LITTLE_SKEW | 11001 | 66006 |  1548   (1)| 00:00:19 |
---------------------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   6 - filter("A"."PK_COL"="B"."PK_COL")
</pre>
<p>Is it the 100 in the Cost (%CPU) column that is of concern?  Both of the above execution plans show the same (100) value on the first line of the execution plans.</p>
<p>(<i>Edit Feb 15, 2013</i> &#8211; I just noticed that Tanel Poder posted a related blog article yesterday that describes an approach to troubleshooting excessive CPU utilization for a SQL statement: <a href="http://blog.tanelpoder.com/2013/02/14/troubleshooting-high-cpu-usage-with-poor-mans-stack-profiler-in-a-one-liner/" rel="nofollow">http://blog.tanelpoder.com/2013/02/14/troubleshooting-high-cpu-usage-with-poor-mans-stack-profiler-in-a-one-liner/</a> )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2013/02/14/what-does-it-mean-when-a-select-statement-in-oracle-is-using-100-cpu/#comment-5261</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Fri, 15 Feb 2013 01:44:58 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=6866#comment-5261</guid>
		<description><![CDATA[Good ideas so far to help people in search of solutions to the problems that might have led to the Internet searches  - I will try to summarize the ideas as they arrive, listed at the bottom of the blog article.

The blog article intentionally suggests in a subtle (but possibly humorous) way that maybe a distinction is necessary.  Is the SQL statement performing necessary work, and if so, what does it indicate when that SQL statement uses 100% CPU?  In such a case, is it necessarily bad that the SQL statement uses 100% of the CPU, or is that level of CPU consumption possibly ideal.  What is the alternative to using CPU... would it be better or worse if the session were instead in a wait event rather than consuming CPU time?]]></description>
		<content:encoded><![CDATA[<p>Good ideas so far to help people in search of solutions to the problems that might have led to the Internet searches  &#8211; I will try to summarize the ideas as they arrive, listed at the bottom of the blog article.</p>
<p>The blog article intentionally suggests in a subtle (but possibly humorous) way that maybe a distinction is necessary.  Is the SQL statement performing necessary work, and if so, what does it indicate when that SQL statement uses 100% CPU?  In such a case, is it necessarily bad that the SQL statement uses 100% of the CPU, or is that level of CPU consumption possibly ideal.  What is the alternative to using CPU&#8230; would it be better or worse if the session were instead in a wait event rather than consuming CPU time?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy Kendrick</title>
		<link>http://hoopercharles.wordpress.com/2013/02/14/what-does-it-mean-when-a-select-statement-in-oracle-is-using-100-cpu/#comment-5258</link>
		<dc:creator><![CDATA[Jeremy Kendrick]]></dc:creator>
		<pubDate>Thu, 14 Feb 2013 17:42:43 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=6866#comment-5258</guid>
		<description><![CDATA[the quick response from googling the error code seems to be something to do with data type conversion.  That answer sounds plausible for all three questions.  I seem to recall something similar happening with some of your custom built software after updating the Oracle database and the ERP software there. Some of the fields had changed from a string to a date format (Vice/versa) or they went to using a new field format that we learned was meant for handling files instead of small data strings (Blobs or something like that).]]></description>
		<content:encoded><![CDATA[<p>the quick response from googling the error code seems to be something to do with data type conversion.  That answer sounds plausible for all three questions.  I seem to recall something similar happening with some of your custom built software after updating the Oracle database and the ERP software there. Some of the fields had changed from a string to a date format (Vice/versa) or they went to using a new field format that we learned was meant for handling files instead of small data strings (Blobs or something like that).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rodger</title>
		<link>http://hoopercharles.wordpress.com/2013/02/14/what-does-it-mean-when-a-select-statement-in-oracle-is-using-100-cpu/#comment-5256</link>
		<dc:creator><![CDATA[Rodger]]></dc:creator>
		<pubDate>Thu, 14 Feb 2013 15:51:24 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=6866#comment-5256</guid>
		<description><![CDATA[In my experience, 100% CPU can be caused by a cartesian product in a SQL query.

That resolves to billions of rows. When any and all tables in the query have only hundreds or thousands or rows. 

I&#039;ve come up with 5 ways to get cartesian product in a SQL query.  See my research and presentation here:
http://rodgersnotes.wordpress.com/2010/09/15/stamping-out-cartesian-products/]]></description>
		<content:encoded><![CDATA[<p>In my experience, 100% CPU can be caused by a cartesian product in a SQL query.</p>
<p>That resolves to billions of rows. When any and all tables in the query have only hundreds or thousands or rows. </p>
<p>I&#8217;ve come up with 5 ways to get cartesian product in a SQL query.  See my research and presentation here:<br />
<a href="http://rodgersnotes.wordpress.com/2010/09/15/stamping-out-cartesian-products/" rel="nofollow">http://rodgersnotes.wordpress.com/2010/09/15/stamping-out-cartesian-products/</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
