<?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: Histogram change</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2009/04/23/histogram-change/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2009/04/23/histogram-change/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Mon, 20 May 2013 17:10:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/23/histogram-change/#comment-39054</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 05 Jan 2011 10:16:53 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1032#comment-39054</guid>
		<description><![CDATA[Bernard,

Thanks for the contribution. Unfortunately it got messed up by a rogue &quot;less than&quot;.
If you can email me the entire source as a text-file attachment I&#039;ll copy it into your comment.

The variation between your prediction and Oracle&#039;s prediction is due to scaling by Oracle to cater for the difference between &quot;total rows in table&quot; and &quot;total rows covered by histogram&quot;.]]></description>
		<content:encoded><![CDATA[<p>Bernard,</p>
<p>Thanks for the contribution. Unfortunately it got messed up by a rogue &#8220;less than&#8221;.<br />
If you can email me the entire source as a text-file attachment I&#8217;ll copy it into your comment.</p>
<p>The variation between your prediction and Oracle&#8217;s prediction is due to scaling by Oracle to cater for the difference between &#8220;total rows in table&#8221; and &#8220;total rows covered by histogram&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bernard Polarski</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/23/histogram-change/#comment-39039</link>
		<dc:creator><![CDATA[Bernard Polarski]]></dc:creator>
		<pubDate>Tue, 04 Jan 2011 13:44:21 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1032#comment-39039</guid>
		<description><![CDATA[I derived a small routine to automate the creation of frequency histogram limited to the 254 more skewed columns. Within the boundaries of the histogram, all value were the one given either by the histogram or by the density. Outside, it was 1.

Oracle version 10.2.0.5 on HP-UX.

&lt;pre&gt;
SQL: alter session set &quot;_fix_control&quot;=&#039;5483301:off&#039; ;
Session altered.


declare

    srec                      dbms_stats.statrec;
    a_bucket                  dbms_stats.numarray;
    v_tot_rows_not_in_freq    number;
    v_tot                     number;
    v_density                 number;
    v_distinct_key_not_in_freq   number;
    v_cutoff                  number :=150     -- set here your variable
begin
     -- create the histogram, maximum 254 buckets but may be lower following v_cutoff_value
     select cpt, USERIDENTITY_ID bulk collect into srec.bkvals, a_bucket from (
     select
          cpt, USERIDENTITY_ID
     from ( select count(*) cpt, USERIDENTITY_ID
                              from IBS6_EB_OWNER.USERMESSAGE
                                   group by USERIDENTITY_ID order by count(*) desc
          )
     where rownum  150  order by USERIDENTITY_ID
    );

    -- Calculate now the density for all values which are not in the histo.
    -- the density is calculated from all rows not in the frequency histogram
    -- so density =   (tot rows not in freq / distinct key not in freq)/tot row in table)
    -- the cut off value to be taken into the histogram is set by default to 150, adapt following needs
    
    -- total rows not in frequency:

    with v as (select useridentity_id
            from ( select useridentity_id
                             from MYTABLE_OWNER.CUSTOMER
                                 group by USERIDENTITY_ID having count(*) &gt; v_cutoff  order by count(*) desc)
             where rownum  &#039;MYTABLE_OWNER&#039;,
        tabname     =&gt; &#039;CUSTOMER&#039;,
        colname     =&gt; &#039;CUST_ID&#039;,
        density     =&gt; v_density,
         srec        =&gt; srec );
end;
/

Rows in table                  : 459699
distint Keys in histogram      : 74
Tot Rows keys covered by histo : 454026
Distinct Keys not in histogram : 250
Rows not in histogram          : 5673
Density for keys not in histo  : 0.0000493627

&lt;/pre&gt;

Produces this histogram:

&lt;pre&gt;
TABLE_NAME   COLUMN_NAME        Bck nbr ENDPOINT_VALUE Frequency
------------ --------------- ---------- -------------- ----------
USERMESSAGE  USERIDENTITY_ID        303             11        303
                                   1990             12       1687
                                   2443             19        453
                                   5165             21       2722
                                   5417             24        252
                                   5945             27        528
                                   6105             33        160
                                   6381             85        276
                                  23950            148      17569   &lt;-- See SQL1
                                  24371            149        421   &lt;-- see SQL2
                                                                    &lt;-- see SQL3 value 169 not in histogram
                                  27792            180       3421
                                 107833            201      80041
                                 108440            216        607
                                 109053            221        613
                                 110623            223       1570
                                 110833            422        210
                                 111030            429        197
                                 111222            440        192
                                 151751            441      40529
.
.
(74 rows)

SQL_ID  g3b5j7qfy7u5d, child number 0
-------------------------------------
SELECT /*+ gather_plan_statistics */ COUNT(*) FROM usermessage um, useridentity ui  ,
usermessagetype umt WHERE um.isconsumed = 0 AND ui.useridentity_id = um.useridentity_id  AND
umt.usermessagetype_id = um.usermessagetype_id AND ui.useridentity_id = 148

Plan hash value: 3616009165

-----------------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation                     &#124; Name            &#124; Starts &#124; E-Rows &#124; A-Rows &#124;   A-Time   &#124; Buffers &#124;
-----------------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT              &#124;                 &#124;      1 &#124;        &#124;      1 &#124;00:00:00.07 &#124;    2362 &#124;
&#124;   1 &#124;  SORT AGGREGATE               &#124;                 &#124;      1 &#124;      1 &#124;      1 &#124;00:00:00.07 &#124;    2362 &#124;
&#124;   2 &#124;   NESTED LOOPS                &#124;                 &#124;      1 &#124;   7505 &#124;   8559 &#124;00:00:00.06 &#124;    2362 &#124;
&#124;*  3 &#124;    INDEX UNIQUE SCAN          &#124; USERIDENTITY_PK &#124;      1 &#124;      1 &#124;      1 &#124;00:00:00.01 &#124;       2 &#124;
&#124;*  4 &#124;    TABLE ACCESS BY INDEX ROWID&#124; USERMESSAGE     &#124;      1 &#124;   7505 &#124;   8559 &#124;00:00:00.06 &#124;    2360 &#124;
&#124;*  5 &#124;     INDEX RANGE SCAN          &#124; USERMESSAGE_IDX &#124;      1 &#124;  17792 &#124;  17569 &#124;00:00:00.01 &#124;      46 &#124;
-----------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   3 - access(&quot;UI&quot;.&quot;USERIDENTITY_ID&quot;=148)
   4 - filter(&quot;UM&quot;.&quot;ISCONSUMED&quot;=0)
   5 - access(&quot;UM&quot;.&quot;USERIDENTITY_ID&quot;=148)

&lt;/pre&gt;

Expected cardinality is very close. I wonder why it modified the 17569 to 17792

&lt;pre&gt;

  COUNT(*)
----------
        33


SQL_ID  81dtb814kvvy9, child number 0
-------------------------------------
SELECT /*+ gather_plan_statistics */ COUNT(*) FROM usermessage um, useridentity ui  ,
usermessagetype umt WHERE um.isconsumed = 0 AND ui.useridentity_id = um.useridentity_id  AND
umt.usermessagetype_id = um.usermessagetype_id AND ui.useridentity_id = 149

Plan hash value: 3616009165

-----------------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation                     &#124; Name            &#124; Starts &#124; E-Rows &#124; A-Rows &#124;   A-Time   &#124; Buffers &#124;
-----------------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT              &#124;                 &#124;      1 &#124;        &#124;      1 &#124;00:00:00.01 &#124;     231 &#124;
&#124;   1 &#124;  SORT AGGREGATE               &#124;                 &#124;      1 &#124;      1 &#124;      1 &#124;00:00:00.01 &#124;     231 &#124;
&#124;   2 &#124;   NESTED LOOPS                &#124;                 &#124;      1 &#124;    180 &#124;     33 &#124;00:00:00.01 &#124;     231 &#124;
&#124;*  3 &#124;    INDEX UNIQUE SCAN          &#124; USERIDENTITY_PK &#124;      1 &#124;      1 &#124;      1 &#124;00:00:00.01 &#124;       2 &#124;
&#124;*  4 &#124;    TABLE ACCESS BY INDEX ROWID&#124; USERMESSAGE     &#124;      1 &#124;    180 &#124;     33 &#124;00:00:00.01 &#124;     229 &#124;
&#124;*  5 &#124;     INDEX RANGE SCAN          &#124; USERMESSAGE_IDX &#124;      1 &#124;    426 &#124;    421 &#124;00:00:00.01 &#124;       5 &#124;
-----------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   3 - access(&quot;UI&quot;.&quot;USERIDENTITY_ID&quot;=149)
   4 - filter(&quot;UM&quot;.&quot;ISCONSUMED&quot;=0)
   5 - access(&quot;UM&quot;.&quot;USERIDENTITY_ID&quot;=149)


&lt;/pre&gt;
Not bad
&lt;pre&gt;

  COUNT(*)
----------
         9

SQL_ID  0z8t787a3t8an, child number 0
-------------------------------------
SELECT /*+ gather_plan_statistics */ COUNT(*) FROM usermessage um, useridentity ui  ,
usermessagetype umt WHERE um.isconsumed = 0 AND ui.useridentity_id = um.useridentity_id  AND
umt.usermessagetype_id = um.usermessagetype_id AND ui.useridentity_id = 169

Plan hash value: 3616009165

-----------------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation                     &#124; Name            &#124; Starts &#124; E-Rows &#124; A-Rows &#124;   A-Time   &#124; Buffers &#124;
-----------------------------------------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT              &#124;                 &#124;      1 &#124;        &#124;      1 &#124;00:00:00.01 &#124;      11 &#124;
&#124;   1 &#124;  SORT AGGREGATE               &#124;                 &#124;      1 &#124;      1 &#124;      1 &#124;00:00:00.01 &#124;      11 &#124;
&#124;   2 &#124;   NESTED LOOPS                &#124;                 &#124;      1 &#124;     10 &#124;      9 &#124;00:00:00.01 &#124;      11 &#124;
&#124;*  3 &#124;    INDEX UNIQUE SCAN          &#124; USERIDENTITY_PK &#124;      1 &#124;      1 &#124;      1 &#124;00:00:00.01 &#124;       2 &#124;
&#124;*  4 &#124;    TABLE ACCESS BY INDEX ROWID&#124; USERMESSAGE     &#124;      1 &#124;     10 &#124;      9 &#124;00:00:00.01 &#124;       9 &#124;
&#124;*  5 &#124;     INDEX RANGE SCAN          &#124; USERMESSAGE_IDX &#124;      1 &#124;     23 &#124;      9 &#124;00:00:00.01 &#124;       3 &#124;
-----------------------------------------------------------------------------------------------------------

&lt;/pre&gt;

23 rows this is the default density : 5673/250 = 22.692 round up to 23.]]></description>
		<content:encoded><![CDATA[<p>I derived a small routine to automate the creation of frequency histogram limited to the 254 more skewed columns. Within the boundaries of the histogram, all value were the one given either by the histogram or by the density. Outside, it was 1.</p>
<p>Oracle version 10.2.0.5 on HP-UX.</p>
<pre>
SQL: alter session set "_fix_control"='5483301:off' ;
Session altered.


declare

    srec                      dbms_stats.statrec;
    a_bucket                  dbms_stats.numarray;
    v_tot_rows_not_in_freq    number;
    v_tot                     number;
    v_density                 number;
    v_distinct_key_not_in_freq   number;
    v_cutoff                  number :=150     -- set here your variable
begin
     -- create the histogram, maximum 254 buckets but may be lower following v_cutoff_value
     select cpt, USERIDENTITY_ID bulk collect into srec.bkvals, a_bucket from (
     select
          cpt, USERIDENTITY_ID
     from ( select count(*) cpt, USERIDENTITY_ID
                              from IBS6_EB_OWNER.USERMESSAGE
                                   group by USERIDENTITY_ID order by count(*) desc
          )
     where rownum  150  order by USERIDENTITY_ID
    );

    -- Calculate now the density for all values which are not in the histo.
    -- the density is calculated from all rows not in the frequency histogram
    -- so density =   (tot rows not in freq / distinct key not in freq)/tot row in table)
    -- the cut off value to be taken into the histogram is set by default to 150, adapt following needs
    
    -- total rows not in frequency:

    with v as (select useridentity_id
            from ( select useridentity_id
                             from MYTABLE_OWNER.CUSTOMER
                                 group by USERIDENTITY_ID having count(*) &gt; v_cutoff  order by count(*) desc)
             where rownum  'MYTABLE_OWNER',
        tabname     =&gt; 'CUSTOMER',
        colname     =&gt; 'CUST_ID',
        density     =&gt; v_density,
         srec        =&gt; srec );
end;
/

Rows in table                  : 459699
distint Keys in histogram      : 74
Tot Rows keys covered by histo : 454026
Distinct Keys not in histogram : 250
Rows not in histogram          : 5673
Density for keys not in histo  : 0.0000493627

</pre>
<p>Produces this histogram:</p>
<pre>
TABLE_NAME   COLUMN_NAME        Bck nbr ENDPOINT_VALUE Frequency
------------ --------------- ---------- -------------- ----------
USERMESSAGE  USERIDENTITY_ID        303             11        303
                                   1990             12       1687
                                   2443             19        453
                                   5165             21       2722
                                   5417             24        252
                                   5945             27        528
                                   6105             33        160
                                   6381             85        276
                                  23950            148      17569   &lt;-- See SQL1
                                  24371            149        421   &lt;-- see SQL2
                                                                    &lt;-- see SQL3 value 169 not in histogram
                                  27792            180       3421
                                 107833            201      80041
                                 108440            216        607
                                 109053            221        613
                                 110623            223       1570
                                 110833            422        210
                                 111030            429        197
                                 111222            440        192
                                 151751            441      40529
.
.
(74 rows)

SQL_ID  g3b5j7qfy7u5d, child number 0
-------------------------------------
SELECT /*+ gather_plan_statistics */ COUNT(*) FROM usermessage um, useridentity ui  ,
usermessagetype umt WHERE um.isconsumed = 0 AND ui.useridentity_id = um.useridentity_id  AND
umt.usermessagetype_id = um.usermessagetype_id AND ui.useridentity_id = 148

Plan hash value: 3616009165

-----------------------------------------------------------------------------------------------------------
| Id  | Operation                     | Name            | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
-----------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT              |                 |      1 |        |      1 |00:00:00.07 |    2362 |
|   1 |  SORT AGGREGATE               |                 |      1 |      1 |      1 |00:00:00.07 |    2362 |
|   2 |   NESTED LOOPS                |                 |      1 |   7505 |   8559 |00:00:00.06 |    2362 |
|*  3 |    INDEX UNIQUE SCAN          | USERIDENTITY_PK |      1 |      1 |      1 |00:00:00.01 |       2 |
|*  4 |    TABLE ACCESS BY INDEX ROWID| USERMESSAGE     |      1 |   7505 |   8559 |00:00:00.06 |    2360 |
|*  5 |     INDEX RANGE SCAN          | USERMESSAGE_IDX |      1 |  17792 |  17569 |00:00:00.01 |      46 |
-----------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   3 - access(&quot;UI&quot;.&quot;USERIDENTITY_ID&quot;=148)
   4 - filter(&quot;UM&quot;.&quot;ISCONSUMED&quot;=0)
   5 - access(&quot;UM&quot;.&quot;USERIDENTITY_ID&quot;=148)

</pre>
<p>Expected cardinality is very close. I wonder why it modified the 17569 to 17792</p>
<pre>

  COUNT(*)
----------
        33


SQL_ID  81dtb814kvvy9, child number 0
-------------------------------------
SELECT /*+ gather_plan_statistics */ COUNT(*) FROM usermessage um, useridentity ui  ,
usermessagetype umt WHERE um.isconsumed = 0 AND ui.useridentity_id = um.useridentity_id  AND
umt.usermessagetype_id = um.usermessagetype_id AND ui.useridentity_id = 149

Plan hash value: 3616009165

-----------------------------------------------------------------------------------------------------------
| Id  | Operation                     | Name            | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
-----------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT              |                 |      1 |        |      1 |00:00:00.01 |     231 |
|   1 |  SORT AGGREGATE               |                 |      1 |      1 |      1 |00:00:00.01 |     231 |
|   2 |   NESTED LOOPS                |                 |      1 |    180 |     33 |00:00:00.01 |     231 |
|*  3 |    INDEX UNIQUE SCAN          | USERIDENTITY_PK |      1 |      1 |      1 |00:00:00.01 |       2 |
|*  4 |    TABLE ACCESS BY INDEX ROWID| USERMESSAGE     |      1 |    180 |     33 |00:00:00.01 |     229 |
|*  5 |     INDEX RANGE SCAN          | USERMESSAGE_IDX |      1 |    426 |    421 |00:00:00.01 |       5 |
-----------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   3 - access("UI"."USERIDENTITY_ID"=149)
   4 - filter("UM"."ISCONSUMED"=0)
   5 - access("UM"."USERIDENTITY_ID"=149)


</pre>
<p>Not bad</p>
<pre>

  COUNT(*)
----------
         9

SQL_ID  0z8t787a3t8an, child number 0
-------------------------------------
SELECT /*+ gather_plan_statistics */ COUNT(*) FROM usermessage um, useridentity ui  ,
usermessagetype umt WHERE um.isconsumed = 0 AND ui.useridentity_id = um.useridentity_id  AND
umt.usermessagetype_id = um.usermessagetype_id AND ui.useridentity_id = 169

Plan hash value: 3616009165

-----------------------------------------------------------------------------------------------------------
| Id  | Operation                     | Name            | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
-----------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT              |                 |      1 |        |      1 |00:00:00.01 |      11 |
|   1 |  SORT AGGREGATE               |                 |      1 |      1 |      1 |00:00:00.01 |      11 |
|   2 |   NESTED LOOPS                |                 |      1 |     10 |      9 |00:00:00.01 |      11 |
|*  3 |    INDEX UNIQUE SCAN          | USERIDENTITY_PK |      1 |      1 |      1 |00:00:00.01 |       2 |
|*  4 |    TABLE ACCESS BY INDEX ROWID| USERMESSAGE     |      1 |     10 |      9 |00:00:00.01 |       9 |
|*  5 |     INDEX RANGE SCAN          | USERMESSAGE_IDX |      1 |     23 |      9 |00:00:00.01 |       3 |
-----------------------------------------------------------------------------------------------------------

</pre>
<p>23 rows this is the default density : 5673/250 = 22.692 round up to 23.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frequency Histograms &#8211; 6 &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/23/histogram-change/#comment-37573</link>
		<dc:creator><![CDATA[Frequency Histograms &#8211; 6 &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Wed, 20 Oct 2010 08:12:55 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1032#comment-37573</guid>
		<description><![CDATA[[...] 10.2.0.3 it has set the resulting cardinality to 1 (this would be 75 in 10.2.0.4 or 11g &#8211; half the lowest known value in the histogram). But in the second case (&#8216;priority low&#8217;) the optimizer has done its [...]]]></description>
		<content:encoded><![CDATA[<p>[...] 10.2.0.3 it has set the resulting cardinality to 1 (this would be 75 in 10.2.0.4 or 11g &#8211; half the lowest known value in the histogram). But in the second case (&#8216;priority low&#8217;) the optimizer has done its [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frequency Histogram 5 &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/23/histogram-change/#comment-37528</link>
		<dc:creator><![CDATA[Frequency Histogram 5 &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Wed, 13 Oct 2010 09:23:10 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1032#comment-37528</guid>
		<description><![CDATA[[...] Neither of the two strings in my predicate appear in the data or in the histogram &#8211; but the first string (after applying the histogram algorithm) is a match for an entry in the histogram so Oracle reports the histogram endpoint_number as the cardinality. The second string doesn&#8217;t appear even after applying the algorithm &#8211; so Oracle has supplied a cardinality of 50, which is half the cardinality of the least frequently occuring value that it can find in the histogram. (Note &#8211; if you are running 10.2.0.3 or earlier the cardinality for this case would be 1; the optimizer changed in 10.2.0.4). [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Neither of the two strings in my predicate appear in the data or in the histogram &#8211; but the first string (after applying the histogram algorithm) is a match for an entry in the histogram so Oracle reports the histogram endpoint_number as the cardinality. The second string doesn&#8217;t appear even after applying the algorithm &#8211; so Oracle has supplied a cardinality of 50, which is half the cardinality of the least frequently occuring value that it can find in the histogram. (Note &#8211; if you are running 10.2.0.3 or earlier the cardinality for this case would be 1; the optimizer changed in 10.2.0.4). [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frequency Histograms 2 &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/23/histogram-change/#comment-37354</link>
		<dc:creator><![CDATA[Frequency Histograms 2 &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Tue, 21 Sep 2010 12:18:57 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1032#comment-37354</guid>
		<description><![CDATA[[...] posting: Change in use of Frequency Histogram at [...]]]></description>
		<content:encoded><![CDATA[<p>[...] posting: Change in use of Frequency Histogram at [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alberto Dell&#8217;Era&#8217;s Oracle blog &#187; CBO: NewDensity for Frequency Histograms,11g-10.2.0.4 (densities part IV)</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/23/histogram-change/#comment-34708</link>
		<dc:creator><![CDATA[Alberto Dell&#8217;Era&#8217;s Oracle blog &#187; CBO: NewDensity for Frequency Histograms,11g-10.2.0.4 (densities part IV)]]></dc:creator>
		<pubDate>Fri, 23 Oct 2009 16:07:15 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1032#comment-34708</guid>
		<description><![CDATA[[...] that the most important change is the introduction of the “half the least popular&quot; rule (see the &quot;Histogram change&quot; post by Jonathan Lewis, which distills the findings of Randolf Geist and  Riyaj Shamsudeen) - a [...]]]></description>
		<content:encoded><![CDATA[<p>[...] that the most important change is the introduction of the “half the least popular&quot; rule (see the &quot;Histogram change&quot; post by Jonathan Lewis, which distills the findings of Randolf Geist and  Riyaj Shamsudeen) &#8211; a [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans-Peter Sloot</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/23/histogram-change/#comment-34212</link>
		<dc:creator><![CDATA[Hans-Peter Sloot]]></dc:creator>
		<pubDate>Mon, 24 Aug 2009 09:14:55 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1032#comment-34212</guid>
		<description><![CDATA[The 3rd line of the steps should read:
3. query the table with col ‘N’ and col := :b1 and col2 = &quot;some very selective value&quot;

I think that is essential.

Regards Hans-Peter]]></description>
		<content:encoded><![CDATA[<p>The 3rd line of the steps should read:<br />
3. query the table with col ‘N’ and col := :b1 and col2 = &#8220;some very selective value&#8221;</p>
<p>I think that is essential.</p>
<p>Regards Hans-Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans-Peter Sloot</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/23/histogram-change/#comment-34197</link>
		<dc:creator><![CDATA[Hans-Peter Sloot]]></dc:creator>
		<pubDate>Fri, 21 Aug 2009 13:09:22 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1032#comment-34197</guid>
		<description><![CDATA[Hi Jonathan,

I noticed that the dbms_stats is influenced someway by how columns are used in where clause predicates.
I did the following
1. create table
2. gather stats : distinct keys and density set to 1
3. query the table with col  &#039;N&#039; and col := :b1 and col2 = 
4. gather stats : distinct key set to 1 and density 1/*num_rows

I must have missed that in the documents and on the net somehow.


Regards Hans-Peter]]></description>
		<content:encoded><![CDATA[<p>Hi Jonathan,</p>
<p>I noticed that the dbms_stats is influenced someway by how columns are used in where clause predicates.<br />
I did the following<br />
1. create table<br />
2. gather stats : distinct keys and density set to 1<br />
3. query the table with col  &#8216;N&#8217; and col := :b1 and col2 =<br />
4. gather stats : distinct key set to 1 and density 1/*num_rows</p>
<p>I must have missed that in the documents and on the net somehow.</p>
<p>Regards Hans-Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frequency Histograms &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/23/histogram-change/#comment-33178</link>
		<dc:creator><![CDATA[Frequency Histograms &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Thu, 28 May 2009 19:36:26 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1032#comment-33178</guid>
		<description><![CDATA[[...] Jonathan Lewis @ 7:34 pm UTC May 28,2009   In a recent article on changes to the calculation of cardinality with frequency histograms I made a comment about writing programs to create fake but realistic and complete frequency [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Jonathan Lewis @ 7:34 pm UTC May 28,2009   In a recent article on changes to the calculation of cardinality with frequency histograms I made a comment about writing programs to create fake but realistic and complete frequency [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/04/23/histogram-change/#comment-32839</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Fri, 24 Apr 2009 15:19:51 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1032#comment-32839</guid>
		<description><![CDATA[Tubby,
Thanks for the note - corrections now in place. I did post an acknowledgement last night when I made the change, but it seems to have disappeared down /dev/null !

Randolf,
Thanks for the links - your post was initially marked as spam because it had too many links in it.  (By the way, Alberto sent me an email last night questioning whether he was the one that had mentioned this change to me.  I was fairly sure it was, but now I think it might have been you that first brought it to my attention.  Apologies for the mis-attribution if that&#039;s the case).


Hemant,
Thanks for the comment, your post also got marked as spam.

Timur,
Thanks for posting the example - a bit got lost because you missed one of the &quot;less thans&quot; when editing the text. I&#039;ve edited it with my best guess about the text that got dropped.

All - 
Is this the quoted bug ?  Yes and No. 
I don&#039;t think the &quot;bug&quot; was really a bug, just an optimizer assumption of reasonable behaviour that nobody questioned for several years. Personally I was quite amused when another bug number appeared about one week after the 10.2.0.4 patchset came out explaining how to reverse the effect - so both behaviours appear as bugs on Metalink.]]></description>
		<content:encoded><![CDATA[<p>Tubby,<br />
Thanks for the note &#8211; corrections now in place. I did post an acknowledgement last night when I made the change, but it seems to have disappeared down /dev/null !</p>
<p>Randolf,<br />
Thanks for the links &#8211; your post was initially marked as spam because it had too many links in it.  (By the way, Alberto sent me an email last night questioning whether he was the one that had mentioned this change to me.  I was fairly sure it was, but now I think it might have been you that first brought it to my attention.  Apologies for the mis-attribution if that&#8217;s the case).</p>
<p>Hemant,<br />
Thanks for the comment, your post also got marked as spam.</p>
<p>Timur,<br />
Thanks for posting the example &#8211; a bit got lost because you missed one of the &#8220;less thans&#8221; when editing the text. I&#8217;ve edited it with my best guess about the text that got dropped.</p>
<p>All &#8211;<br />
Is this the quoted bug ?  Yes and No.<br />
I don&#8217;t think the &#8220;bug&#8221; was really a bug, just an optimizer assumption of reasonable behaviour that nobody questioned for several years. Personally I was quite amused when another bug number appeared about one week after the 10.2.0.4 patchset came out explaining how to reverse the effect &#8211; so both behaviours appear as bugs on Metalink.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
