<?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: Hash Joins &#8211; What is Wrong with this Statement?</title>
	<atom:link href="http://hoopercharles.wordpress.com/2010/12/29/hash-joins-what-is-wrong-with-this-statement/feed/" rel="self" type="application/rss+xml" />
	<link>http://hoopercharles.wordpress.com/2010/12/29/hash-joins-what-is-wrong-with-this-statement/</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: Martin Berger</title>
		<link>http://hoopercharles.wordpress.com/2010/12/29/hash-joins-what-is-wrong-with-this-statement/#comment-2557</link>
		<dc:creator><![CDATA[Martin Berger]]></dc:creator>
		<pubDate>Sat, 01 Jan 2011 20:32:48 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4151#comment-2557</guid>
		<description><![CDATA[something more here:
&lt;i&gt;This hash table includes all of the row data for that table ...&lt;/i&gt;
I&#039;d like to read something similar to &lt;i&gt;This hash table includes all of the required row data for that object ...&lt;/i&gt;
Do you agree based on the observations we had in the replies here, or should I provide another demo?]]></description>
		<content:encoded><![CDATA[<p>something more here:<br />
<i>This hash table includes all of the row data for that table &#8230;</i><br />
I&#8217;d like to read something similar to <i>This hash table includes all of the required row data for that object &#8230;</i><br />
Do you agree based on the observations we had in the replies here, or should I provide another demo?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Berger</title>
		<link>http://hoopercharles.wordpress.com/2010/12/29/hash-joins-what-is-wrong-with-this-statement/#comment-2535</link>
		<dc:creator><![CDATA[Martin Berger]]></dc:creator>
		<pubDate>Thu, 30 Dec 2010 19:50:57 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4151#comment-2535</guid>
		<description><![CDATA[sorry for the big confusion!
I used 100000 rows in both tables. But that does not make any difference here. 
t&#039;s this sentence: &#039;... the table that is determined to return the fewest rows will be hashed in its entirety into memory.&#039;
As you showed in some of your test-cases not a single table is used to provide all the rows and columns of interest.
Therefore I&#039;d change this to &#039;... the object ...&#039;. 
Do you want anything more to go on? ;-)]]></description>
		<content:encoded><![CDATA[<p>sorry for the big confusion!<br />
I used 100000 rows in both tables. But that does not make any difference here.<br />
t&#8217;s this sentence: &#8216;&#8230; the table that is determined to return the fewest rows will be hashed in its entirety into memory.&#8217;<br />
As you showed in some of your test-cases not a single table is used to provide all the rows and columns of interest.<br />
Therefore I&#8217;d change this to &#8216;&#8230; the object &#8230;&#8217;.<br />
Do you want anything more to go on? <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/12/29/hash-joins-what-is-wrong-with-this-statement/#comment-2534</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Thu, 30 Dec 2010 19:21:20 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4151#comment-2534</guid>
		<description><![CDATA[Unfortunately, I am not sure how many rows are supposed to be in table T2 (Wordpress was hungry), so I tried 2 tests.  With 100,000 rows in table T2 I see this for the output:
[code]
Execution Plan
----------------------------------------------------------
Plan hash value: 1838229974

---------------------------------------------------------------------------
&#124; Id  &#124; Operation          &#124; Name &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
---------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT   &#124;      &#124;   100K&#124;   976K&#124;   721   (1)&#124; 00:00:06 &#124;
&#124;*  1 &#124;  HASH JOIN         &#124;      &#124;   100K&#124;   976K&#124;   721   (1)&#124; 00:00:06 &#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T1   &#124;   100K&#124;   488K&#124;   256   (1)&#124; 00:00:03 &#124;
&#124;   3 &#124;   TABLE ACCESS FULL&#124; T2   &#124;   100K&#124;   488K&#124;   464   (1)&#124; 00:00:04 &#124;
---------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
 
-
 
Execution Plan
----------------------------------------------------------
Plan hash value: 2034135612

------------------------------------------------------------------------------
&#124; Id  &#124; Operation             &#124; Name &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT      &#124;      &#124;   100K&#124;   976K&#124;    89   (4)&#124; 00:00:01 &#124;
&#124;*  1 &#124;  HASH JOIN            &#124;      &#124;   100K&#124;   976K&#124;    89   (4)&#124; 00:00:01 &#124;
&#124;   2 &#124;   INDEX FAST FULL SCAN&#124; I1   &#124;   100K&#124;   488K&#124;    44   (3)&#124; 00:00:01 &#124;
&#124;   3 &#124;   INDEX FAST FULL SCAN&#124; I2   &#124;   100K&#124;   488K&#124;    44   (3)&#124; 00:00:01 &#124;
------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
[/code]

With 90,000 rows in table T2 I see this for the output:
[code]
Execution Plan
----------------------------------------------------------
Plan hash value: 2959412835

---------------------------------------------------------------------------
&#124; Id  &#124; Operation          &#124; Name &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
---------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT   &#124;      &#124; 90000 &#124;   878K&#124;   675   (1)&#124; 00:00:06 &#124;
&#124;*  1 &#124;  HASH JOIN         &#124;      &#124; 90000 &#124;   878K&#124;   675   (1)&#124; 00:00:06 &#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T2   &#124; 90000 &#124;   439K&#124;   417   (1)&#124; 00:00:04 &#124;
&#124;   3 &#124;   TABLE ACCESS FULL&#124; T1   &#124;   100K&#124;   488K&#124;   256   (1)&#124; 00:00:03 &#124;
---------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
 
-
 
Execution Plan
----------------------------------------------------------
Plan hash value: 4050175478

------------------------------------------------------------------------------
&#124; Id  &#124; Operation             &#124; Name &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT      &#124;      &#124; 90000 &#124;   878K&#124;    85   (4)&#124; 00:00:01 &#124;
&#124;*  1 &#124;  HASH JOIN            &#124;      &#124; 90000 &#124;   878K&#124;    85   (4)&#124; 00:00:01 &#124;
&#124;   2 &#124;   INDEX FAST FULL SCAN&#124; I2   &#124; 90000 &#124;   439K&#124;    40   (3)&#124; 00:00:01 &#124;
&#124;   3 &#124;   INDEX FAST FULL SCAN&#124; I1   &#124;   100K&#124;   488K&#124;    44   (3)&#124; 00:00:01 &#124;
------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
[/code]

With 90,000 rows in table T2 and only an index on table T1 I see this for the output:
[code]
Execution Plan
----------------------------------------------------------
Plan hash value: 1801612801

------------------------------------------------------------------------------
&#124; Id  &#124; Operation             &#124; Name &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT      &#124;      &#124; 90000 &#124;   878K&#124;   463   (2)&#124; 00:00:04 &#124;
&#124;*  1 &#124;  HASH JOIN            &#124;      &#124; 90000 &#124;   878K&#124;   463   (2)&#124; 00:00:04 &#124;
&#124;   2 &#124;   TABLE ACCESS FULL   &#124; T2   &#124; 90000 &#124;   439K&#124;   417   (1)&#124; 00:00:04 &#124;
&#124;   3 &#124;   INDEX FAST FULL SCAN&#124; I1   &#124;   100K&#124;   488K&#124;    44   (3)&#124; 00:00:01 &#124;
------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
[/code]

The last execution plan seems a bit odd, if in fact Oracle would have to hash the entire row contents of table T2 into memory.]]></description>
		<content:encoded><![CDATA[<p>Unfortunately, I am not sure how many rows are supposed to be in table T2 (WordPress was hungry), so I tried 2 tests.  With 100,000 rows in table T2 I see this for the output:</p>
<pre class="brush: plain; title: ; notranslate">
Execution Plan
----------------------------------------------------------
Plan hash value: 1838229974

---------------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |   100K|   976K|   721   (1)| 00:00:06 |
|*  1 |  HASH JOIN         |      |   100K|   976K|   721   (1)| 00:00:06 |
|   2 |   TABLE ACCESS FULL| T1   |   100K|   488K|   256   (1)| 00:00:03 |
|   3 |   TABLE ACCESS FULL| T2   |   100K|   488K|   464   (1)| 00:00:04 |
---------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
 
-
 
Execution Plan
----------------------------------------------------------
Plan hash value: 2034135612

------------------------------------------------------------------------------
| Id  | Operation             | Name | Rows  | Bytes | Cost (%CPU)| Time     |
------------------------------------------------------------------------------
|   0 | SELECT STATEMENT      |      |   100K|   976K|    89   (4)| 00:00:01 |
|*  1 |  HASH JOIN            |      |   100K|   976K|    89   (4)| 00:00:01 |
|   2 |   INDEX FAST FULL SCAN| I1   |   100K|   488K|    44   (3)| 00:00:01 |
|   3 |   INDEX FAST FULL SCAN| I2   |   100K|   488K|    44   (3)| 00:00:01 |
------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
</pre>
<p>With 90,000 rows in table T2 I see this for the output:</p>
<pre class="brush: plain; title: ; notranslate">
Execution Plan
----------------------------------------------------------
Plan hash value: 2959412835

---------------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      | 90000 |   878K|   675   (1)| 00:00:06 |
|*  1 |  HASH JOIN         |      | 90000 |   878K|   675   (1)| 00:00:06 |
|   2 |   TABLE ACCESS FULL| T2   | 90000 |   439K|   417   (1)| 00:00:04 |
|   3 |   TABLE ACCESS FULL| T1   |   100K|   488K|   256   (1)| 00:00:03 |
---------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
 
-
 
Execution Plan
----------------------------------------------------------
Plan hash value: 4050175478

------------------------------------------------------------------------------
| Id  | Operation             | Name | Rows  | Bytes | Cost (%CPU)| Time     |
------------------------------------------------------------------------------
|   0 | SELECT STATEMENT      |      | 90000 |   878K|    85   (4)| 00:00:01 |
|*  1 |  HASH JOIN            |      | 90000 |   878K|    85   (4)| 00:00:01 |
|   2 |   INDEX FAST FULL SCAN| I2   | 90000 |   439K|    40   (3)| 00:00:01 |
|   3 |   INDEX FAST FULL SCAN| I1   |   100K|   488K|    44   (3)| 00:00:01 |
------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
</pre>
<p>With 90,000 rows in table T2 and only an index on table T1 I see this for the output:</p>
<pre class="brush: plain; title: ; notranslate">
Execution Plan
----------------------------------------------------------
Plan hash value: 1801612801

------------------------------------------------------------------------------
| Id  | Operation             | Name | Rows  | Bytes | Cost (%CPU)| Time     |
------------------------------------------------------------------------------
|   0 | SELECT STATEMENT      |      | 90000 |   878K|   463   (2)| 00:00:04 |
|*  1 |  HASH JOIN            |      | 90000 |   878K|   463   (2)| 00:00:04 |
|   2 |   TABLE ACCESS FULL   | T2   | 90000 |   439K|   417   (1)| 00:00:04 |
|   3 |   INDEX FAST FULL SCAN| I1   |   100K|   488K|    44   (3)| 00:00:01 |
------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
</pre>
<p>The last execution plan seems a bit odd, if in fact Oracle would have to hash the entire row contents of table T2 into memory.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Berger</title>
		<link>http://hoopercharles.wordpress.com/2010/12/29/hash-joins-what-is-wrong-with-this-statement/#comment-2532</link>
		<dc:creator><![CDATA[Martin Berger]]></dc:creator>
		<pubDate>Thu, 30 Dec 2010 18:27:46 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4151#comment-2532</guid>
		<description><![CDATA[I don&#039;t like it when you make me splitting hairs, but ok, here we go:
(I hope the code-tags works)

[code]
CREATE TABLE
  T1
AS
SELECT
  ROWNUM C1,
  LPAD(TO_CHAR(ROWNUM),10,&#039;0&#039;) C2,
  LPAD(&#039;A&#039;,10,&#039;A&#039;) P1,
  LPAD(&#039;A&#039;,200,&#039;A&#039;) PADDING
FROM
  DUAL
CONNECT BY
  LEVEL&lt;=100000;

CREATE TABLE
  T2
AS
SELECT
  ROWNUM C1,
  LPAD(TO_CHAR(ROWNUM),10,&#039;0&#039;) C2,
  LPAD(&#039;A&#039;,10,&#039;A&#039;) P1,
  LPAD(&#039;A&#039;,390,&#039;A&#039;) PADDING
FROM
  DUAL
CONNECT BY
  LEVEL&lt;=  x;

EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=&gt;USER,TABNAME=&gt;&#039;T1&#039;,ESTIMATE_PERCENT=&gt;NULL)
EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=&gt;USER,TABNAME=&gt;&#039;T2&#039;,ESTIMATE_PERCENT=&gt;NULL) 

SELECT
  T1.C1,
  T2.C1
FROM
  T1,
  T2
WHERE
  T1.C1=T2.C1;
[/code]
&lt;blockquote&gt;(edit: merged comments)&lt;/blockquote&gt;
[code]
CREATE INDEX
  I1
  ON T1 (P1, C1, C2);
COMMIT;

CREATE INDEX
  I2
  ON T2 (P1, C1, C2);
COMMIT;
[/code]
and run the select: 
[code]
SELECT
  T1.C1,
  T2.C1
FROM
  T1,
  T2
WHERE
  T1.C1=T2.C1;
[/code]

So what am I complaining about?



&lt;blockquote&gt;(edit: Wordpress seems to get confused in the comment sections when a &lt; sign appears in a SQL statement, and then an attempt to gather statistics is made.  It is a little odd, but use this (without spaces) to put a less than sign in the code - I can then fix it just by editing the comment and immediately saving the comment:
&amp; lt;

Martin, what is the number that should take the place of &lt;em&gt;x&lt;/em&gt; in your second CREATE TABLE statement?)&lt;/blockquote&gt;

]]></description>
		<content:encoded><![CDATA[<p>I don&#8217;t like it when you make me splitting hairs, but ok, here we go:<br />
(I hope the code-tags works)</p>
<pre class="brush: plain; title: ; notranslate">
CREATE TABLE
  T1
AS
SELECT
  ROWNUM C1,
  LPAD(TO_CHAR(ROWNUM),10,'0') C2,
  LPAD('A',10,'A') P1,
  LPAD('A',200,'A') PADDING
FROM
  DUAL
CONNECT BY
  LEVEL&lt;=100000;

CREATE TABLE
  T2
AS
SELECT
  ROWNUM C1,
  LPAD(TO_CHAR(ROWNUM),10,'0') C2,
  LPAD('A',10,'A') P1,
  LPAD('A',390,'A') PADDING
FROM
  DUAL
CONNECT BY
  LEVEL&lt;=  x;

EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=&gt;USER,TABNAME=&gt;'T1',ESTIMATE_PERCENT=&gt;NULL)
EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=&gt;USER,TABNAME=&gt;'T2',ESTIMATE_PERCENT=&gt;NULL) 

SELECT
  T1.C1,
  T2.C1
FROM
  T1,
  T2
WHERE
  T1.C1=T2.C1;
</pre>
<blockquote><p>(edit: merged comments)</p></blockquote>
<pre class="brush: plain; title: ; notranslate">
CREATE INDEX
  I1
  ON T1 (P1, C1, C2);
COMMIT;

CREATE INDEX
  I2
  ON T2 (P1, C1, C2);
COMMIT;
</pre>
<p>and run the select: </p>
<pre class="brush: plain; title: ; notranslate">
SELECT
  T1.C1,
  T2.C1
FROM
  T1,
  T2
WHERE
  T1.C1=T2.C1;
</pre>
<p>So what am I complaining about?</p>
<blockquote><p>(edit: WordPress seems to get confused in the comment sections when a &lt; sign appears in a SQL statement, and then an attempt to gather statistics is made.  It is a little odd, but use this (without spaces) to put a less than sign in the code &#8211; I can then fix it just by editing the comment and immediately saving the comment:<br />
&amp; lt;</p>
<p>Martin, what is the number that should take the place of <em>x</em> in your second CREATE TABLE statement?)</p></blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/12/29/hash-joins-what-is-wrong-with-this-statement/#comment-2531</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Thu, 30 Dec 2010 16:02:04 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4151#comment-2531</guid>
		<description><![CDATA[I think that the two earlier comments (by Nigel Thomas and Martin Berger) identified what caused me to stop, think, ... and understand when I read this portion of the book.  The book (at least the first 160 pages) is so well written, that there is no doubt that the authors had to draw the line at some point and say that enough detail is enough detail.  I think that a couple of additional qualifying words in these sentences might have helped, and the original version of the test case that I provided shows why, I think.

Let&#039;s make a couple of changes to the test case script to see what happens (table T1 will have 100,000 rows, while table t2 will have 90,000 rows with an average row length that is nearly double that of table T1):
[code]
DROP TABLE T1 PURGE;
DROP TABLE T2 PURGE;
 
CREATE TABLE
  T1
AS
SELECT
  ROWNUM C1,
  LPAD(TO_CHAR(ROWNUM),10,&#039;0&#039;) C2,
  LPAD(&#039;A&#039;,200,&#039;A&#039;) PADDING
FROM
  DUAL
CONNECT BY
  LEVEL&lt;=100000;
 
CREATE TABLE
  T2
AS
SELECT
  ROWNUM C1,
  LPAD(TO_CHAR(ROWNUM),10,&#039;0&#039;) C2,
  LPAD(&#039;A&#039;,400,&#039;A&#039;) PADDING
FROM
  DUAL
CONNECT BY
  LEVEL&lt;=90000;
 
COMMIT;
 
EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=&gt;USER,TABNAME=&gt;&#039;T1&#039;,ESTIMATE_PERCENT=&gt;NULL)
EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=&gt;USER,TABNAME=&gt;&#039;T2&#039;,ESTIMATE_PERCENT=&gt;NULL)
[/code]

For the AUTOTRACE TRACEONLY EXPLAIN script I received the following output - compare the position of table T2 in each of the execution plans with the execution plans from the original execution:
[code]
SQL&gt; SELECT
  2    *
  3  FROM
  4    T1,
  5    T2
  6  WHERE
  7    T1.C1=T2.C1;
 
Execution Plan
----------------------------------------------------------
Plan hash value: 1838229974
 
-----------------------------------------------------------------------------------
&#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; 90000 &#124;    54M&#124;       &#124;  1396   (1)&#124; 00:00:12 &#124;
&#124;*  1 &#124;  HASH JOIN         &#124;      &#124; 90000 &#124;    54M&#124;    21M&#124;  1396   (1)&#124; 00:00:12 &#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T1   &#124;   100K&#124;    20M&#124;       &#124;   248   (1)&#124; 00:00:02 &#124;
&#124;   3 &#124;   TABLE ACCESS FULL&#124; T2   &#124; 90000 &#124;    35M&#124;       &#124;   418   (1)&#124; 00:00:04 &#124;
-----------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
 
-
 
SQL&gt; SELECT
  2    T1.C1,
  3    T2.C1
  4  FROM
  5    T1,
  6    T2
  7  WHERE
  8    T1.C1=T2.C1;
 
Execution Plan
----------------------------------------------------------
Plan hash value: 2959412835
 
---------------------------------------------------------------------------
&#124; Id  &#124; Operation          &#124; Name &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
---------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT   &#124;      &#124; 90000 &#124;   878K&#124;   667   (1)&#124; 00:00:06 &#124;
&#124;*  1 &#124;  HASH JOIN         &#124;      &#124; 90000 &#124;   878K&#124;   667   (1)&#124; 00:00:06 &#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T2   &#124; 90000 &#124;   439K&#124;   417   (1)&#124; 00:00:04 &#124;
&#124;   3 &#124;   TABLE ACCESS FULL&#124; T1   &#124;   100K&#124;   488K&#124;   248   (1)&#124; 00:00:02 &#124;
---------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
 
-
 
SQL&gt; SELECT
  2    T1.C1,
  3    T2.C1
  4  FROM
  5    T1,
  6    T2
  7  WHERE
  8    T1.C1=T2.C1
  9    AND T1.C2=T2.C2;
 
Execution Plan
----------------------------------------------------------
Plan hash value: 2959412835
 
-----------------------------------------------------------------------------------
&#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; 90000 &#124;  2812K&#124;       &#124;   731   (1)&#124; 00:00:06 &#124;
&#124;*  1 &#124;  HASH JOIN         &#124;      &#124; 90000 &#124;  2812K&#124;  2464K&#124;   731   (1)&#124; 00:00:06 &#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T2   &#124; 90000 &#124;  1406K&#124;       &#124;   417   (1)&#124; 00:00:04 &#124;
&#124;   3 &#124;   TABLE ACCESS FULL&#124; T1   &#124;   100K&#124;  1562K&#124;       &#124;   248   (1)&#124; 00:00:02 &#124;
-----------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot; AND &quot;T1&quot;.&quot;C2&quot;=&quot;T2&quot;.&quot;C2&quot;)
 
-
 
SQL&gt; SELECT
  2    T1.C1,
  3    T2.C1,
  4    T1.C2
  5  FROM
  6    T1,
  7    T2
  8  WHERE
  9    T1.C1=T2.C1
 10    AND T1.C2=T2.C2;
 
Execution Plan
----------------------------------------------------------
Plan hash value: 2959412835
 
-----------------------------------------------------------------------------------
&#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; 90000 &#124;  2812K&#124;       &#124;   731   (1)&#124; 00:00:06 &#124;
&#124;*  1 &#124;  HASH JOIN         &#124;      &#124; 90000 &#124;  2812K&#124;  2464K&#124;   731   (1)&#124; 00:00:06 &#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T2   &#124; 90000 &#124;  1406K&#124;       &#124;   417   (1)&#124; 00:00:04 &#124;
&#124;   3 &#124;   TABLE ACCESS FULL&#124; T1   &#124;   100K&#124;  1562K&#124;       &#124;   248   (1)&#124; 00:00:02 &#124;
-----------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot; AND &quot;T1&quot;.&quot;C2&quot;=&quot;T2&quot;.&quot;C2&quot;)
 
-
 
SQL&gt; SELECT
  2    T1.C1,
  3    T2.C1,
  4    T1.C2,
  5    T1.PADDING
  6  FROM
  7    T1,
  8    T2
  9  WHERE
 10    T1.C1=T2.C1
 11    AND T1.C2=T2.C2;
 
Execution Plan
----------------------------------------------------------
Plan hash value: 2959412835
 
-----------------------------------------------------------------------------------
&#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; 90000 &#124;    19M&#124;       &#124;   969   (1)&#124; 00:00:08 &#124;
&#124;*  1 &#124;  HASH JOIN         &#124;      &#124; 90000 &#124;    19M&#124;  2464K&#124;   969   (1)&#124; 00:00:08 &#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T2   &#124; 90000 &#124;  1406K&#124;       &#124;   417   (1)&#124; 00:00:04 &#124;
&#124;   3 &#124;   TABLE ACCESS FULL&#124; T1   &#124;   100K&#124;    20M&#124;       &#124;   248   (1)&#124; 00:00:02 &#124;
-----------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot; AND &quot;T1&quot;.&quot;C2&quot;=&quot;T2&quot;.&quot;C2&quot;)
 
-
 
SQL&gt; SELECT
  2    T1.C1,
  3    T2.C1,
  4    T1.C2,
  5    T1.PADDING,
  6    T2.PADDING
  7  FROM
  8    T1,
  9    T2
 10  WHERE
 11    T1.C1=T2.C1
 12    AND T1.C2=T2.C2;
 
Execution Plan
----------------------------------------------------------
Plan hash value: 1838229974
 
-----------------------------------------------------------------------------------
&#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; 90000 &#124;    54M&#124;       &#124;  1396   (1)&#124; 00:00:12 &#124;
&#124;*  1 &#124;  HASH JOIN         &#124;      &#124; 90000 &#124;    54M&#124;    21M&#124;  1396   (1)&#124; 00:00:12 &#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T1   &#124;   100K&#124;    20M&#124;       &#124;   248   (1)&#124; 00:00:02 &#124;
&#124;   3 &#124;   TABLE ACCESS FULL&#124; T2   &#124; 90000 &#124;    35M&#124;       &#124;   418   (1)&#124; 00:00:04 &#124;
-----------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot; AND &quot;T1&quot;.&quot;C2&quot;=&quot;T2&quot;.&quot;C2&quot;)
[/code]

Let&#039;s try again, this time with 1,000,000 rows in table T1 and 1,500,000 rows in table T2:
[code]
DROP TABLE T1 PURGE;
DROP TABLE T2 PURGE;
 
CREATE TABLE
  T1
AS
SELECT
  ROWNUM C1,
  LPAD(TO_CHAR(ROWNUM),10,&#039;0&#039;) C2,
  LPAD(&#039;A&#039;,200,&#039;A&#039;) PADDING
FROM
  DUAL
CONNECT BY
  LEVEL&lt;=1000000;
 
CREATE TABLE
  T2
AS
SELECT
  ROWNUM C1,
  LPAD(TO_CHAR(ROWNUM),10,&#039;0&#039;) C2,
  LPAD(&#039;A&#039;,400,&#039;A&#039;) PADDING
FROM
  DUAL
CONNECT BY
  LEVEL&lt;=1500000;
 
COMMIT;
 
EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=&gt;USER,TABNAME=&gt;&#039;T1&#039;,ESTIMATE_PERCENT=&gt;NULL)
EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=&gt;USER,TABNAME=&gt;&#039;T2&#039;,ESTIMATE_PERCENT=&gt;NULL)
[/code]

This time, I will set the array fetch size to 1000, execute the queries, and retrieve the actual execution plans with the following:
[code]
SET AUTOTRACE OFF
SET LINESIZE 150
SET PAGESIZE 2000
SET TRIMSPOOL ON
SPOOL TEST_HASH_PLANS_LARGE2.TXT
 
SELECT /*+ LEADING(S) */
  T.PLAN_TABLE_OUTPUT
FROM
  (SELECT
    SQL_ID,
    CHILD_NUMBER
  FROM
    V$SQL
  WHERE
    SQL_TEXT LIKE &#039;SELECT%T1.C1=T2.C1%&#039;) S,
  TABLE(DBMS_XPLAN.DISPLAY_CURSOR(S.SQL_ID,S.CHILD_NUMBER,&#039;ALLSTATS LAST +ROWS +COST +BYTES&#039;)) T;
 
SPOOL OFF
[/code]

I received the following output, again, pay attention to the position of table T2 and the memory utilization:
[code]
SQL_ID  c2nzwfydj9nft, child number 0
-------------------------------------
SELECT   * FROM   T1,   T2 WHERE   T1.C1=T2.C1

Plan hash value: 1838229974

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation          &#124; Name &#124; Starts &#124; E-Rows &#124;E-Bytes&#124;E-Temp &#124; Cost (%CPU)&#124; A-Rows &#124;   A-Time   &#124; Buffers &#124; Reads  &#124; Writes &#124;  OMem &#124;  1Mem &#124; Used-Mem &#124; Used-Tmp&#124;
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT   &#124;      &#124;      1 &#124;        &#124;       &#124;       &#124; 19750 (100)&#124;   1000K&#124;00:00:03.39 &#124;     120K&#124;  44361 &#124;  44361 &#124;       &#124;       &#124;          &#124;         &#124;
&#124;*  1 &#124;  HASH JOIN         &#124;      &#124;      1 &#124;   1000K&#124;   604M&#124;   218M&#124; 19750   (1)&#124;   1000K&#124;00:00:03.39 &#124;     120K&#124;  44361 &#124;  44361 &#124;   244M&#124;    14M&#124;  211M (1)&#124;     364K&#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T1   &#124;      1 &#124;   1000K&#124;   206M&#124;       &#124;  2462   (1)&#124;   1000K&#124;00:00:00.13 &#124;   31263 &#124;      0 &#124;      0 &#124;       &#124;       &#124;          &#124;         &#124;
&#124;   3 &#124;   TABLE ACCESS FULL&#124; T2   &#124;      1 &#124;   1500K&#124;   596M&#124;       &#124;  6938   (1)&#124;   1500K&#124;00:00:00.29 &#124;   88988 &#124;      0 &#124;      0 &#124;       &#124;       &#124;          &#124;         &#124;
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
[/code]
 
[code]
SQL_ID  1r4up8dp9fc00, child number 0
-------------------------------------
SELECT   T1.C1,   T2.C1 FROM   T1,   T2 WHERE   T1.C1=T2.C1

Plan hash value: 1838229974

---------------------------------------------------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation          &#124; Name &#124; Starts &#124; E-Rows &#124;E-Bytes&#124;E-Temp &#124; Cost (%CPU)&#124; A-Rows &#124;   A-Time   &#124; Buffers &#124;  OMem &#124;  1Mem &#124; Used-Mem &#124;
---------------------------------------------------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT   &#124;      &#124;      1 &#124;        &#124;       &#124;       &#124;  9938 (100)&#124;   1000K&#124;00:00:01.22 &#124;     120K&#124;       &#124;       &#124;          &#124;
&#124;*  1 &#124;  HASH JOIN         &#124;      &#124;      1 &#124;   1000K&#124;    10M&#124;    16M&#124;  9938   (1)&#124;   1000K&#124;00:00:01.22 &#124;     120K&#124;    27M&#124;  3871K&#124;   43M (0)&#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T1   &#124;      1 &#124;   1000K&#124;  4882K&#124;       &#124;  2460   (1)&#124;   1000K&#124;00:00:00.10 &#124;   31263 &#124;       &#124;       &#124;          &#124;
&#124;   3 &#124;   TABLE ACCESS FULL&#124; T2   &#124;      1 &#124;   1500K&#124;  8789K&#124;       &#124;  6935   (1)&#124;   1500K&#124;00:00:00.23 &#124;   89195 &#124;       &#124;       &#124;          &#124;
---------------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
[/code]
 
[code]
SQL_ID  0rnjh74c5m1dc, child number 0
-------------------------------------
SELECT   T1.C1,   T2.C1 FROM   T1,   T2 WHERE   T1.C1=T2.C1   AND
T1.C2=T2.C2

Plan hash value: 1838229974

---------------------------------------------------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation          &#124; Name &#124; Starts &#124; E-Rows &#124;E-Bytes&#124;E-Temp &#124; Cost (%CPU)&#124; A-Rows &#124;   A-Time   &#124; Buffers &#124;  OMem &#124;  1Mem &#124; Used-Mem &#124;
---------------------------------------------------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT   &#124;      &#124;      1 &#124;        &#124;       &#124;       &#124; 10266 (100)&#124;   1000K&#124;00:00:01.45 &#124;     120K&#124;       &#124;       &#124;          &#124;
&#124;*  1 &#124;  HASH JOIN         &#124;      &#124;      1 &#124;   1000K&#124;    31M&#124;    26M&#124; 10266   (1)&#124;   1000K&#124;00:00:01.45 &#124;     120K&#124;    40M&#124;  5750K&#124;   59M (0)&#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T1   &#124;      1 &#124;   1000K&#124;    15M&#124;       &#124;  2461   (1)&#124;   1000K&#124;00:00:00.10 &#124;   31263 &#124;       &#124;       &#124;          &#124;
&#124;   3 &#124;   TABLE ACCESS FULL&#124; T2   &#124;      1 &#124;   1500K&#124;    24M&#124;       &#124;  6936   (1)&#124;   1500K&#124;00:00:00.26 &#124;   89195 &#124;       &#124;       &#124;          &#124;
---------------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot; AND &quot;T1&quot;.&quot;C2&quot;=&quot;T2&quot;.&quot;C2&quot;)
[/code]
 
[code]
SQL_ID  c691ypk4k096j, child number 0
-------------------------------------
SELECT   T1.C1,   T2.C1,   T1.C2 FROM   T1,   T2 WHERE   T1.C1=T2.C1
AND T1.C2=T2.C2

Plan hash value: 1838229974

---------------------------------------------------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation          &#124; Name &#124; Starts &#124; E-Rows &#124;E-Bytes&#124;E-Temp &#124; Cost (%CPU)&#124; A-Rows &#124;   A-Time   &#124; Buffers &#124;  OMem &#124;  1Mem &#124; Used-Mem &#124;
---------------------------------------------------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT   &#124;      &#124;      1 &#124;        &#124;       &#124;       &#124; 10266 (100)&#124;   1000K&#124;00:00:01.52 &#124;     120K&#124;       &#124;       &#124;          &#124;
&#124;*  1 &#124;  HASH JOIN         &#124;      &#124;      1 &#124;   1000K&#124;    31M&#124;    26M&#124; 10266   (1)&#124;   1000K&#124;00:00:01.52 &#124;     120K&#124;    40M&#124;  5750K&#124;   59M (0)&#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T1   &#124;      1 &#124;   1000K&#124;    15M&#124;       &#124;  2461   (1)&#124;   1000K&#124;00:00:00.12 &#124;   31263 &#124;       &#124;       &#124;          &#124;
&#124;   3 &#124;   TABLE ACCESS FULL&#124; T2   &#124;      1 &#124;   1500K&#124;    24M&#124;       &#124;  6936   (1)&#124;   1500K&#124;00:00:00.25 &#124;   89195 &#124;       &#124;       &#124;          &#124;
---------------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot; AND &quot;T1&quot;.&quot;C2&quot;=&quot;T2&quot;.&quot;C2&quot;)
[/code]
 
[code]
SQL_ID  dpq7d224rxc6t, child number 0
-------------------------------------
SELECT   T1.C1,   T2.C1,   T1.C2,   T1.PADDING FROM   T1,   T2 WHERE
T1.C1=T2.C1   AND T1.C2=T2.C2

Plan hash value: 2959412835

---------------------------------------------------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation          &#124; Name &#124; Starts &#124; E-Rows &#124;E-Bytes&#124;E-Temp &#124; Cost (%CPU)&#124; A-Rows &#124;   A-Time   &#124; Buffers &#124;  OMem &#124;  1Mem &#124; Used-Mem &#124;
---------------------------------------------------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT   &#124;      &#124;      1 &#124;        &#124;       &#124;       &#124; 12646 (100)&#124;   1000K&#124;00:00:01.54 &#124;     120K&#124;       &#124;       &#124;          &#124;
&#124;*  1 &#124;  HASH JOIN         &#124;      &#124;      1 &#124;   1000K&#124;   223M&#124;    41M&#124; 12646   (1)&#124;   1000K&#124;00:00:01.54 &#124;     120K&#124;    59M&#124;  5667K&#124;   85M (0)&#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T2   &#124;      1 &#124;   1500K&#124;    24M&#124;       &#124;  6936   (1)&#124;   1500K&#124;00:00:00.20 &#124;   88254 &#124;       &#124;       &#124;          &#124;
&#124;   3 &#124;   TABLE ACCESS FULL&#124; T1   &#124;      1 &#124;   1000K&#124;   206M&#124;       &#124;  2462   (1)&#124;   1000K&#124;00:00:00.15 &#124;   32263 &#124;       &#124;       &#124;          &#124;
---------------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot; AND &quot;T1&quot;.&quot;C2&quot;=&quot;T2&quot;.&quot;C2&quot;)
[/code]
 
[code]
SQL_ID  0k4q3ahjzu9nd, child number 0
-------------------------------------
SELECT   T1.C1,   T2.C1,   T1.C2,   T1.PADDING,   T2.PADDING FROM   T1,
  T2 WHERE   T1.C1=T2.C1   AND T1.C2=T2.C2

Plan hash value: 1838229974

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation          &#124; Name &#124; Starts &#124; E-Rows &#124;E-Bytes&#124;E-Temp &#124; Cost (%CPU)&#124; A-Rows &#124;   A-Time   &#124; Buffers &#124; Reads  &#124; Writes &#124;  OMem &#124;  1Mem &#124; Used-Mem &#124; Used-Tmp&#124;
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT   &#124;      &#124;      1 &#124;        &#124;       &#124;       &#124; 19750 (100)&#124;   1000K&#124;00:00:03.53 &#124;     120K&#124;  44330 &#124;  44330 &#124;       &#124;       &#124;          &#124;         &#124;
&#124;*  1 &#124;  HASH JOIN         &#124;      &#124;      1 &#124;   1000K&#124;   604M&#124;   218M&#124; 19750   (1)&#124;   1000K&#124;00:00:03.53 &#124;     120K&#124;  44330 &#124;  44330 &#124;   244M&#124;    14M&#124;  211M (1)&#124;     364K&#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; T1   &#124;      1 &#124;   1000K&#124;   206M&#124;       &#124;  2462   (1)&#124;   1000K&#124;00:00:00.12 &#124;   31263 &#124;      0 &#124;      0 &#124;       &#124;       &#124;          &#124;         &#124;
&#124;   3 &#124;   TABLE ACCESS FULL&#124; T2   &#124;      1 &#124;   1500K&#124;   596M&#124;       &#124;  6938   (1)&#124;   1500K&#124;00:00:00.28 &#124;   88985 &#124;      0 &#124;      0 &#124;       &#124;       &#124;          &#124;         &#124;
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot; AND &quot;T1&quot;.&quot;C2&quot;=&quot;T2&quot;.&quot;C2&quot;)
[/code]
 
Anything else wrong with the quote?]]></description>
		<content:encoded><![CDATA[<p>I think that the two earlier comments (by Nigel Thomas and Martin Berger) identified what caused me to stop, think, &#8230; and understand when I read this portion of the book.  The book (at least the first 160 pages) is so well written, that there is no doubt that the authors had to draw the line at some point and say that enough detail is enough detail.  I think that a couple of additional qualifying words in these sentences might have helped, and the original version of the test case that I provided shows why, I think.</p>
<p>Let&#8217;s make a couple of changes to the test case script to see what happens (table T1 will have 100,000 rows, while table t2 will have 90,000 rows with an average row length that is nearly double that of table T1):</p>
<pre class="brush: plain; title: ; notranslate">
DROP TABLE T1 PURGE;
DROP TABLE T2 PURGE;
 
CREATE TABLE
  T1
AS
SELECT
  ROWNUM C1,
  LPAD(TO_CHAR(ROWNUM),10,'0') C2,
  LPAD('A',200,'A') PADDING
FROM
  DUAL
CONNECT BY
  LEVEL&lt;=100000;
 
CREATE TABLE
  T2
AS
SELECT
  ROWNUM C1,
  LPAD(TO_CHAR(ROWNUM),10,'0') C2,
  LPAD('A',400,'A') PADDING
FROM
  DUAL
CONNECT BY
  LEVEL&lt;=90000;
 
COMMIT;
 
EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=&gt;USER,TABNAME=&gt;'T1',ESTIMATE_PERCENT=&gt;NULL)
EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=&gt;USER,TABNAME=&gt;'T2',ESTIMATE_PERCENT=&gt;NULL)
</pre>
<p>For the AUTOTRACE TRACEONLY EXPLAIN script I received the following output &#8211; compare the position of table T2 in each of the execution plans with the execution plans from the original execution:</p>
<pre class="brush: plain; title: ; notranslate">
SQL&gt; SELECT
  2    *
  3  FROM
  4    T1,
  5    T2
  6  WHERE
  7    T1.C1=T2.C1;
 
Execution Plan
----------------------------------------------------------
Plan hash value: 1838229974
 
-----------------------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      | 90000 |    54M|       |  1396   (1)| 00:00:12 |
|*  1 |  HASH JOIN         |      | 90000 |    54M|    21M|  1396   (1)| 00:00:12 |
|   2 |   TABLE ACCESS FULL| T1   |   100K|    20M|       |   248   (1)| 00:00:02 |
|   3 |   TABLE ACCESS FULL| T2   | 90000 |    35M|       |   418   (1)| 00:00:04 |
-----------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
 
-
 
SQL&gt; SELECT
  2    T1.C1,
  3    T2.C1
  4  FROM
  5    T1,
  6    T2
  7  WHERE
  8    T1.C1=T2.C1;
 
Execution Plan
----------------------------------------------------------
Plan hash value: 2959412835
 
---------------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      | 90000 |   878K|   667   (1)| 00:00:06 |
|*  1 |  HASH JOIN         |      | 90000 |   878K|   667   (1)| 00:00:06 |
|   2 |   TABLE ACCESS FULL| T2   | 90000 |   439K|   417   (1)| 00:00:04 |
|   3 |   TABLE ACCESS FULL| T1   |   100K|   488K|   248   (1)| 00:00:02 |
---------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
 
-
 
SQL&gt; SELECT
  2    T1.C1,
  3    T2.C1
  4  FROM
  5    T1,
  6    T2
  7  WHERE
  8    T1.C1=T2.C1
  9    AND T1.C2=T2.C2;
 
Execution Plan
----------------------------------------------------------
Plan hash value: 2959412835
 
-----------------------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      | 90000 |  2812K|       |   731   (1)| 00:00:06 |
|*  1 |  HASH JOIN         |      | 90000 |  2812K|  2464K|   731   (1)| 00:00:06 |
|   2 |   TABLE ACCESS FULL| T2   | 90000 |  1406K|       |   417   (1)| 00:00:04 |
|   3 |   TABLE ACCESS FULL| T1   |   100K|  1562K|       |   248   (1)| 00:00:02 |
-----------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot; AND &quot;T1&quot;.&quot;C2&quot;=&quot;T2&quot;.&quot;C2&quot;)
 
-
 
SQL&gt; SELECT
  2    T1.C1,
  3    T2.C1,
  4    T1.C2
  5  FROM
  6    T1,
  7    T2
  8  WHERE
  9    T1.C1=T2.C1
 10    AND T1.C2=T2.C2;
 
Execution Plan
----------------------------------------------------------
Plan hash value: 2959412835
 
-----------------------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      | 90000 |  2812K|       |   731   (1)| 00:00:06 |
|*  1 |  HASH JOIN         |      | 90000 |  2812K|  2464K|   731   (1)| 00:00:06 |
|   2 |   TABLE ACCESS FULL| T2   | 90000 |  1406K|       |   417   (1)| 00:00:04 |
|   3 |   TABLE ACCESS FULL| T1   |   100K|  1562K|       |   248   (1)| 00:00:02 |
-----------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot; AND &quot;T1&quot;.&quot;C2&quot;=&quot;T2&quot;.&quot;C2&quot;)
 
-
 
SQL&gt; SELECT
  2    T1.C1,
  3    T2.C1,
  4    T1.C2,
  5    T1.PADDING
  6  FROM
  7    T1,
  8    T2
  9  WHERE
 10    T1.C1=T2.C1
 11    AND T1.C2=T2.C2;
 
Execution Plan
----------------------------------------------------------
Plan hash value: 2959412835
 
-----------------------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      | 90000 |    19M|       |   969   (1)| 00:00:08 |
|*  1 |  HASH JOIN         |      | 90000 |    19M|  2464K|   969   (1)| 00:00:08 |
|   2 |   TABLE ACCESS FULL| T2   | 90000 |  1406K|       |   417   (1)| 00:00:04 |
|   3 |   TABLE ACCESS FULL| T1   |   100K|    20M|       |   248   (1)| 00:00:02 |
-----------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot; AND &quot;T1&quot;.&quot;C2&quot;=&quot;T2&quot;.&quot;C2&quot;)
 
-
 
SQL&gt; SELECT
  2    T1.C1,
  3    T2.C1,
  4    T1.C2,
  5    T1.PADDING,
  6    T2.PADDING
  7  FROM
  8    T1,
  9    T2
 10  WHERE
 11    T1.C1=T2.C1
 12    AND T1.C2=T2.C2;
 
Execution Plan
----------------------------------------------------------
Plan hash value: 1838229974
 
-----------------------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
-----------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      | 90000 |    54M|       |  1396   (1)| 00:00:12 |
|*  1 |  HASH JOIN         |      | 90000 |    54M|    21M|  1396   (1)| 00:00:12 |
|   2 |   TABLE ACCESS FULL| T1   |   100K|    20M|       |   248   (1)| 00:00:02 |
|   3 |   TABLE ACCESS FULL| T2   | 90000 |    35M|       |   418   (1)| 00:00:04 |
-----------------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot; AND &quot;T1&quot;.&quot;C2&quot;=&quot;T2&quot;.&quot;C2&quot;)
</pre>
<p>Let&#8217;s try again, this time with 1,000,000 rows in table T1 and 1,500,000 rows in table T2:</p>
<pre class="brush: plain; title: ; notranslate">
DROP TABLE T1 PURGE;
DROP TABLE T2 PURGE;
 
CREATE TABLE
  T1
AS
SELECT
  ROWNUM C1,
  LPAD(TO_CHAR(ROWNUM),10,'0') C2,
  LPAD('A',200,'A') PADDING
FROM
  DUAL
CONNECT BY
  LEVEL&lt;=1000000;
 
CREATE TABLE
  T2
AS
SELECT
  ROWNUM C1,
  LPAD(TO_CHAR(ROWNUM),10,'0') C2,
  LPAD('A',400,'A') PADDING
FROM
  DUAL
CONNECT BY
  LEVEL&lt;=1500000;
 
COMMIT;
 
EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=&gt;USER,TABNAME=&gt;'T1',ESTIMATE_PERCENT=&gt;NULL)
EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=&gt;USER,TABNAME=&gt;'T2',ESTIMATE_PERCENT=&gt;NULL)
</pre>
<p>This time, I will set the array fetch size to 1000, execute the queries, and retrieve the actual execution plans with the following:</p>
<pre class="brush: plain; title: ; notranslate">
SET AUTOTRACE OFF
SET LINESIZE 150
SET PAGESIZE 2000
SET TRIMSPOOL ON
SPOOL TEST_HASH_PLANS_LARGE2.TXT
 
SELECT /*+ LEADING(S) */
  T.PLAN_TABLE_OUTPUT
FROM
  (SELECT
    SQL_ID,
    CHILD_NUMBER
  FROM
    V$SQL
  WHERE
    SQL_TEXT LIKE 'SELECT%T1.C1=T2.C1%') S,
  TABLE(DBMS_XPLAN.DISPLAY_CURSOR(S.SQL_ID,S.CHILD_NUMBER,'ALLSTATS LAST +ROWS +COST +BYTES')) T;
 
SPOOL OFF
</pre>
<p>I received the following output, again, pay attention to the position of table T2 and the memory utilization:</p>
<pre class="brush: plain; title: ; notranslate">
SQL_ID  c2nzwfydj9nft, child number 0
-------------------------------------
SELECT   * FROM   T1,   T2 WHERE   T1.C1=T2.C1

Plan hash value: 1838229974

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation          | Name | Starts | E-Rows |E-Bytes|E-Temp | Cost (%CPU)| A-Rows |   A-Time   | Buffers | Reads  | Writes |  OMem |  1Mem | Used-Mem | Used-Tmp|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |      1 |        |       |       | 19750 (100)|   1000K|00:00:03.39 |     120K|  44361 |  44361 |       |       |          |         |
|*  1 |  HASH JOIN         |      |      1 |   1000K|   604M|   218M| 19750   (1)|   1000K|00:00:03.39 |     120K|  44361 |  44361 |   244M|    14M|  211M (1)|     364K|
|   2 |   TABLE ACCESS FULL| T1   |      1 |   1000K|   206M|       |  2462   (1)|   1000K|00:00:00.13 |   31263 |      0 |      0 |       |       |          |         |
|   3 |   TABLE ACCESS FULL| T2   |      1 |   1500K|   596M|       |  6938   (1)|   1500K|00:00:00.29 |   88988 |      0 |      0 |       |       |          |         |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
</pre>
<pre class="brush: plain; title: ; notranslate">
SQL_ID  1r4up8dp9fc00, child number 0
-------------------------------------
SELECT   T1.C1,   T2.C1 FROM   T1,   T2 WHERE   T1.C1=T2.C1

Plan hash value: 1838229974

---------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation          | Name | Starts | E-Rows |E-Bytes|E-Temp | Cost (%CPU)| A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
---------------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |      1 |        |       |       |  9938 (100)|   1000K|00:00:01.22 |     120K|       |       |          |
|*  1 |  HASH JOIN         |      |      1 |   1000K|    10M|    16M|  9938   (1)|   1000K|00:00:01.22 |     120K|    27M|  3871K|   43M (0)|
|   2 |   TABLE ACCESS FULL| T1   |      1 |   1000K|  4882K|       |  2460   (1)|   1000K|00:00:00.10 |   31263 |       |       |          |
|   3 |   TABLE ACCESS FULL| T2   |      1 |   1500K|  8789K|       |  6935   (1)|   1500K|00:00:00.23 |   89195 |       |       |          |
---------------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot;)
</pre>
<pre class="brush: plain; title: ; notranslate">
SQL_ID  0rnjh74c5m1dc, child number 0
-------------------------------------
SELECT   T1.C1,   T2.C1 FROM   T1,   T2 WHERE   T1.C1=T2.C1   AND
T1.C2=T2.C2

Plan hash value: 1838229974

---------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation          | Name | Starts | E-Rows |E-Bytes|E-Temp | Cost (%CPU)| A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
---------------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |      1 |        |       |       | 10266 (100)|   1000K|00:00:01.45 |     120K|       |       |          |
|*  1 |  HASH JOIN         |      |      1 |   1000K|    31M|    26M| 10266   (1)|   1000K|00:00:01.45 |     120K|    40M|  5750K|   59M (0)|
|   2 |   TABLE ACCESS FULL| T1   |      1 |   1000K|    15M|       |  2461   (1)|   1000K|00:00:00.10 |   31263 |       |       |          |
|   3 |   TABLE ACCESS FULL| T2   |      1 |   1500K|    24M|       |  6936   (1)|   1500K|00:00:00.26 |   89195 |       |       |          |
---------------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot; AND &quot;T1&quot;.&quot;C2&quot;=&quot;T2&quot;.&quot;C2&quot;)
</pre>
<pre class="brush: plain; title: ; notranslate">
SQL_ID  c691ypk4k096j, child number 0
-------------------------------------
SELECT   T1.C1,   T2.C1,   T1.C2 FROM   T1,   T2 WHERE   T1.C1=T2.C1
AND T1.C2=T2.C2

Plan hash value: 1838229974

---------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation          | Name | Starts | E-Rows |E-Bytes|E-Temp | Cost (%CPU)| A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
---------------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |      1 |        |       |       | 10266 (100)|   1000K|00:00:01.52 |     120K|       |       |          |
|*  1 |  HASH JOIN         |      |      1 |   1000K|    31M|    26M| 10266   (1)|   1000K|00:00:01.52 |     120K|    40M|  5750K|   59M (0)|
|   2 |   TABLE ACCESS FULL| T1   |      1 |   1000K|    15M|       |  2461   (1)|   1000K|00:00:00.12 |   31263 |       |       |          |
|   3 |   TABLE ACCESS FULL| T2   |      1 |   1500K|    24M|       |  6936   (1)|   1500K|00:00:00.25 |   89195 |       |       |          |
---------------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot; AND &quot;T1&quot;.&quot;C2&quot;=&quot;T2&quot;.&quot;C2&quot;)
</pre>
<pre class="brush: plain; title: ; notranslate">
SQL_ID  dpq7d224rxc6t, child number 0
-------------------------------------
SELECT   T1.C1,   T2.C1,   T1.C2,   T1.PADDING FROM   T1,   T2 WHERE
T1.C1=T2.C1   AND T1.C2=T2.C2

Plan hash value: 2959412835

---------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation          | Name | Starts | E-Rows |E-Bytes|E-Temp | Cost (%CPU)| A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
---------------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |      1 |        |       |       | 12646 (100)|   1000K|00:00:01.54 |     120K|       |       |          |
|*  1 |  HASH JOIN         |      |      1 |   1000K|   223M|    41M| 12646   (1)|   1000K|00:00:01.54 |     120K|    59M|  5667K|   85M (0)|
|   2 |   TABLE ACCESS FULL| T2   |      1 |   1500K|    24M|       |  6936   (1)|   1500K|00:00:00.20 |   88254 |       |       |          |
|   3 |   TABLE ACCESS FULL| T1   |      1 |   1000K|   206M|       |  2462   (1)|   1000K|00:00:00.15 |   32263 |       |       |          |
---------------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot; AND &quot;T1&quot;.&quot;C2&quot;=&quot;T2&quot;.&quot;C2&quot;)
</pre>
<pre class="brush: plain; title: ; notranslate">
SQL_ID  0k4q3ahjzu9nd, child number 0
-------------------------------------
SELECT   T1.C1,   T2.C1,   T1.C2,   T1.PADDING,   T2.PADDING FROM   T1,
  T2 WHERE   T1.C1=T2.C1   AND T1.C2=T2.C2

Plan hash value: 1838229974

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation          | Name | Starts | E-Rows |E-Bytes|E-Temp | Cost (%CPU)| A-Rows |   A-Time   | Buffers | Reads  | Writes |  OMem |  1Mem | Used-Mem | Used-Tmp|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |      1 |        |       |       | 19750 (100)|   1000K|00:00:03.53 |     120K|  44330 |  44330 |       |       |          |         |
|*  1 |  HASH JOIN         |      |      1 |   1000K|   604M|   218M| 19750   (1)|   1000K|00:00:03.53 |     120K|  44330 |  44330 |   244M|    14M|  211M (1)|     364K|
|   2 |   TABLE ACCESS FULL| T1   |      1 |   1000K|   206M|       |  2462   (1)|   1000K|00:00:00.12 |   31263 |      0 |      0 |       |       |          |         |
|   3 |   TABLE ACCESS FULL| T2   |      1 |   1500K|   596M|       |  6938   (1)|   1500K|00:00:00.28 |   88985 |      0 |      0 |       |       |          |         |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access(&quot;T1&quot;.&quot;C1&quot;=&quot;T2&quot;.&quot;C1&quot; AND &quot;T1&quot;.&quot;C2&quot;=&quot;T2&quot;.&quot;C2&quot;)
</pre>
<p>Anything else wrong with the quote?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Berger</title>
		<link>http://hoopercharles.wordpress.com/2010/12/29/hash-joins-what-is-wrong-with-this-statement/#comment-2526</link>
		<dc:creator><![CDATA[Martin Berger]]></dc:creator>
		<pubDate>Wed, 29 Dec 2010 19:09:10 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4151#comment-2526</guid>
		<description><![CDATA[You gave a hice hint with Chris&#039; TOP. 
 And I was quite too lazy to test it myself, but as you used a different size of padding columns, this was the 2nd hint. 
 So I&#039;d say &#039;...return the fewest rows...&#039; is a good start for general use, but &#039;... fewest bytes ...&#039; would be some more precise. 
 But for the correct wording (&#039;byte&#039;, &#039;data&#039;, &#039;size&#039;???) a lot more testing and reading of 10053 traces might be needed. 
 I&#039;d start to check sum(AVG_COL_LEN [of all columns of interest]) * num_rows. But I can not even imagine where in the cavern of the Optimizer it will end.
 It makes totally sense as oracle tries to save as much resources as it can. Therefore it only reads all those columns into memory it will need later - nothing more (but not only those it needs for a join - otherwise it might need to revisit some rows a 2nd time for the &#039;other&#039; columns).]]></description>
		<content:encoded><![CDATA[<p>You gave a hice hint with Chris&#8217; TOP.<br />
 And I was quite too lazy to test it myself, but as you used a different size of padding columns, this was the 2nd hint.<br />
 So I&#8217;d say &#8216;&#8230;return the fewest rows&#8230;&#8217; is a good start for general use, but &#8216;&#8230; fewest bytes &#8230;&#8217; would be some more precise.<br />
 But for the correct wording (&#8216;byte&#8217;, &#8216;data&#8217;, &#8216;size&#8217;???) a lot more testing and reading of 10053 traces might be needed.<br />
 I&#8217;d start to check sum(AVG_COL_LEN [of all columns of interest]) * num_rows. But I can not even imagine where in the cavern of the Optimizer it will end.<br />
 It makes totally sense as oracle tries to save as much resources as it can. Therefore it only reads all those columns into memory it will need later &#8211; nothing more (but not only those it needs for a join &#8211; otherwise it might need to revisit some rows a 2nd time for the &#8216;other&#8217; columns).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nigel Thomas</title>
		<link>http://hoopercharles.wordpress.com/2010/12/29/hash-joins-what-is-wrong-with-this-statement/#comment-2525</link>
		<dc:creator><![CDATA[Nigel Thomas]]></dc:creator>
		<pubDate>Wed, 29 Dec 2010 19:03:32 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=4151#comment-2525</guid>
		<description><![CDATA[I would assume that the expected size in memory of each possible hashed table would considered (accurately or not depending on what statistics were available); applying any possible filters and projecting only the required columns into the hash table could considerably reduce the memory footprint.

In some cases it would be better to have the table with the larger number of rows but smaller size in the hash table; that would take up less memory and require fewer probes into the hash table during the hash join itself as the second table (with fewer/larger rows) is scanned.

Mind you, at the moment that&#039;s based on logic, not observation.

Regards Nigel]]></description>
		<content:encoded><![CDATA[<p>I would assume that the expected size in memory of each possible hashed table would considered (accurately or not depending on what statistics were available); applying any possible filters and projecting only the required columns into the hash table could considerably reduce the memory footprint.</p>
<p>In some cases it would be better to have the table with the larger number of rows but smaller size in the hash table; that would take up less memory and require fewer probes into the hash table during the hash join itself as the second table (with fewer/larger rows) is scanned.</p>
<p>Mind you, at the moment that&#8217;s based on logic, not observation.</p>
<p>Regards Nigel</p>
]]></content:encoded>
	</item>
</channel>
</rss>
