<?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: Star Transformation</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2011/04/22/star-transformation/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2011/04/22/star-transformation/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Thu, 23 May 2013 12:47:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2011/04/22/star-transformation/#comment-42525</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Tue, 22 Nov 2011 08:12:00 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6215#comment-42525</guid>
		<description><![CDATA[Pravz,

If you mean that actual number of rows returned when you run the query (and this behavious is definitely happening when there&#039;s no chance that someone else has been changing the data) then it&#039;s a priority 1 bug (wrong results) and you should raise an SR.

If you mean the cardinality predicted in the execution plan changes then it&#039;s also a bug - though less important one - possibly related to other features of the costing.  You didn&#039;t say which vesion you are using, and I have an example where the cardinality prediction changes between 11.1 and 11.2; the change doesn&#039;t match your description, but it does show that a change is possible.]]></description>
		<content:encoded><![CDATA[<p>Pravz,</p>
<p>If you mean that actual number of rows returned when you run the query (and this behavious is definitely happening when there&#8217;s no chance that someone else has been changing the data) then it&#8217;s a priority 1 bug (wrong results) and you should raise an SR.</p>
<p>If you mean the cardinality predicted in the execution plan changes then it&#8217;s also a bug &#8211; though less important one &#8211; possibly related to other features of the costing.  You didn&#8217;t say which vesion you are using, and I have an example where the cardinality prediction changes between 11.1 and 11.2; the change doesn&#8217;t match your description, but it does show that a change is possible.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pravz</title>
		<link>http://jonathanlewis.wordpress.com/2011/04/22/star-transformation/#comment-42380</link>
		<dc:creator><![CDATA[Pravz]]></dc:creator>
		<pubDate>Tue, 15 Nov 2011 14:55:15 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6215#comment-42380</guid>
		<description><![CDATA[On enabling the star transformation the number of rows returned are more . Why is it so..??
Without star transformation enabled - Number of rows returned 14
With star transformation enabled - Number of rows returned 11K

Thanks for the help..!!]]></description>
		<content:encoded><![CDATA[<p>On enabling the star transformation the number of rows returned are more . Why is it so..??<br />
Without star transformation enabled &#8211; Number of rows returned 14<br />
With star transformation enabled &#8211; Number of rows returned 11K</p>
<p>Thanks for the help..!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2011/04/22/star-transformation/#comment-40435</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Tue, 26 Apr 2011 07:58:28 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6215#comment-40435</guid>
		<description><![CDATA[Andy,
Thanks for the correction - now fixed.

I don&#039;t know why the first appearance of the two temp tables shows the same name - but it&#039;s probably just a little bug in the &quot;explain plan&quot; bit of the code. 

It&#039;s an interesting little oddity that when I run the query with star transformation in 11.1.0.6 and pull the plan from memory the &quot;load as select&quot; lines don&#039;t hold a temporary table name at all.]]></description>
		<content:encoded><![CDATA[<p>Andy,<br />
Thanks for the correction &#8211; now fixed.</p>
<p>I don&#8217;t know why the first appearance of the two temp tables shows the same name &#8211; but it&#8217;s probably just a little bug in the &#8220;explain plan&#8221; bit of the code. </p>
<p>It&#8217;s an interesting little oddity that when I run the query with star transformation in 11.1.0.6 and pull the plan from memory the &#8220;load as select&#8221; lines don&#8217;t hold a temporary table name at all.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2011/04/22/star-transformation/#comment-40434</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Tue, 26 Apr 2011 07:47:33 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6215#comment-40434</guid>
		<description><![CDATA[Martin,

That was a nice piece of reverse engineering, well done.]]></description>
		<content:encoded><![CDATA[<p>Martin,</p>
<p>That was a nice piece of reverse engineering, well done.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://jonathanlewis.wordpress.com/2011/04/22/star-transformation/#comment-40433</link>
		<dc:creator><![CDATA[Andy]]></dc:creator>
		<pubDate>Tue, 26 Apr 2011 05:29:42 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6215#comment-40433</guid>
		<description><![CDATA[Hi Jonathan,

One extremely minor stuff: In the section where you explain the star transformation, second bullet point, you say &quot;Lines 15-20 we do the same....&quot; -- That should probably read &quot;Lines 16-20....&quot; , right?

And one question: Why do the two temp tables generated for the PRODUCTS and CUSTOMERS tables share the same system generated name ( SYS_TEMP_0FD9D6601_17047D9 ) at the top part of the plan?  The temp tables clearly have different names at the bottom of the plan.

Regards]]></description>
		<content:encoded><![CDATA[<p>Hi Jonathan,</p>
<p>One extremely minor stuff: In the section where you explain the star transformation, second bullet point, you say &#8220;Lines 15-20 we do the same&#8230;.&#8221; &#8212; That should probably read &#8220;Lines 16-20&#8230;.&#8221; , right?</p>
<p>And one question: Why do the two temp tables generated for the PRODUCTS and CUSTOMERS tables share the same system generated name ( SYS_TEMP_0FD9D6601_17047D9 ) at the top part of the plan?  The temp tables clearly have different names at the bottom of the plan.</p>
<p>Regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Log Buffer #217, A Carnival of the Vanities for DBAs &#124; The Pythian Blog</title>
		<link>http://jonathanlewis.wordpress.com/2011/04/22/star-transformation/#comment-40431</link>
		<dc:creator><![CDATA[Log Buffer #217, A Carnival of the Vanities for DBAs &#124; The Pythian Blog]]></dc:creator>
		<pubDate>Mon, 25 Apr 2011 04:53:23 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6215#comment-40431</guid>
		<description><![CDATA[[...] Jonathan Lewis gives another great example of how it was possible to find queries which ran faster if you manually de-coupled the index and table accesses. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Jonathan Lewis gives another great example of how it was possible to find queries which ran faster if you manually de-coupled the index and table accesses. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Preiss</title>
		<link>http://jonathanlewis.wordpress.com/2011/04/22/star-transformation/#comment-40428</link>
		<dc:creator><![CDATA[Martin Preiss]]></dc:creator>
		<pubDate>Sun, 24 Apr 2011 15:06:32 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6215#comment-40428</guid>
		<description><![CDATA[Jonathan,

thank you for the clarification - I should read more carefully ...

Without cpu costing (/*+ opt_param(&#039;_optimizer_cost_model&#039;,&#039;io&#039;) */) the cost for the FTS on products drop to 84, and when I recreate the table in another non-ASSM tablespace I get your value of 81 (I guess: because of the different HWM). Without cpu costing I also get the plan with two hash joins.

To get to the cost of 14 I had to set db_file_multiblock_read_count=128 - and that was a little surprise because the parameter had already this value (according to v$system_parameters); but then I remembered that there are hidden parameters to define different MBRC values for costing and for data access (_db_file_exec_read_count=128 and _db_file_optimizer_read_count=8). So I got my numbers sorted ...]]></description>
		<content:encoded><![CDATA[<p>Jonathan,</p>
<p>thank you for the clarification &#8211; I should read more carefully &#8230;</p>
<p>Without cpu costing (/*+ opt_param(&#8216;_optimizer_cost_model&#8217;,'io&#8217;) */) the cost for the FTS on products drop to 84, and when I recreate the table in another non-ASSM tablespace I get your value of 81 (I guess: because of the different HWM). Without cpu costing I also get the plan with two hash joins.</p>
<p>To get to the cost of 14 I had to set db_file_multiblock_read_count=128 &#8211; and that was a little surprise because the parameter had already this value (according to v$system_parameters); but then I remembered that there are hidden parameters to define different MBRC values for costing and for data access (_db_file_exec_read_count=128 and _db_file_optimizer_read_count=8). So I got my numbers sorted &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2011/04/22/star-transformation/#comment-40425</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Sun, 24 Apr 2011 10:44:59 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6215#comment-40425</guid>
		<description><![CDATA[Martin,

Your plan is covered by this comment: &lt;i&gt;&quot;discard a large fraction of those rows by indexing (&lt;strong&gt;or possibly doing a hash join&lt;/strong&gt;) into the second dimension table&quot;&lt;/i&gt;. 

In passing, even though you&#039;ve used my code to generate the data, there are still things like database parameters and system statistics (CPU Costing) that can vary;  not to mention the possibility of stats gathering samples being different. You&#039;ll notice, as an easy comparison, your line 9 shows a full tablescan of products at a cost of 209 with 2% CPU - my first example shows a cost of 14 without CPU (because I&#039;d disable CPU costing). In fact when you get to my manually rewritten code you can see that I must triggered some change to my environment because the cost of the products tablescan in that plan is 81.]]></description>
		<content:encoded><![CDATA[<p>Martin,</p>
<p>Your plan is covered by this comment: <i>&#8220;discard a large fraction of those rows by indexing (<strong>or possibly doing a hash join</strong>) into the second dimension table&#8221;</i>. </p>
<p>In passing, even though you&#8217;ve used my code to generate the data, there are still things like database parameters and system statistics (CPU Costing) that can vary;  not to mention the possibility of stats gathering samples being different. You&#8217;ll notice, as an easy comparison, your line 9 shows a full tablescan of products at a cost of 209 with 2% CPU &#8211; my first example shows a cost of 14 without CPU (because I&#8217;d disable CPU costing). In fact when you get to my manually rewritten code you can see that I must triggered some change to my environment because the cost of the products tablescan in that plan is 81.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2011/04/22/star-transformation/#comment-40424</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Sun, 24 Apr 2011 10:37:12 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6215#comment-40424</guid>
		<description><![CDATA[Hemant,

Thanks for the comment - I try to make a big thing about clarity in my presentations on writing efficient SQL, and I think that Oracle helps us make complex things appear simpler by allowing us to use inline views (or subquery factoring - although that sometimes causes undesirable side effects). 

&lt;ul&gt;&lt;i&gt;However most of us (or I) very rarely think of using three hints together. &lt;/i&gt;&lt;ul&gt;

I probably ought to admit, here, that I&#039;ve actually not used enough hints - to my mind once you start putting in a &quot;micro-management&quot; hint like &lt;i&gt;use_nl()&lt;/i&gt; you need to define the entire shape of the plan: so my three hints should have been five, because along with the &lt;em&gt;no_merge&lt;/em&gt; hint I should have had:
&lt;ul&gt;
join order for the query block - leading()
join method for every join - use_nl()
access method for every table - full(prd) index(ord (id_product))
&lt;/ul&gt;

I&#039;ve written several notes about &lt;a href=&quot;http://jonathanlewis.wordpress.com/2006/11/11/what-is-a-hint/&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;&lt;strong&gt;the diffculties of using hints well&lt;/strong&gt;&lt;/em&gt;&lt;/a&gt; - in this case I should have been more strict with myself.]]></description>
		<content:encoded><![CDATA[<p>Hemant,</p>
<p>Thanks for the comment &#8211; I try to make a big thing about clarity in my presentations on writing efficient SQL, and I think that Oracle helps us make complex things appear simpler by allowing us to use inline views (or subquery factoring &#8211; although that sometimes causes undesirable side effects). </p>
<ul><i>However most of us (or I) very rarely think of using three hints together. </i></ul>
<ul>
<p>I probably ought to admit, here, that I&#8217;ve actually not used enough hints &#8211; to my mind once you start putting in a &#8220;micro-management&#8221; hint like <i>use_nl()</i> you need to define the entire shape of the plan: so my three hints should have been five, because along with the <em>no_merge</em> hint I should have had:
</ul>
<ul>
join order for the query block &#8211; leading()<br />
join method for every join &#8211; use_nl()<br />
access method for every table &#8211; full(prd) index(ord (id_product))
</ul>
<p>I&#8217;ve written several notes about <a href="http://jonathanlewis.wordpress.com/2006/11/11/what-is-a-hint/" rel="nofollow"><em><strong>the diffculties of using hints well</strong></em></a> &#8211; in this case I should have been more strict with myself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2011/04/22/star-transformation/#comment-40423</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Sun, 24 Apr 2011 10:10:50 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6215#comment-40423</guid>
		<description><![CDATA[Bhavik Desai,

&lt;blockquote&gt;&lt;em&gt;I just wanted to ask, how do we find whether star transformation is useful in such scenario or not ? Is there any way to identify whether bitmap conversions or index_joins are getting costlier ?&lt;/em&gt;&lt;/blockquote&gt;

If the problem had been simple enough to answer in a comment to a blog it would be so simple that it would have been coded into the optimizer and you wouldn&#039;t have needed to ask the question.  If the optimizer can&#039;t work it out you need to work it out for yourself, using your knowledge of the data to build a better model of the optimizer. See, for example, this article I wrote for &lt;em&gt;&lt;strong&gt;&lt;a href=&quot;http://www.simple-talk.com/sql/performance/designing-efficient-sql-a-visual-approach/&quot; rel=&quot;nofollow&quot;&gt;Simple Talk&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;.]]></description>
		<content:encoded><![CDATA[<p>Bhavik Desai,</p>
<blockquote><p><em>I just wanted to ask, how do we find whether star transformation is useful in such scenario or not ? Is there any way to identify whether bitmap conversions or index_joins are getting costlier ?</em></p></blockquote>
<p>If the problem had been simple enough to answer in a comment to a blog it would be so simple that it would have been coded into the optimizer and you wouldn&#8217;t have needed to ask the question.  If the optimizer can&#8217;t work it out you need to work it out for yourself, using your knowledge of the data to build a better model of the optimizer. See, for example, this article I wrote for <em><strong><a href="http://www.simple-talk.com/sql/performance/designing-efficient-sql-a-visual-approach/" rel="nofollow">Simple Talk</a></strong></em>.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
