<?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: Cardinality</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2009/11/29/cardinality/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2009/11/29/cardinality/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Fri, 24 May 2013 13:27:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Aatif</title>
		<link>http://jonathanlewis.wordpress.com/2009/11/29/cardinality/#comment-44870</link>
		<dc:creator><![CDATA[Aatif]]></dc:creator>
		<pubDate>Thu, 02 Feb 2012 06:20:38 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2537#comment-44870</guid>
		<description><![CDATA[The cardinality of an index is the number of unique values in the indexed field.For example, if you were a car manufacturer and you had a database containing one row for every car that rolls off the assembly line, the primary key might be the VIN, and a secondary key might be the color.   If you make cars that are red, blue, or green, then the cardinality of the color index would be three.  If you are Henry Ford building model Ts, then the cardinality would be one, since any customer can have a car painted any colour that he wants so long as it is black.]]></description>
		<content:encoded><![CDATA[<p>The cardinality of an index is the number of unique values in the indexed field.For example, if you were a car manufacturer and you had a database containing one row for every car that rolls off the assembly line, the primary key might be the VIN, and a secondary key might be the color.   If you make cars that are red, blue, or green, then the cardinality of the color index would be three.  If you are Henry Ford building model Ts, then the cardinality would be one, since any customer can have a car painted any colour that he wants so long as it is black.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/11/29/cardinality/#comment-34999</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 16 Dec 2009 10:33:30 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2537#comment-34999</guid>
		<description><![CDATA[Timur,

I was wondering whether the 100 was an upper bound for range predicates that were out of range - but it seems not.

Thanks for the offer - I finally got around to installing OEL and 11.2 on my daughter&#039;s old laptop last night.]]></description>
		<content:encoded><![CDATA[<p>Timur,</p>
<p>I was wondering whether the 100 was an upper bound for range predicates that were out of range &#8211; but it seems not.</p>
<p>Thanks for the offer &#8211; I finally got around to installing OEL and 11.2 on my daughter&#8217;s old laptop last night.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/11/29/cardinality/#comment-34996</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 16 Dec 2009 10:07:53 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2537#comment-34996</guid>
		<description><![CDATA[Coskan,

Thanks for that - I&#039;m running on 10.2.0.3 at the moment. 
I wonder if the change is hidden somewhere in the code relating to frequency histograms that appeared in that upgrade.]]></description>
		<content:encoded><![CDATA[<p>Coskan,</p>
<p>Thanks for that &#8211; I&#8217;m running on 10.2.0.3 at the moment.<br />
I wonder if the change is hidden somewhere in the code relating to frequency histograms that appeared in that upgrade.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Timur Akhmadeev</title>
		<link>http://jonathanlewis.wordpress.com/2009/11/29/cardinality/#comment-34981</link>
		<dc:creator><![CDATA[Timur Akhmadeev]]></dc:creator>
		<pubDate>Mon, 14 Dec 2009 14:27:09 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2537#comment-34981</guid>
		<description><![CDATA[&gt;Do you get 100 for a range of (say) 21 – 22, then 21 – 23, then 21 – 24
Yes. If low bound is out of range, then cardinality equals to 100.

&gt;I still haven’t got around to installing 11.2 so can’t investigate at present.
If you need a VMware image of OEL5u4 with 11.2.0.1 EE, I can upload it (I think it&#039;s about 8GB in compressed form).]]></description>
		<content:encoded><![CDATA[<p>&gt;Do you get 100 for a range of (say) 21 – 22, then 21 – 23, then 21 – 24<br />
Yes. If low bound is out of range, then cardinality equals to 100.</p>
<p>&gt;I still haven’t got around to installing 11.2 so can’t investigate at present.<br />
If you need a VMware image of OEL5u4 with 11.2.0.1 EE, I can upload it (I think it&#8217;s about 8GB in compressed form).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: coskan</title>
		<link>http://jonathanlewis.wordpress.com/2009/11/29/cardinality/#comment-34975</link>
		<dc:creator><![CDATA[coskan]]></dc:creator>
		<pubDate>Sun, 13 Dec 2009 19:38:12 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2537#comment-34975</guid>
		<description><![CDATA[behaviour is same on 10.2.0.4 as well. Jonathan which version are your results coming from ?



s14                                     82
s15                                     73
s14-17                                 100
s14-16                                 100
s14-18                                 100
s14-21                                 100
s14-27                                 100
s21-22                                 100
s21-23                                 100
s21-24                                 100]]></description>
		<content:encoded><![CDATA[<p>behaviour is same on 10.2.0.4 as well. Jonathan which version are your results coming from ?</p>
<p>s14                                     82<br />
s15                                     73<br />
s14-17                                 100<br />
s14-16                                 100<br />
s14-18                                 100<br />
s14-21                                 100<br />
s14-27                                 100<br />
s21-22                                 100<br />
s21-23                                 100<br />
s21-24                                 100</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/11/29/cardinality/#comment-34971</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Sat, 12 Dec 2009 11:33:35 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2537#comment-34971</guid>
		<description><![CDATA[Timur,

Thanks for that tip.  I still haven&#039;t got around to installing 11.2 so can&#039;t investigate at present.

It&#039;s possible that it&#039;s deliberate - for example the out-of-range queries may be limited to the maximum single value in range.

Do you get 100 for a range of (say) 21 - 22, then 21 - 23, then 21 - 24, or do you get an increasing set of values ?  Can you pick another set of ranges and see a set of results that increase until they hit 100 ?]]></description>
		<content:encoded><![CDATA[<p>Timur,</p>
<p>Thanks for that tip.  I still haven&#8217;t got around to installing 11.2 so can&#8217;t investigate at present.</p>
<p>It&#8217;s possible that it&#8217;s deliberate &#8211; for example the out-of-range queries may be limited to the maximum single value in range.</p>
<p>Do you get 100 for a range of (say) 21 &#8211; 22, then 21 &#8211; 23, then 21 &#8211; 24, or do you get an increasing set of values ?  Can you pick another set of ranges and see a set of results that increase until they hit 100 ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/11/29/cardinality/#comment-34968</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Sat, 12 Dec 2009 11:18:35 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2537#comment-34968</guid>
		<description><![CDATA[John,

There are a couple of minor variations on the theme - but the basic answer is that that&#039;s the selectivity in this case for &lt;em&gt;&quot;column = (non-popular) constant&quot;&lt;/em&gt;.]]></description>
		<content:encoded><![CDATA[<p>John,</p>
<p>There are a couple of minor variations on the theme &#8211; but the basic answer is that that&#8217;s the selectivity in this case for <em>&#8220;column = (non-popular) constant&#8221;</em>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://jonathanlewis.wordpress.com/2009/11/29/cardinality/#comment-34948</link>
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Fri, 04 Dec 2009 18:50:41 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2537#comment-34948</guid>
		<description><![CDATA[Jonathan,

Do you know why the optimizer uses 100 as the point to count back from?  Does this change given the size of the table?

Thanks,

John]]></description>
		<content:encoded><![CDATA[<p>Jonathan,</p>
<p>Do you know why the optimizer uses 100 as the point to count back from?  Does this change given the size of the table?</p>
<p>Thanks,</p>
<p>John</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Narendra</title>
		<link>http://jonathanlewis.wordpress.com/2009/11/29/cardinality/#comment-34930</link>
		<dc:creator><![CDATA[Narendra]]></dc:creator>
		<pubDate>Mon, 30 Nov 2009 13:42:16 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2537#comment-34930</guid>
		<description><![CDATA[Jonathan,

Thanks. I know you did not write specification or code. The only reason for asking the WHY question was I have seen you demonstrate how CBO works (or might be working) in many other cases.]]></description>
		<content:encoded><![CDATA[<p>Jonathan,</p>
<p>Thanks. I know you did not write specification or code. The only reason for asking the WHY question was I have seen you demonstrate how CBO works (or might be working) in many other cases.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Timur Akhmadeev</title>
		<link>http://jonathanlewis.wordpress.com/2009/11/29/cardinality/#comment-34929</link>
		<dc:creator><![CDATA[Timur Akhmadeev]]></dc:creator>
		<pubDate>Mon, 30 Nov 2009 10:44:35 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2537#comment-34929</guid>
		<description><![CDATA[BTW, it seems like things has changed in 11gR2:
&lt;pre&gt;
explain plan set statement_id=&#039;s14&#039; for
select count(*) from audience where month_no = 14;

explain plan set statement_id=&#039;s15&#039; for
select count(*) from audience where month_no = 15;

explain plan set statement_id=&#039;s14-17&#039; for
select count(*) from audience where month_no between 14 and 17;

explain plan set statement_id=&#039;s14-16&#039; for
select count(*) from audience where month_no between 14 and 16;

explain plan set statement_id=&#039;s14-18&#039; for
select count(*) from audience where month_no between 14 and 18;

explain plan set statement_id=&#039;s14-21&#039; for
select count(*) from audience where month_no between 14 and 21;

explain plan set statement_id=&#039;s14-27&#039; for
select count(*) from audience where month_no between 14 and 27;

select statement_id, cardinality
  from plan_table
 where statement_id like &#039;s1%&#039; and id = 2;
&lt;/pre&gt;
&lt;pre&gt;
STATEMENT_ID                   CARDINALITY
------------------------------ -----------
s14                                     82
s15                                     73
s14-17                                 100
s14-16                                 100
s14-18                                 100
s14-21                                 100
s14-27                                 100
&lt;/pre&gt;
or this is a bug, since 10053 reports &quot;Using prorated density: 0.068182&quot; which should result in cardinality of 82, but reports cardinality just like for a MONTH_NO=CONST predicate.]]></description>
		<content:encoded><![CDATA[<p>BTW, it seems like things has changed in 11gR2:</p>
<pre>
explain plan set statement_id='s14' for
select count(*) from audience where month_no = 14;

explain plan set statement_id='s15' for
select count(*) from audience where month_no = 15;

explain plan set statement_id='s14-17' for
select count(*) from audience where month_no between 14 and 17;

explain plan set statement_id='s14-16' for
select count(*) from audience where month_no between 14 and 16;

explain plan set statement_id='s14-18' for
select count(*) from audience where month_no between 14 and 18;

explain plan set statement_id='s14-21' for
select count(*) from audience where month_no between 14 and 21;

explain plan set statement_id='s14-27' for
select count(*) from audience where month_no between 14 and 27;

select statement_id, cardinality
  from plan_table
 where statement_id like 's1%' and id = 2;
</pre>
<pre>
STATEMENT_ID                   CARDINALITY
------------------------------ -----------
s14                                     82
s15                                     73
s14-17                                 100
s14-16                                 100
s14-18                                 100
s14-21                                 100
s14-27                                 100
</pre>
<p>or this is a bug, since 10053 reports &#8220;Using prorated density: 0.068182&#8243; which should result in cardinality of 82, but reports cardinality just like for a MONTH_NO=CONST predicate.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
