<?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: Design</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2007/06/05/design/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2007/06/05/design/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Wed, 22 May 2013 12:40:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: HolgerBaer</title>
		<link>http://jonathanlewis.wordpress.com/2007/06/05/design/#comment-15784</link>
		<dc:creator><![CDATA[HolgerBaer]]></dc:creator>
		<pubDate>Fri, 20 Jul 2007 15:07:12 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/06/05/design/#comment-15784</guid>
		<description><![CDATA[&quot;you can always create a concatenated index on audit_trail&quot;

Given that in the original quote only select on audit trail was mentioned, this might in fact _not_ always be the case.]]></description>
		<content:encoded><![CDATA[<p>&#8220;you can always create a concatenated index on audit_trail&#8221;</p>
<p>Given that in the original quote only select on audit trail was mentioned, this might in fact _not_ always be the case.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hugo</title>
		<link>http://jonathanlewis.wordpress.com/2007/06/05/design/#comment-11898</link>
		<dc:creator><![CDATA[Hugo]]></dc:creator>
		<pubDate>Fri, 08 Jun 2007 04:35:10 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/06/05/design/#comment-11898</guid>
		<description><![CDATA[As you stated, It depends on how much information you need to retrieve, and wich one would be the leading table, filters, etc... But if &quot;package&quot; is to be the leading table, you can always create a concatenated index on audit_trail

create index ProcNumConcatIdx 
on audit_trail(proc&#124;&#124;&#039;-&#039;&#124;&#124;num);

select /*+ index(aud ProcNumConcatIdx) */
 pck.*
 from
   package	   pck,
   audit_trail     aud
 where
   pck.caseref=aud.proc&#124;&#124;&#039;-&#039;&#124;&#124;aud.num;



PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------
Plan hash value: 4083992475

---------------------------------------------------------------------------------------
&#124; Id  &#124; Operation          &#124; Name             &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
---------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT   &#124;                  &#124;  1000 &#124; 13000 &#124;    31   (4)&#124; 00:00:01 &#124;
&#124;*  1 &#124;  HASH JOIN         &#124;                  &#124;  1000 &#124; 13000 &#124;    31   (4)&#124; 00:00:01 &#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; PACKAGE          &#124;  1000 &#124;  6000 &#124;     2   (0)&#124; 00:00:01 &#124;
&#124;   3 &#124;   INDEX FULL SCAN  &#124; PROCNUMCONCATIDX &#124;  9999 &#124; 69993 &#124;    28   (0)&#124; 00:00:01 &#124;
---------------------------------------------------------------------------------------

   1 - access(&quot;PCK&quot;.&quot;CASEREF&quot;=TO_CHAR(&quot;PROC&quot;)&#124;&#124;&#039;-&#039;&#124;&#124;TO_CHAR(&quot;NUM&quot;))


select /*+ use_nl(pck aud) index(aud ProcNumConcatIdx) */
 pck.*
 from
   package	   pck,
   audit_trail     aud
 where
   pck.caseref=aud.proc&#124;&#124;&#039;-&#039;&#124;&#124;aud.num;

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------
Plan hash value: 1711062606

---------------------------------------------------------------------------------------
&#124; Id  &#124; Operation          &#124; Name             &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
---------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT   &#124;                  &#124;  1000 &#124; 13000 &#124;  1003   (1)&#124; 00:00:13 &#124;
&#124;   1 &#124;  NESTED LOOPS      &#124;                  &#124;  1000 &#124; 13000 &#124;  1003   (1)&#124; 00:00:13 &#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; PACKAGE          &#124;  1000 &#124;  6000 &#124;     2   (0)&#124; 00:00:01 &#124;
&#124;*  3 &#124;   INDEX RANGE SCAN &#124; PROCNUMCONCATIDX &#124;     1 &#124;     7 &#124;     1   (0)&#124; 00:00:01 &#124;
---------------------------------------------------------------------------------------]]></description>
		<content:encoded><![CDATA[<p>As you stated, It depends on how much information you need to retrieve, and wich one would be the leading table, filters, etc&#8230; But if &#8220;package&#8221; is to be the leading table, you can always create a concatenated index on audit_trail</p>
<p>create index ProcNumConcatIdx<br />
on audit_trail(proc||&#8217;-'||num);</p>
<p>select /*+ index(aud ProcNumConcatIdx) */<br />
 pck.*<br />
 from<br />
   package	   pck,<br />
   audit_trail     aud<br />
 where<br />
   pck.caseref=aud.proc||&#8217;-'||aud.num;</p>
<p>PLAN_TABLE_OUTPUT<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Plan hash value: 4083992475</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| Id  | Operation          | Name             | Rows  | Bytes | Cost (%CPU)| Time     |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
|   0 | SELECT STATEMENT   |                  |  1000 | 13000 |    31   (4)| 00:00:01 |<br />
|*  1 |  HASH JOIN         |                  |  1000 | 13000 |    31   (4)| 00:00:01 |<br />
|   2 |   TABLE ACCESS FULL| PACKAGE          |  1000 |  6000 |     2   (0)| 00:00:01 |<br />
|   3 |   INDEX FULL SCAN  | PROCNUMCONCATIDX |  9999 | 69993 |    28   (0)| 00:00:01 |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>   1 &#8211; access(&#8220;PCK&#8221;.&#8221;CASEREF&#8221;=TO_CHAR(&#8220;PROC&#8221;)||&#8217;-'||TO_CHAR(&#8220;NUM&#8221;))</p>
<p>select /*+ use_nl(pck aud) index(aud ProcNumConcatIdx) */<br />
 pck.*<br />
 from<br />
   package	   pck,<br />
   audit_trail     aud<br />
 where<br />
   pck.caseref=aud.proc||&#8217;-'||aud.num;</p>
<p>PLAN_TABLE_OUTPUT<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Plan hash value: 1711062606</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| Id  | Operation          | Name             | Rows  | Bytes | Cost (%CPU)| Time     |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
|   0 | SELECT STATEMENT   |                  |  1000 | 13000 |  1003   (1)| 00:00:13 |<br />
|   1 |  NESTED LOOPS      |                  |  1000 | 13000 |  1003   (1)| 00:00:13 |<br />
|   2 |   TABLE ACCESS FULL| PACKAGE          |  1000 |  6000 |     2   (0)| 00:00:01 |<br />
|*  3 |   INDEX RANGE SCAN | PROCNUMCONCATIDX |     1 |     7 |     1   (0)| 00:00:01 |<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Noons</title>
		<link>http://jonathanlewis.wordpress.com/2007/06/05/design/#comment-11860</link>
		<dc:creator><![CDATA[Noons]]></dc:creator>
		<pubDate>Thu, 07 Jun 2007 22:23:30 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/06/05/design/#comment-11860</guid>
		<description><![CDATA[This:

&quot;I need to join them in the fastest way possible as I am dealing with rather large tables.&quot; 

is really the scary bit in the initial question.

Why is it needed to join in the fastest way possible because the tables are big?  That makes no sense at all, by itself.

If the number of rows being retrieved in a typical query is small, then the size of the tables we start from is immaterial - assuming of course a sensible indexing strategy.

If the number of rows being retrieved in a typical query is large, then - and only then - does the large size of the tables become critical.  Mostly because indexed retrieval may not be the best strategy to read large numbers of rows.

But like you said: there is not enough information in the question to answer it in a consistent fashion.

The problem of course becomes: what happens when I *may* need to retrieve *both* large and small amounts of data from the join?  Where is the cutoff point for indexing versus hash/sort-merge and how do I tell the optimizer to go each way depending on my intentions?  This is where histograms may help, but often that&#039;s not enough...]]></description>
		<content:encoded><![CDATA[<p>This:</p>
<p>&#8220;I need to join them in the fastest way possible as I am dealing with rather large tables.&#8221; </p>
<p>is really the scary bit in the initial question.</p>
<p>Why is it needed to join in the fastest way possible because the tables are big?  That makes no sense at all, by itself.</p>
<p>If the number of rows being retrieved in a typical query is small, then the size of the tables we start from is immaterial &#8211; assuming of course a sensible indexing strategy.</p>
<p>If the number of rows being retrieved in a typical query is large, then &#8211; and only then &#8211; does the large size of the tables become critical.  Mostly because indexed retrieval may not be the best strategy to read large numbers of rows.</p>
<p>But like you said: there is not enough information in the question to answer it in a consistent fashion.</p>
<p>The problem of course becomes: what happens when I *may* need to retrieve *both* large and small amounts of data from the join?  Where is the cutoff point for indexing versus hash/sort-merge and how do I tell the optimizer to go each way depending on my intentions?  This is where histograms may help, but often that&#8217;s not enough&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oracle Musings &#187; ???????, ?? ????????</title>
		<link>http://jonathanlewis.wordpress.com/2007/06/05/design/#comment-11786</link>
		<dc:creator><![CDATA[Oracle Musings &#187; ???????, ?? ????????]]></dc:creator>
		<pubDate>Thu, 07 Jun 2007 13:35:13 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/06/05/design/#comment-11786</guid>
		<description><![CDATA[[...] enjoyed this post by Jonathan Lewis, in which he discusses his reaction to a seemingly simple question on [...]]]></description>
		<content:encoded><![CDATA[<p>[...] enjoyed this post by Jonathan Lewis, in which he discusses his reaction to a seemingly simple question on [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Aldridge</title>
		<link>http://jonathanlewis.wordpress.com/2007/06/05/design/#comment-11554</link>
		<dc:creator><![CDATA[David Aldridge]]></dc:creator>
		<pubDate>Wed, 06 Jun 2007 11:38:36 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/06/05/design/#comment-11554</guid>
		<description><![CDATA[Good advice that -- very &quot;bookmarkable&quot; for linking to in forum postings.

I try to promote phraseology such as &quot;I need to join TableA _and_ TableB ...&quot; or &quot;... Table A _with_ TableB ...&quot;, rather than using &quot;to&quot; so that we avoid prejudging the identification of the driving table.

And there&#039;s also the question, I think, of how often you perform this join. If you generally access TableB only when accessing TableA and joining them together (I&#039;m thinking of an invoice_detail and an invoice_header table accessed through an OLTP system screen or web interface for customer enquiries, for example) then I&#039;d be thinking of clustering as another option.]]></description>
		<content:encoded><![CDATA[<p>Good advice that &#8212; very &#8220;bookmarkable&#8221; for linking to in forum postings.</p>
<p>I try to promote phraseology such as &#8220;I need to join TableA _and_ TableB &#8230;&#8221; or &#8220;&#8230; Table A _with_ TableB &#8230;&#8221;, rather than using &#8220;to&#8221; so that we avoid prejudging the identification of the driving table.</p>
<p>And there&#8217;s also the question, I think, of how often you perform this join. If you generally access TableB only when accessing TableA and joining them together (I&#8217;m thinking of an invoice_detail and an invoice_header table accessed through an OLTP system screen or web interface for customer enquiries, for example) then I&#8217;d be thinking of clustering as another option.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
