<?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"
	>
<channel>
	<title>Comments for Structured Data</title>
	<atom:link href="http://structureddata.org/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://structureddata.org</link>
	<description>Oracle Database Performance And Scalability Blog</description>
	<pubDate>Fri, 05 Sep 2008 13:57:17 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>Comment on Troubleshooting Bad Execution Plans by Kyle Hailey</title>
		<link>http://structureddata.org/2007/11/21/troubleshooting-bad-execution-plans/#comment-2934</link>
		<dc:creator>Kyle Hailey</dc:creator>
		<pubDate>Thu, 04 Sep 2008 00:38:44 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/2007/11/21/troubleshooting-bad-execution-plans/#comment-2934</guid>
		<description>Just to be a little clearer, here is the standard output 
&lt;pre&gt;
-----------------------------------------------------------------------------------
&#124; Id  &#124; Operation                    &#124; Name            &#124; Starts &#124; E-Rows &#124; A-Rows &#124;
-----------------------------------------------------------------------------------
&#124;   1 &#124;  SORT AGGREGATE              &#124;                 &#124;      1 &#124;      1 &#124;      1 &#124;
&#124;*  2 &#124;   TABLE ACCESS BY INDEX ROWID&#124; WB_JOB          &#124;      1 &#124;      1 &#124;   1657 &#124;
&#124;   3 &#124;    NESTED LOOPS              &#124;                 &#124;      1 &#124;      1 &#124;  46346 &#124;
&#124;*  4 &#124;     HASH JOIN                &#124;                 &#124;      1 &#124;      1 &#124;  23171 &#124;
&#124;*  5 &#124;      INDEX RANGE SCAN        &#124; PS0PAY_CALENDAR &#124;      1 &#124;      1 &#124;      1 &#124;
&#124;   6 &#124;      VIEW                    &#124; VW_SQ_1         &#124;      1 &#124;   1925 &#124;  23171 &#124;
&#124;   7 &#124;       HASH GROUP BY          &#124;                 &#124;      1 &#124;   1925 &#124;  23171 &#124;
&#124;   8 &#124;        NESTED LOOPS          &#124;                 &#124;      1 &#124;   1925 &#124;  33020 &#124;
&#124;*  9 &#124;         INDEX RANGE SCAN     &#124; PS0PAY_CALENDAR &#124;      1 &#124;      1 &#124;      1 &#124;
&#124;* 10 &#124;         INDEX FAST FULL SCAN &#124; WB_JOB          &#124;      1 &#124;   2000 &#124;  33020 &#124;
&#124;* 11 &#124;     INDEX RANGE SCAN         &#124; WB_JOB          &#124;  23171 &#124;      1 &#124;  23174 &#124;
-----------------------------------------------------------------------------------

Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
   1 - SEL$11A0A147
   2 - SEL$11A0A147 / B@SEL$2
   5 - SEL$11A0A147 / A@SEL$2
   6 - SEL$975CABD1 / VW_SQ_1@SEL$5D2EE882
   7 - SEL$975CABD1
   9 - SEL$975CABD1 / A@SEL$D5F10F0C
  10 - SEL$975CABD1 / F@SEL$3
  11 - SEL$11A0A147 / B@SEL$2
&lt;/pre&gt;
There are only 2 query blocks:
   1 - SEL$11A0A147
   7 - SEL$975CABD1

