<?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: Lateral LOBs</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2008/11/19/lateral-lobs/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2008/11/19/lateral-lobs/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Sat, 18 May 2013 11:04:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: ANSI Outer &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2008/11/19/lateral-lobs/#comment-39363</link>
		<dc:creator><![CDATA[ANSI Outer &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Mon, 31 Jan 2011 19:04:12 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=743#comment-39363</guid>
		<description><![CDATA[[...] look at the 10053 trace file for the ANSI example you&#039;ll find that Oracle has rewritten it with a LATERAL subquery before optimising it. So, presumably, we can appply the same transformation [...]]]></description>
		<content:encoded><![CDATA[<p>[...] look at the 10053 trace file for the ANSI example you&#039;ll find that Oracle has rewritten it with a LATERAL subquery before optimising it. So, presumably, we can appply the same transformation [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yasser</title>
		<link>http://jonathanlewis.wordpress.com/2008/11/19/lateral-lobs/#comment-35062</link>
		<dc:creator><![CDATA[Yasser]]></dc:creator>
		<pubDate>Wed, 23 Dec 2009 16:35:15 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=743#comment-35062</guid>
		<description><![CDATA[Tom,
Might be replying very late on this blog.
You can opt for Extensible Optimizer which has been explained in-depth by Joze Senegacnik, please search in google or refer book Expert Oracle Practices

-Yasser]]></description>
		<content:encoded><![CDATA[<p>Tom,<br />
Might be replying very late on this blog.<br />
You can opt for Extensible Optimizer which has been explained in-depth by Joze Senegacnik, please search in google or refer book Expert Oracle Practices</p>
<p>-Yasser</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL JOIN &#8211; aggiornamento &#171; Oracle and other</title>
		<link>http://jonathanlewis.wordpress.com/2008/11/19/lateral-lobs/#comment-32929</link>
		<dc:creator><![CDATA[SQL JOIN &#8211; aggiornamento &#171; Oracle and other]]></dc:creator>
		<pubDate>Fri, 08 May 2009 14:49:00 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=743#comment-32929</guid>
		<description><![CDATA[[...] meccanismo del &#8220;lateral join&#8221; e mette un link a un suo vecchio post intitolato &#8220;Lateral LOBs&#8220;, che parla in realtà di lateral views . In questo post viene descritta [...]]]></description>
		<content:encoded><![CDATA[<p>[...] meccanismo del &#8220;lateral join&#8221; e mette un link a un suo vecchio post intitolato &#8220;Lateral LOBs&#8220;, che parla in realtà di lateral views . In questo post viene descritta [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Gaines</title>
		<link>http://jonathanlewis.wordpress.com/2008/11/19/lateral-lobs/#comment-32925</link>
		<dc:creator><![CDATA[Tom Gaines]]></dc:creator>
		<pubDate>Thu, 07 May 2009 22:43:38 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=743#comment-32925</guid>
		<description><![CDATA[Very nice!  I found my way to this blog entry via your &quot;Dependent Plans&quot; discussion, and I was impressed by your work there.

Your reference to the cardinality hint was almost in passing, but I found it most interesting and useful in my situation.  My developers have recently gotten into the habit of writing queries like this inside of PL/SQL programs:

&lt;code&gt;
select&#160;....
from&#160;mytab
where&#160;job_code&#160;in&#160;(select&#160;code&#160;from&#160;table(cast(myvar&#160;as&#160;mytype)))&#160;and&#160;....
&lt;/code&gt;

where myvar is an Oracle variable of a user-defined table type.  It bothered me greatly to see full table scans on the very large mytab table when I knew that the myvar variable contained just a handful of values.  But I knew of no way to persuade the CBO to do the preferred index access instead of an FTS.  The cardinality hint is just perfect in our case, and now I&#039;ll be recommending something of this form:

&lt;code&gt;
select&#160;....
from&#160;mytab
where&#160;job_code&#160;in&#160;(select&#160;/*+&#160;cardinality&#160;(pv&#160;10)&#160;*/&#160;code&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;from&#160;table(cast(myvar&#160;as&#160;mytype))&#160;pv)&#160;and&#160;....
&lt;/code&gt;

I&#039;ve tested this quite a bit and I&#039;m very pleased with the results.  Thank you for the suggestion!

I do, however, have a followup question.  In most cases, I can reasonably predict the number of rows in the table variables that I&#039;ll discuss with my developers.  Are you aware of any other mechanisms that I could employ to dynamically inform the CBO of the sizes of the table variables so that it could decide the best execution path?  

This may be a non-concern because there are obvious drawbacks to putting more than a few values into any table variable.  I&#039;m thinking PGA here, of course.

Thanks for your time.]]></description>
		<content:encoded><![CDATA[<p>Very nice!  I found my way to this blog entry via your &#8220;Dependent Plans&#8221; discussion, and I was impressed by your work there.</p>
<p>Your reference to the cardinality hint was almost in passing, but I found it most interesting and useful in my situation.  My developers have recently gotten into the habit of writing queries like this inside of PL/SQL programs:</p>
<p><code><br />
select&nbsp;....<br />
from&nbsp;mytab<br />
where&nbsp;job_code&nbsp;in&nbsp;(select&nbsp;code&nbsp;from&nbsp;table(cast(myvar&nbsp;as&nbsp;mytype)))&nbsp;and&nbsp;....<br />
</code></p>
<p>where myvar is an Oracle variable of a user-defined table type.  It bothered me greatly to see full table scans on the very large mytab table when I knew that the myvar variable contained just a handful of values.  But I knew of no way to persuade the CBO to do the preferred index access instead of an FTS.  The cardinality hint is just perfect in our case, and now I&#8217;ll be recommending something of this form:</p>
<p><code><br />
select&nbsp;....<br />
from&nbsp;mytab<br />
where&nbsp;job_code&nbsp;in&nbsp;(select&nbsp;/*+&nbsp;cardinality&nbsp;(pv&nbsp;10)&nbsp;*/&nbsp;code&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;table(cast(myvar&nbsp;as&nbsp;mytype))&nbsp;pv)&nbsp;and&nbsp;....<br />
</code></p>
<p>I&#8217;ve tested this quite a bit and I&#8217;m very pleased with the results.  Thank you for the suggestion!</p>
<p>I do, however, have a followup question.  In most cases, I can reasonably predict the number of rows in the table variables that I&#8217;ll discuss with my developers.  Are you aware of any other mechanisms that I could employ to dynamically inform the CBO of the sizes of the table variables so that it could decide the best execution path?  </p>
<p>This may be a non-concern because there are obvious drawbacks to putting more than a few values into any table variable.  I&#8217;m thinking PGA here, of course.</p>
<p>Thanks for your time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dependent Plans &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2008/11/19/lateral-lobs/#comment-32900</link>
		<dc:creator><![CDATA[Dependent Plans &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Tue, 05 May 2009 18:10:01 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=743#comment-32900</guid>
		<description><![CDATA[[...] is the result set from a call to dbms_xplan.display_cursor, and the join is a variation of the lateral join mechanism which takes as its inputs some values from a earlier object in the from [...]]]></description>
		<content:encoded><![CDATA[<p>[...] is the result set from a call to dbms_xplan.display_cursor, and the join is a variation of the lateral join mechanism which takes as its inputs some values from a earlier object in the from [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2008/11/19/lateral-lobs/#comment-32531</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Mon, 12 Jan 2009 15:20:56 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=743#comment-32531</guid>
		<description><![CDATA[Michael,

You&#039;re quite right. 

I was using the function to demonstrate a point - but I should have said something to make it clear that it was a deliberate abuse of the &quot;deterministic&quot; key word.  

(In Practical 8i, I made the point very clearly by creating a function that returned the result of a call to the dbms_random package.)]]></description>
		<content:encoded><![CDATA[<p>Michael,</p>
<p>You&#8217;re quite right. </p>
<p>I was using the function to demonstrate a point &#8211; but I should have said something to make it clear that it was a deliberate abuse of the &#8220;deterministic&#8221; key word.  </p>
<p>(In Practical 8i, I made the point very clearly by creating a function that returned the result of a call to the dbms_random package.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Garfield Sørensen</title>
		<link>http://jonathanlewis.wordpress.com/2008/11/19/lateral-lobs/#comment-32513</link>
		<dc:creator><![CDATA[Michael Garfield Sørensen]]></dc:creator>
		<pubDate>Wed, 07 Jan 2009 21:38:42 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=743#comment-32513</guid>
		<description><![CDATA[Jonathan,
In your book Cost-Based Oracle Fundamentals, p. 219, you have also &quot;misused&quot; &lt;b&gt;deterministic&lt;/b&gt; in &lt;code&gt;function get_dept_avg&lt;/code&gt;.

I&#039;ve witnessed things such as intermittent ORA-600 errors and even plain wrong  (and not just stale) results when declaring functions that aren&#039;t really deterministic as deterministic. Think about it... If a function is deterministic Oracle may or may not call the function a second/third/... time (it may need to call it a second time, if the result is not longer cached, but I believe it may choose to call it again for a number of reasons). When you lie to Oracle &quot;all bets are off&quot; - be careful!]]></description>
		<content:encoded><![CDATA[<p>Jonathan,<br />
In your book Cost-Based Oracle Fundamentals, p. 219, you have also &#8220;misused&#8221; <b>deterministic</b> in <code>function get_dept_avg</code>.</p>
<p>I&#8217;ve witnessed things such as intermittent ORA-600 errors and even plain wrong  (and not just stale) results when declaring functions that aren&#8217;t really deterministic as deterministic. Think about it&#8230; If a function is deterministic Oracle may or may not call the function a second/third/&#8230; time (it may need to call it a second time, if the result is not longer cached, but I believe it may choose to call it again for a number of reasons). When you lie to Oracle &#8220;all bets are off&#8221; &#8211; be careful!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2008/11/19/lateral-lobs/#comment-32297</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 26 Nov 2008 00:04:16 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=743#comment-32297</guid>
		<description><![CDATA[Flado,
The benefit (to me) of declaring the function with a return type of (effectively) varchar2(60) was that I could do a highly visible demonstration of the principle of testing a critical boundary condition.  If you wanted to implement this on a production system there are various reasons why a much larger return would probably be sensible.

A function which passes the CLOB as its input could well be more efficient than any other option - it&#039;s something I would want to test before implementing a live solution.  

I will be posting a couple of other notes about the oddities (and overheads) of manipulating LOBs at some future date.

Michael,
Good point about the &lt;b&gt;deterministic&lt;/b&gt; declaration. I typed that in on auto-pilot without thinking about it - you&#039;re right, it shouldn&#039;t be there and I&#039;ve taken it out.]]></description>
		<content:encoded><![CDATA[<p>Flado,<br />
The benefit (to me) of declaring the function with a return type of (effectively) varchar2(60) was that I could do a highly visible demonstration of the principle of testing a critical boundary condition.  If you wanted to implement this on a production system there are various reasons why a much larger return would probably be sensible.</p>
<p>A function which passes the CLOB as its input could well be more efficient than any other option &#8211; it&#8217;s something I would want to test before implementing a live solution.  </p>
<p>I will be posting a couple of other notes about the oddities (and overheads) of manipulating LOBs at some future date.</p>
<p>Michael,<br />
Good point about the <b>deterministic</b> declaration. I typed that in on auto-pilot without thinking about it &#8211; you&#8217;re right, it shouldn&#8217;t be there and I&#8217;ve taken it out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Flado</title>
		<link>http://jonathanlewis.wordpress.com/2008/11/19/lateral-lobs/#comment-32276</link>
		<dc:creator><![CDATA[Flado]]></dc:creator>
		<pubDate>Fri, 21 Nov 2008 13:19:54 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=743#comment-32276</guid>
		<description><![CDATA[Oops... True, that.

Well then, declare the function to take the CLOB as an IN parameter instead of the ID. Would be deterministic and save a &quot;context switch&quot;, too. Although one could question the benefit of it being deterministic in this case (don&#039;t know if SQL can cache function results for functions with LOB parameters, or for pipelined functions, for that matter)

Flado]]></description>
		<content:encoded><![CDATA[<p>Oops&#8230; True, that.</p>
<p>Well then, declare the function to take the CLOB as an IN parameter instead of the ID. Would be deterministic and save a &#8220;context switch&#8221;, too. Although one could question the benefit of it being deterministic in this case (don&#8217;t know if SQL can cache function results for functions with LOB parameters, or for pipelined functions, for that matter)</p>
<p>Flado</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Garfield Sørensen</title>
		<link>http://jonathanlewis.wordpress.com/2008/11/19/lateral-lobs/#comment-32275</link>
		<dc:creator><![CDATA[Michael Garfield Sørensen]]></dc:creator>
		<pubDate>Fri, 21 Nov 2008 12:17:15 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=743#comment-32275</guid>
		<description><![CDATA[Jonathan and Flado,

Declaring the function to be deterministic is wrong! It selects the clob from a database table, so it cannot be guaranteed to return the same result the next time  it is called (with the same parameters)...

Regards,
Michael]]></description>
		<content:encoded><![CDATA[<p>Jonathan and Flado,</p>
<p>Declaring the function to be deterministic is wrong! It selects the clob from a database table, so it cannot be guaranteed to return the same result the next time  it is called (with the same parameters)&#8230;</p>
<p>Regards,<br />
Michael</p>
]]></content:encoded>
	</item>
</channel>
</rss>