Query block ID=1 should have a cardinality of 1657 but says 1 so I'll put in the hint
   cardinality(SEL$11A0A147 1657
Query block at ID=7 should have a cardinality of 23171 but is esitmated at 1925 so I add the hint
   cardinality(SEL$975CABD1 23171)
but after adding the hint the query plan and statistics are exactly the same</description>
		<content:encoded><![CDATA[<p>Just to be a little clearer, here is the standard output </p>
<pre>
-----------------------------------------------------------------------------------
| Id  | Operation                    | Name            | Starts | E-Rows | A-Rows |
-----------------------------------------------------------------------------------
|   1 |  SORT AGGREGATE              |                 |      1 |      1 |      1 |
|*  2 |   TABLE ACCESS BY INDEX ROWID| WB_JOB          |      1 |      1 |   1657 |
|   3 |    NESTED LOOPS              |                 |      1 |      1 |  46346 |
|*  4 |     HASH JOIN                |                 |      1 |      1 |  23171 |
|*  5 |      INDEX RANGE SCAN        | PS0PAY_CALENDAR |      1 |      1 |      1 |
|   6 |      VIEW                    | VW_SQ_1         |      1 |   1925 |  23171 |
|   7 |       HASH GROUP BY          |                 |      1 |   1925 |  23171 |
|   8 |        NESTED LOOPS          |                 |      1 |   1925 |  33020 |
|*  9 |         INDEX RANGE SCAN     | PS0PAY_CALENDAR |      1 |      1 |      1 |
|* 10 |         INDEX FAST FULL SCAN | WB_JOB          |      1 |   2000 |  33020 |
|* 11 |     INDEX RANGE SCAN         | WB_JOB          |  23171 |      1 |  23174 |
-----------------------------------------------------------------------------------

Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
   1 - SEL$11A0A147
   2 - SEL$11A0A147 / B@SEL$2
   5 - SEL$11A0A147 / A@SEL$2
   6 - SEL$975CABD1 / VW_SQ_1@SEL$5D2EE882
   7 - SEL$975CABD1
   9 - SEL$975CABD1 / A@SEL$D5F10F0C
  10 - SEL$975CABD1 / F@SEL$3
  11 - SEL$11A0A147 / B@SEL$2
</pre>
<p>There are only 2 query blocks:<br />
   1 - SEL$11A0A147<br />
   7 - SEL$975CABD1</p>
<p>Query block ID=1 should have a cardinality of 1657 but says 1 so I&#8217;ll put in the hint<br />
   cardinality(SEL$11A0A147 1657<br />
Query block at ID=7 should have a cardinality of 23171 but is esitmated at 1925 so I add the hint<br />
   cardinality(SEL$975CABD1 23171)<br />
but after adding the hint the query plan and statistics are exactly the same</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Troubleshooting Bad Execution Plans by Kyle Hailey</title>
		<link>http://structureddata.org/2007/11/21/troubleshooting-bad-execution-plans/#comment-2925</link>
		<dc:creator>Kyle Hailey</dc:creator>
		<pubDate>Wed, 03 Sep 2008 21:55:26 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/2007/11/21/troubleshooting-bad-execution-plans/#comment-2925</guid>
		<description>forgot to give the plan with hints (this is for the last explain plan)
&lt;pre&gt;
SELECT 
      /*+ 
       cardinality(SEL$11A0A147  1)
       cardinality(SEL$975CABD1  23171)
	 */
    A.COMPANY
  , A.PAYGROUP
from  PS_PAY_CALENDAR A
    , WB_JOB B
where A.RUN_ID = 'PD2'
  and A.PAY_CONFIRM_RUN = 'N'
  and B.COMPANY = A.COMPANY
  and B.PAYGROUP = A.PAYGROUP
  and B.EFFDT = (
	 SELECT 
	 MAX(F.EFFDT)
      from WB_JOB F
      where F.EMPLID = B.EMPLID
        and F.EMPL_RCD# = B.EMPL_RCD#
        and F.EFFDT&#60; = A.PAY_END_DT)
)
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>forgot to give the plan with hints (this is for the last explain plan)</p>
<pre>
SELECT
      /*+
       cardinality(SEL$11A0A147  1)
       cardinality(SEL$975CABD1  23171)
	 */
    A.COMPANY
  , A.PAYGROUP
from  PS_PAY_CALENDAR A
    , WB_JOB B
where A.RUN_ID = 'PD2'
  and A.PAY_CONFIRM_RUN = 'N'
  and B.COMPANY = A.COMPANY
  and B.PAYGROUP = A.PAYGROUP
  and B.EFFDT = (
	 SELECT
	 MAX(F.EFFDT)
      from WB_JOB F
      where F.EMPLID = B.EMPLID
        and F.EMPL_RCD# = B.EMPL_RCD#
        and F.EFFDT&lt; = A.PAY_END_DT)
)
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Troubleshooting Bad Execution Plans by Kyle Hailey</title>
		<link>http://structureddata.org/2007/11/21/troubleshooting-bad-execution-plans/#comment-2924</link>
		<dc:creator>Kyle Hailey</dc:creator>
		<pubDate>Wed, 03 Sep 2008 21:53:58 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/2007/11/21/troubleshooting-bad-execution-plans/#comment-2924</guid>
		<description>very cool, but alias doesn't seem to do much for me. Here is the plan with aliases (cool feature)
&lt;pre&gt;
----------------------------------------------------------------
&#124; Id  &#124; Operation                    &#124; Name            &#124; Rows  &#124;
----------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT             &#124;                 &#124;       &#124;
&#124;   1 &#124;  SORT AGGREGATE              &#124;                 &#124;     1 &#124;  SEL$11A0A147
&#124;*  2 &#124;   TABLE ACCESS BY INDEX ROWID&#124; WB_JOB          &#124;     1 &#124;  SEL$11A0A147 / B@SEL$2
&#124;   3 &#124;    NESTED LOOPS              &#124;                 &#124;     1 &#124;
&#124;*  4 &#124;     HASH JOIN                &#124;                 &#124;    10 &#124;
&#124;*  5 &#124;      INDEX RANGE SCAN        &#124; PS0PAY_CALENDAR &#124;     1 &#124;  SEL$11A0A147 / A@SEL$2
&#124;   6 &#124;      VIEW                    &#124; VW_SQ_1         &#124; 23171 &#124;  SEL$975CABD1 / VW_SQ_1@SEL$5D2EE882
&#124;   7 &#124;       HASH GROUP BY          &#124;                 &#124; 23171 &#124;  SEL$975CABD1
&#124;   8 &#124;        NESTED LOOPS          &#124;                 &#124;  1925 &#124; 
&#124;*  9 &#124;         INDEX RANGE SCAN     &#124; PS0PAY_CALENDAR &#124;     1 &#124;  SEL$975CABD1 / A@SEL$D5F10F0C
&#124;* 10 &#124;         INDEX FAST FULL SCAN &#124; WB_JOB          &#124;  2000 &#124;  SEL$975CABD1 / F@SEL$3
&#124;* 11 &#124;     INDEX RANGE SCAN         &#124; WB_JOB          &#124;     1 &#124;  SEL$11A0A147 / B@SEL$2
&lt;/pre&gt;
but the it doesn't seem to affect the estimated cardinalities
&lt;pre&gt;
 ID     STARTS     E_ROWS     A_ROWS      RATIO RATIO_G    operation
--- ---------- ---------- ---------- ---------- ---------- -----------------------------------------
  0                                                        SELECT STATEMENT ~
  1          1          1          1          1             SORT ~ AGGREGATE
  2          1          1       1657      .0006 6---         TABLE ACCESS ~ BY INDEX ROWID WB_JOB
  3          1          1      46346          0 2----         NESTED LOOPS ~
  4          1          1      23171          0 4----          HASH JOIN ~
  5          1          1          1          1                 INDEX ~ RANGE SCAN PS0PAY_CALENDAR
  6          1       1925      23171      .0831 8-              VIEW ~  VW_SQ_1
  7          1       1925      23171      .0831 8-               HASH ~ GROUP BY
  8          1       1925      33020      .0583 5-                NESTED LOOPS ~
  9          1          1          1          1                    INDEX ~ RANGE SCAN PS0PAY_CALENDAR
 10          1       2000      33020      .0606 6-                 INDEX ~ FAST FULL SCAN WB_JOB
 11      23171      23171      23174      .9999                INDEX ~ RANGE SCAN WB_JOB
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>very cool, but alias doesn&#8217;t seem to do much for me. Here is the plan with aliases (cool feature)</p>
<pre>
----------------------------------------------------------------
| Id  | Operation                    | Name            | Rows  |
----------------------------------------------------------------
|   0 | SELECT STATEMENT             |                 |       |
|   1 |  SORT AGGREGATE              |                 |     1 |  SEL$11A0A147
|*  2 |   TABLE ACCESS BY INDEX ROWID| WB_JOB          |     1 |  SEL$11A0A147 / B@SEL$2
|   3 |    NESTED LOOPS              |                 |     1 |
|*  4 |     HASH JOIN                |                 |    10 |
|*  5 |      INDEX RANGE SCAN        | PS0PAY_CALENDAR |     1 |  SEL$11A0A147 / A@SEL$2
|   6 |      VIEW                    | VW_SQ_1         | 23171 |  SEL$975CABD1 / VW_SQ_1@SEL$5D2EE882
|   7 |       HASH GROUP BY          |                 | 23171 |  SEL$975CABD1
|   8 |        NESTED LOOPS          |                 |  1925 |
|*  9 |         INDEX RANGE SCAN     | PS0PAY_CALENDAR |     1 |  SEL$975CABD1 / A@SEL$D5F10F0C
|* 10 |         INDEX FAST FULL SCAN | WB_JOB          |  2000 |  SEL$975CABD1 / F@SEL$3
|* 11 |     INDEX RANGE SCAN         | WB_JOB          |     1 |  SEL$11A0A147 / B@SEL$2
</pre>
<p>but the it doesn&#8217;t seem to affect the estimated cardinalities</p>
<pre>
 ID     STARTS     E_ROWS     A_ROWS      RATIO RATIO_G    operation
--- ---------- ---------- ---------- ---------- ---------- -----------------------------------------
  0                                                        SELECT STATEMENT ~
  1          1          1          1          1             SORT ~ AGGREGATE
  2          1          1       1657      .0006 6---         TABLE ACCESS ~ BY INDEX ROWID WB_JOB
  3          1          1      46346          0 2----         NESTED LOOPS ~
  4          1          1      23171          0 4----          HASH JOIN ~
  5          1          1          1          1                 INDEX ~ RANGE SCAN PS0PAY_CALENDAR
  6          1       1925      23171      .0831 8-              VIEW ~  VW_SQ_1
  7          1       1925      23171      .0831 8-               HASH ~ GROUP BY
  8          1       1925      33020      .0583 5-                NESTED LOOPS ~
  9          1          1          1          1                    INDEX ~ RANGE SCAN PS0PAY_CALENDAR
 10          1       2000      33020      .0606 6-                 INDEX ~ FAST FULL SCAN WB_JOB
 11      23171      23171      23174      .9999                INDEX ~ RANGE SCAN WB_JOB
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Troubleshooting Bad Execution Plans by Greg Rahn</title>
		<link>http://structureddata.org/2007/11/21/troubleshooting-bad-execution-plans/#comment-2916</link>
		<dc:creator>Greg Rahn</dc:creator>
		<pubDate>Wed, 03 Sep 2008 18:20:11 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/2007/11/21/troubleshooting-bad-execution-plans/#comment-2916</guid>
		<description>@Kyle

The CARDINALITY hint only tells the Optimizer how many rows to expect from a given row source, so it must be applied to a table, subquery, query block, table function, etc. 

In your case I think you will have to use a query block alias because you want to tell the Optimizer the cardinality coming out of a join.  There easiest way to do this is to use this command:
&lt;code&gt;select * from table(dbms_xplan.display_cursor(null,null,'+alias'));&lt;/code&gt;
to print the Query Block Name and Object Alias.  

Here is a simple example with EMP and DEPT:
&lt;pre&gt;
PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------------
SQL_ID	3s509v1mg0f9c, child number 0
-------------------------------------
select a.ename from emp a, dept b where a.sal &gt; 100 and b.deptno &gt; 10
and a.empno = (select max(c.empno) from emp c where c.deptno=b.deptno)

Plan hash value: 1741140072

---------------------------------------------------------------------------------
&#124; Id  &#124; Operation	      &#124; Name	&#124; Rows	&#124; Bytes &#124; Cost (%CPU)&#124; Time	&#124;
---------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT      &#124; 	&#124;	&#124;	&#124;     8 (100)&#124;		&#124;
&#124;*  1 &#124;  HASH JOIN	      &#124; 	&#124;     8 &#124;   696 &#124;     8  (25)&#124; 00:00:01 &#124;
&#124;   2 &#124;   NESTED LOOPS	      &#124; 	&#124;     8 &#124;   432 &#124;     4  (25)&#124; 00:00:01 &#124;
&#124;   3 &#124;    VIEW 	      &#124; VW_SQ_1 &#124;    11 &#124;   308 &#124;     4  (25)&#124; 00:00:01 &#124;
&#124;   4 &#124;     HASH GROUP BY     &#124; 	&#124;    11 &#124;   572 &#124;     4  (25)&#124; 00:00:01 &#124;
&#124;*  5 &#124;      TABLE ACCESS FULL&#124; EMP	&#124;    11 &#124;   572 &#124;     3   (0)&#124; 00:00:01 &#124;
&#124;*  6 &#124;    INDEX UNIQUE SCAN  &#124; PK_DEPT &#124;     1 &#124;    26 &#124;     0   (0)&#124;		&#124;
&#124;*  7 &#124;   TABLE ACCESS FULL   &#124; EMP	&#124;    14 &#124;   462 &#124;     3   (0)&#124; 00:00:01 &#124;
---------------------------------------------------------------------------------

Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------

   1 - SEL$C772B8D1
   3 - SEL$683B0107 / VW_SQ_1@SEL$7511BFD2
   4 - SEL$683B0107
   5 - SEL$683B0107 / C@SEL$2
   6 - SEL$C772B8D1 / B@SEL$1
   7 - SEL$C772B8D1 / A@SEL$1
&lt;/pre&gt;

Now add the hint.

&lt;pre&gt;
PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------
SQL_ID	71qkwmpfycyug, child number 0
-------------------------------------
select /*+ cardinality(SEL$683B0107 1000) */ a.ename from emp a, dept b where
a.sal &gt; 100 and b.deptno &gt; 10 and a.empno = (select max(c.empno) from emp c
where c.deptno=b.deptno)

Plan hash value: 2484712894

-----------------------------------------------------------------------------------------
&#124; Id  &#124; Operation		      &#124; Name	&#124; Rows	&#124; Bytes &#124; Cost (%CPU)&#124; Time	&#124;
-----------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT	      &#124; 	&#124;	&#124;	&#124;     7 (100)&#124;		&#124;
&#124;   1 &#124;  NESTED LOOPS		      &#124; 	&#124;     3 &#124;   144 &#124;     7  (29)&#124; 00:00:01 &#124;
&#124;   2 &#124;   MERGE JOIN		      &#124; 	&#124;     3 &#124;   126 &#124;     7  (29)&#124; 00:00:01 &#124;
&#124;*  3 &#124;    TABLE ACCESS BY INDEX ROWID&#124; EMP	&#124;    14 &#124;   196 &#124;     2   (0)&#124; 00:00:01 &#124;
&#124;   4 &#124;     INDEX FULL SCAN	      &#124; PK_EMP	&#124;    14 &#124;	&#124;     1   (0)&#124; 00:00:01 &#124;
&#124;*  5 &#124;    SORT JOIN		      &#124; 	&#124;     3 &#124;    84 &#124;     5  (40)&#124; 00:00:01 &#124;
&#124;   6 &#124;     VIEW		      &#124; VW_SQ_1 &#124;     3 &#124;    84 &#124;     4  (25)&#124; 00:00:01 &#124;
&#124;   7 &#124;      HASH GROUP BY	      &#124; 	&#124;     3 &#124;    39 &#124;     4  (25)&#124; 00:00:01 &#124;
&#124;*  8 &#124;       TABLE ACCESS FULL       &#124; EMP	&#124;    11 &#124;   143 &#124;     3   (0)&#124; 00:00:01 &#124;
&#124;*  9 &#124;   INDEX UNIQUE SCAN	      &#124; PK_DEPT &#124;     1 &#124;     6 &#124;     0   (0)&#124;		&#124;
-----------------------------------------------------------------------------------------

Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------

   1 - SEL$C772B8D1
   3 - SEL$C772B8D1 / A@SEL$1
   4 - SEL$C772B8D1 / A@SEL$1
   6 - SEL$683B0107 / VW_SQ_1@SEL$7511BFD2
   7 - SEL$683B0107
   8 - SEL$683B0107 / C@SEL$2
   9 - SEL$C772B8D1 / B@SEL$1

&lt;/pre&gt;

Hope this helps.</description>
		<content:encoded><![CDATA[<p>@Kyle</p>
<p>The CARDINALITY hint only tells the Optimizer how many rows to expect from a given row source, so it must be applied to a table, subquery, query block, table function, etc. </p>
<p>In your case I think you will have to use a query block alias because you want to tell the Optimizer the cardinality coming out of a join.  There easiest way to do this is to use this command:<br />
<code>select * from table(dbms_xplan.display_cursor(null,null,'+alias'));</code><br />
to print the Query Block Name and Object Alias.  </p>
<p>Here is a simple example with EMP and DEPT:</p>
<pre>
PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------------
SQL_ID	3s509v1mg0f9c, child number 0
-------------------------------------
select a.ename from emp a, dept b where a.sal > 100 and b.deptno > 10
and a.empno = (select max(c.empno) from emp c where c.deptno=b.deptno)

Plan hash value: 1741140072

---------------------------------------------------------------------------------
| Id  | Operation	      | Name	| Rows	| Bytes | Cost (%CPU)| Time	|
---------------------------------------------------------------------------------
|   0 | SELECT STATEMENT      | 	|	|	|     8 (100)|		|
|*  1 |  HASH JOIN	      | 	|     8 |   696 |     8  (25)| 00:00:01 |
|   2 |   NESTED LOOPS	      | 	|     8 |   432 |     4  (25)| 00:00:01 |
|   3 |    VIEW 	      | VW_SQ_1 |    11 |   308 |     4  (25)| 00:00:01 |
|   4 |     HASH GROUP BY     | 	|    11 |   572 |     4  (25)| 00:00:01 |
|*  5 |      TABLE ACCESS FULL| EMP	|    11 |   572 |     3   (0)| 00:00:01 |
|*  6 |    INDEX UNIQUE SCAN  | PK_DEPT |     1 |    26 |     0   (0)|		|
|*  7 |   TABLE ACCESS FULL   | EMP	|    14 |   462 |     3   (0)| 00:00:01 |
---------------------------------------------------------------------------------

Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------

   1 - SEL$C772B8D1
   3 - SEL$683B0107 / VW_SQ_1@SEL$7511BFD2
   4 - SEL$683B0107
   5 - SEL$683B0107 / C@SEL$2
   6 - SEL$C772B8D1 / B@SEL$1
   7 - SEL$C772B8D1 / A@SEL$1
</pre>
<p>Now add the hint.</p>
<pre>
PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------
SQL_ID	71qkwmpfycyug, child number 0
-------------------------------------
select /*+ cardinality(SEL$683B0107 1000) */ a.ename from emp a, dept b where
a.sal > 100 and b.deptno > 10 and a.empno = (select max(c.empno) from emp c
where c.deptno=b.deptno)

Plan hash value: 2484712894

-----------------------------------------------------------------------------------------
| Id  | Operation		      | Name	| Rows	| Bytes | Cost (%CPU)| Time	|
-----------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT	      | 	|	|	|     7 (100)|		|
|   1 |  NESTED LOOPS		      | 	|     3 |   144 |     7  (29)| 00:00:01 |
|   2 |   MERGE JOIN		      | 	|     3 |   126 |     7  (29)| 00:00:01 |
|*  3 |    TABLE ACCESS BY INDEX ROWID| EMP	|    14 |   196 |     2   (0)| 00:00:01 |
|   4 |     INDEX FULL SCAN	      | PK_EMP	|    14 |	|     1   (0)| 00:00:01 |
|*  5 |    SORT JOIN		      | 	|     3 |    84 |     5  (40)| 00:00:01 |
|   6 |     VIEW		      | VW_SQ_1 |     3 |    84 |     4  (25)| 00:00:01 |
|   7 |      HASH GROUP BY	      | 	|     3 |    39 |     4  (25)| 00:00:01 |
|*  8 |       TABLE ACCESS FULL       | EMP	|    11 |   143 |     3   (0)| 00:00:01 |
|*  9 |   INDEX UNIQUE SCAN	      | PK_DEPT |     1 |     6 |     0   (0)|		|
-----------------------------------------------------------------------------------------

Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------

   1 - SEL$C772B8D1
   3 - SEL$C772B8D1 / A@SEL$1
   4 - SEL$C772B8D1 / A@SEL$1
   6 - SEL$683B0107 / VW_SQ_1@SEL$7511BFD2
   7 - SEL$683B0107
   8 - SEL$683B0107 / C@SEL$2
   9 - SEL$C772B8D1 / B@SEL$1
</pre>
<p>Hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Troubleshooting Bad Execution Plans by Kyle Hailey</title>
		<link>http://structureddata.org/2007/11/21/troubleshooting-bad-execution-plans/#comment-2913</link>
		<dc:creator>Kyle Hailey</dc:creator>
		<pubDate>Wed, 03 Sep 2008 17:53:34 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/2007/11/21/troubleshooting-bad-execution-plans/#comment-2913</guid>
		<description>Actually I can get the cardinality on the next line to go up about a maximum of 7500 and then it abruptly drops off to 286 
when taking the hint from  /*+ cardinality(F 50000) */ to  /*+ cardinality(F 150000) */ 
outside of the bounds (give or take a few 100) the cardinality drops off.</description>
		<content:encoded><![CDATA[<p>Actually I can get the cardinality on the next line to go up about a maximum of 7500 and then it abruptly drops off to 286<br />
when taking the hint from  /*+ cardinality(F 50000) */ to  /*+ cardinality(F 150000) */<br />
outside of the bounds (give or take a few 100) the cardinality drops off.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Troubleshooting Bad Execution Plans by Kyle Hailey</title>
		<link>http://structureddata.org/2007/11/21/troubleshooting-bad-execution-plans/#comment-2911</link>
		<dc:creator>Kyle Hailey</dc:creator>
		<pubDate>Wed, 03 Sep 2008 17:32:47 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/2007/11/21/troubleshooting-bad-execution-plans/#comment-2911</guid>
		<description>can the cardinality hint be applied to things like INDEX FAST FULL SCAN?
I've tried applying it but the results aren't what I'd expect.
Here's my plan
&lt;pre&gt;
 STARTS     E_ROWS     A_ROWS      RATIO operation
------- ---------- ---------- ---------- ------------------------------------------
                                         SELECT STATEMENT ~
      1          1          1          1  SORT ~ AGGREGATE
      1          1       1657      .0006   TABLE ACCESS ~ BY INDEX ROWID WB_JOB
      1          1      46346          0    NESTED LOOPS ~
      1          1      23171          0     HASH JOIN ~
      1          1          1          1      INDEX ~ RANGE SCAN PS0PAY_CALENDAR
      1       1925      23171      .0831      VIEW ~  VW_SQ_1
      1       1925      23171      .0831       HASH ~ GROUP BY
      1       1925      33020      .0583        NESTED LOOPS ~
      1          1          1          1         INDEX ~ RANGE SCAN PS0PAY_CALENDAR
      1       2000      33020      .0606         INDEX ~ FAST FULL SCAN WB_JOB
  23171      23171      23174      .9999     INDEX ~ RANGE SCAN WB_JOB
&lt;/pre&gt;
I've tried cardinality hint to fix the discrepancy at the next to last line of the  plan. For example
&lt;pre&gt;
SELECT 
    A.COMPANY
  , A.PAYGROUP
from  PS_PAY_CALENDAR A
    , WB_JOB B
where A.RUN_ID = 'PD2'
  and A.PAY_CONFIRM_RUN = 'N'
  and B.COMPANY = A.COMPANY
  and B.PAYGROUP = A.PAYGROUP
  and B.EFFDT = (SELECT 
      /*+ cardinality(F 33000) */ 
	 MAX(F.EFFDT)
      from WB_JOB F
      where F.EMPLID = B.EMPLID
        and F.EMPL_RCD# = B.EMPL_RCD#
        and F.EFFDT&#60; = A.PAY_END_DT)
/
&lt;/pre&gt;
but whether I shift the cardinality up or down via the hint, the discrepancy in the plan becomes works (both with higher and lower cardinality hint values)</description>
		<content:encoded><![CDATA[<p>can the cardinality hint be applied to things like INDEX FAST FULL SCAN?<br />
I&#8217;ve tried applying it but the results aren&#8217;t what I&#8217;d expect.<br />
Here&#8217;s my plan</p>
<pre>
 STARTS     E_ROWS     A_ROWS      RATIO operation
------- ---------- ---------- ---------- ------------------------------------------
                                         SELECT STATEMENT ~
      1          1          1          1  SORT ~ AGGREGATE
      1          1       1657      .0006   TABLE ACCESS ~ BY INDEX ROWID WB_JOB
      1          1      46346          0    NESTED LOOPS ~
      1          1      23171          0     HASH JOIN ~
      1          1          1          1      INDEX ~ RANGE SCAN PS0PAY_CALENDAR
      1       1925      23171      .0831      VIEW ~  VW_SQ_1
      1       1925      23171      .0831       HASH ~ GROUP BY
      1       1925      33020      .0583        NESTED LOOPS ~
      1          1          1          1         INDEX ~ RANGE SCAN PS0PAY_CALENDAR
      1       2000      33020      .0606         INDEX ~ FAST FULL SCAN WB_JOB
  23171      23171      23174      .9999     INDEX ~ RANGE SCAN WB_JOB
</pre>
<p>I&#8217;ve tried cardinality hint to fix the discrepancy at the next to last line of the  plan. For example</p>
<pre>
SELECT
    A.COMPANY
  , A.PAYGROUP
from  PS_PAY_CALENDAR A
    , WB_JOB B
where A.RUN_ID = 'PD2'
  and A.PAY_CONFIRM_RUN = 'N'
  and B.COMPANY = A.COMPANY
  and B.PAYGROUP = A.PAYGROUP
  and B.EFFDT = (SELECT
      /*+ cardinality(F 33000) */
	 MAX(F.EFFDT)
      from WB_JOB F
      where F.EMPLID = B.EMPLID
        and F.EMPL_RCD# = B.EMPL_RCD#
        and F.EFFDT&lt; = A.PAY_END_DT)
/
</pre>
<p>but whether I shift the cardinality up or down via the hint, the discrepancy in the plan becomes works (both with higher and lower cardinality hint values)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Automatic DB_FILE_MULTIBLOCK_READ_COUNT by joel garry</title>
		<link>http://structureddata.org/2008/08/14/automatic-db_file_multiblock_read_count/#comment-2713</link>
		<dc:creator>joel garry</dc:creator>
		<pubDate>Thu, 28 Aug 2008 21:20:04 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=76#comment-2713</guid>
		<description>With respect to OLTP db's running ERP or MRP type apps, I can say I've observed:

They aren't completely OLTP, there's some amount of batching.

Some FTS (and Index FFS) happen due to purposeful trade-offs on whether an index is there.  Some issues also happen by accident or functional creep.

So, your test is a little bit applicable to OLTP too, and thank you for it, and thanks to Oracle for making the best of odd situations by default (absent bugs, of course).</description>
		<content:encoded><![CDATA[<p>With respect to OLTP db&#8217;s running ERP or MRP type apps, I can say I&#8217;ve observed:</p>
<p>They aren&#8217;t completely OLTP, there&#8217;s some amount of batching.</p>
<p>Some FTS (and Index FFS) happen due to purposeful trade-offs on whether an index is there.  Some issues also happen by accident or functional creep.</p>
<p>So, your test is a little bit applicable to OLTP too, and thank you for it, and thanks to Oracle for making the best of odd situations by default (absent bugs, of course).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on ANSI Outer Joins And Lateral Views by simon</title>
		<link>http://structureddata.org/2008/02/18/ansi-outer-joins-and-lateral-views/#comment-2707</link>
		<dc:creator>simon</dc:creator>
		<pubDate>Thu, 28 Aug 2008 12:34:46 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/2008/02/18/ansi-outer-joins-and-lateral-views/#comment-2707</guid>
		<description>Hi Dale
Yes of course I agree it is sometimes necessary to put the filtering in the ON clause of a LEFT OUTER join. My point was that it is never necessary to put the filtering in the ON clause of a REGULAR join. Therefore, if you avoid doing so you avoid any confusion over the differing semantics of filtering in the ON clause of regular and left-outer joins</description>
		<content:encoded><![CDATA[<p>Hi Dale<br />
Yes of course I agree it is sometimes necessary to put the filtering in the ON clause of a LEFT OUTER join. My point was that it is never necessary to put the filtering in the ON clause of a REGULAR join. Therefore, if you avoid doing so you avoid any confusion over the differing semantics of filtering in the ON clause of regular and left-outer joins</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Automatic DB_FILE_MULTIBLOCK_READ_COUNT by Greg Rahn</title>
		<link>http://structureddata.org/2008/08/14/automatic-db_file_multiblock_read_count/#comment-2539</link>
		<dc:creator>Greg Rahn</dc:creator>
		<pubDate>Fri, 22 Aug 2008 13:52:39 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=76#comment-2539</guid>
		<description>@Donald K. Burleson

&gt;&gt; It would be interesting to observe the impact of the back-end RAID (or ASM stripe size) on this test.

What would be interesting about it?  
What metrics would you want to observe?
What would you expect to happen?

I don't think it is any secret that when reading a significant amount of data (e.g FTS) that larger I/Os are more efficient.  MBRC exists for this exact reason.  Unfortunately there are many layers that I/Os can be fragmented before the I/O actually gets to the physical disk.  Sometimes they are reassembled at the storage level, but not always.  This doesn't present a problem in itself per se, but it does lower the efficiency of each physical disk.  Some storage also uses read-ahead/prefetch algorithms to accelerate such scans.

&gt;&gt; let’s not forget that this only applies to full-scan reads

I don't think anyone is forgetting.  I clearly stated this experiment was run with 100% physical I/O and a FTS.  I would hope that neither of these would be present in an OLTP database.  This is most applicable to a DSS workload (partition scans) where large reads are common.</description>
		<content:encoded><![CDATA[<p>@Donald K. Burleson</p>
<p>>> It would be interesting to observe the impact of the back-end RAID (or ASM stripe size) on this test.</p>
<p>What would be interesting about it?<br />
What metrics would you want to observe?<br />
What would you expect to happen?</p>
<p>I don&#8217;t think it is any secret that when reading a significant amount of data (e.g FTS) that larger I/Os are more efficient.  MBRC exists for this exact reason.  Unfortunately there are many layers that I/Os can be fragmented before the I/O actually gets to the physical disk.  Sometimes they are reassembled at the storage level, but not always.  This doesn&#8217;t present a problem in itself per se, but it does lower the efficiency of each physical disk.  Some storage also uses read-ahead/prefetch algorithms to accelerate such scans.</p>
<p>>> let’s not forget that this only applies to full-scan reads</p>
<p>I don&#8217;t think anyone is forgetting.  I clearly stated this experiment was run with 100% physical I/O and a FTS.  I would hope that neither of these would be present in an OLTP database.  This is most applicable to a DSS workload (partition scans) where large reads are common.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Automatic DB_FILE_MULTIBLOCK_READ_COUNT by Donald K. Burleson</title>
		<link>http://structureddata.org/2008/08/14/automatic-db_file_multiblock_read_count/#comment-2538</link>
		<dc:creator>Donald K. Burleson</dc:creator>
		<pubDate>Fri, 22 Aug 2008 12:58:12 +0000</pubDate>
		<guid isPermaLink="false">http://structureddata.org/?p=76#comment-2538</guid>
		<description>Hi Greg,

&#62;&#62; the Oracle database can decide the optimal MBRC no matter what the blocksize, demonstrating there is no advantage to a larger (or even smaller) blocksize in this case.

It would be interesting to observe the impact of the back-end RAID (or ASM stripe size) on this test.

Also, let's not forget that this only applies to full-scan reads, and MBRC will not help many OLTP systems.</description>
		<content:encoded><![CDATA[<p>Hi Greg,</p>
<p>&gt;&gt; the Oracle database can decide the optimal MBRC no matter what the blocksize, demonstrating there is no advantage to a larger (or even smaller) blocksize in this case.</p>
<p>It would be interesting to observe the impact of the back-end RAID (or ASM stripe size) on this test.</p>
<p>Also, let&#8217;s not forget that this only applies to full-scan reads, and MBRC will not help many OLTP systems.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.235 seconds -->
