<?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/"
		>
<channel>
	<title>Comments on: Index Access best approach?? Not Always&#8230;</title>
	<atom:link href="http://askdba.org/weblog/2008/12/index-access-best-approach-not-always/feed/" rel="self" type="application/rss+xml" />
	<link>http://askdba.org/weblog/2008/12/index-access-best-approach-not-always/</link>
	<description>Writing About Our Experiences With Oracle Databases</description>
	<lastBuildDate>Thu, 09 Feb 2012 14:27:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Amit</title>
		<link>http://askdba.org/weblog/2008/12/index-access-best-approach-not-always/#comment-3562</link>
		<dc:creator>Amit</dc:creator>
		<pubDate>Fri, 26 Jun 2009 04:50:23 +0000</pubDate>
		<guid isPermaLink="false">http://askdba.org/weblog/?p=298#comment-3562</guid>
		<description>Daniel,

I do not remember these values as I worked on this site long back..But I believe I had checked and statistics were not stale. Note that in my case index SCOTT_BILL_FK7 was being used which did not have any date column. I actually suspected this issue to be caused by null values and use of nvl function.

And also there was &quot;No out of range&quot; messages in the 10053 as observed in my Post &lt;a href=&quot;http://askdba.org/weblog/wp-trackback.php?p=496&quot;  rel=&quot;nofollow&quot;&gt;DBMS_STATS.COPY_TABLE_STATS does not copy low/high values&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Daniel,</p>
<p>I do not remember these values as I worked on this site long back..But I believe I had checked and statistics were not stale. Note that in my case index SCOTT_BILL_FK7 was being used which did not have any date column. I actually suspected this issue to be caused by null values and use of nvl function.</p>
<p>And also there was &#8220;No out of range&#8221; messages in the 10053 as observed in my Post <a href="http://askdba.org/weblog/wp-trackback.php?p=496"  rel="nofollow">DBMS_STATS.COPY_TABLE_STATS does not copy low/high values</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel, Wu</title>
		<link>http://askdba.org/weblog/2008/12/index-access-best-approach-not-always/#comment-3560</link>
		<dc:creator>Daniel, Wu</dc:creator>
		<pubDate>Fri, 26 Jun 2009 03:24:08 +0000</pubDate>
		<guid isPermaLink="false">http://askdba.org/weblog/?p=298#comment-3560</guid>
		<description>What&#039;s the high value and the low value in the stats for these columns? Is any value in the where clause out of range?</description>
		<content:encoded><![CDATA[<p>What&#8217;s the high value and the low value in the stats for these columns? Is any value in the where clause out of range?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amit</title>
		<link>http://askdba.org/weblog/2008/12/index-access-best-approach-not-always/#comment-1089</link>
		<dc:creator>Amit</dc:creator>
		<pubDate>Fri, 19 Dec 2008 06:34:19 +0000</pubDate>
		<guid isPermaLink="false">http://askdba.org/weblog/?p=298#comment-1089</guid>
		<description>Even I will have to re-read it. I was hoping Jonathan will stumble upon this article and give his opinion :)

cheers
Amit</description>
		<content:encoded><![CDATA[<p>Even I will have to re-read it. I was hoping Jonathan will stumble upon this article and give his opinion <img src='http://askdba.org/weblog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>cheers<br />
Amit</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary</title>
		<link>http://askdba.org/weblog/2008/12/index-access-best-approach-not-always/#comment-1087</link>
		<dc:creator>Gary</dc:creator>
		<pubDate>Thu, 18 Dec 2008 21:58:27 +0000</pubDate>
		<guid isPermaLink="false">http://askdba.org/weblog/?p=298#comment-1087</guid>
		<description>Yeah, I can see the table cardinality coming down to 1, because there&#039;s a bunch of of criteria.
The cardinality of the index range scan gets me though. Index selectivity and table cardinality turn out to 216.76. But, since only two of the leading columns on the index are being used, maybe it isn&#039;t using index selectivity. I&#039;ll have to re-read my jonathan Lewis over Xmas.</description>
		<content:encoded><![CDATA[<p>Yeah, I can see the table cardinality coming down to 1, because there&#8217;s a bunch of of criteria.<br />
The cardinality of the index range scan gets me though. Index selectivity and table cardinality turn out to 216.76. But, since only two of the leading columns on the index are being used, maybe it isn&#8217;t using index selectivity. I&#8217;ll have to re-read my jonathan Lewis over Xmas.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amit</title>
		<link>http://askdba.org/weblog/2008/12/index-access-best-approach-not-always/#comment-1078</link>
		<dc:creator>Amit</dc:creator>
		<pubDate>Thu, 18 Dec 2008 06:46:23 +0000</pubDate>
		<guid isPermaLink="false">http://askdba.org/weblog/?p=298#comment-1078</guid>
		<description>Gary, thanks for your update. After writing this article , I also came across article from Richard Foote. I have striked out the statement regarding B-Tree indexes and gave a new link.

I cannot share the query with you (have changed table name too). But I believe I can share some information from 10053 trace which I ran for problematic query.

&lt;pre&gt;
Table stats    Table: SCOTT_BILL   Alias: SYS_ALIAS_6
  TOTAL ::  CDN: 27451688  NBLKS:  661386  AVG_ROW_LEN:  158  
  
    INDEX NAME: SCOTT_BILL_FK7  COL#: 8 17 9 
    TOTAL ::  LVLS: 2   #LB: 101624  #DK: 21675  LB/K: 4  DB/K: 710  CLUF: 15399740
	
  TABLE: SCOTT_BILL
      RSC_CPU: 0   RSC_IO: 3
  &lt;B&gt;IX_SEL:  7.8961e-06  TB_SEL:  2.4117e-11&lt;/B&gt;
    Join:  resc: 66419  resp: 66419
  Access path: index (scan)
  
  Join order[9]:  SCOTT_PO[SCOTT_PO]#1  SCOTT_POIC[SYS_ALIAS_5]#0  SCOTT_BILL[SYS_ALIAS_6]#2  SCOTT_CUST[SCOTT_CUST]#4  SCOTT_DSST[C]#3
Best so far: TABLE#: 1  CST:         98  CDN:      21716  BYTES:     260592
Best so far: TABLE#: 0  CST:      65246  CDN:        391  BYTES:      27761
Best so far: TABLE#: 2  CST:      66419  CDN:          1  BYTES:        126
Best so far: TABLE#: 4  CST:      66421  CDN:          1  BYTES:        141
Best so far: TABLE#: 3  CST:      66433  CDN:          1  BYTES:        161
&lt;/pre&gt;

CBO has estimated cardinality to be 1 row, though I am not sure the way it has been calculated. I believe this is calculated as  round(Table_selectivity *num_rows) for SCOTT_BILL table.This comes out to 1.</description>
		<content:encoded><![CDATA[<p>Gary, thanks for your update. After writing this article , I also came across article from Richard Foote. I have striked out the statement regarding B-Tree indexes and gave a new link.</p>
<p>I cannot share the query with you (have changed table name too). But I believe I can share some information from 10053 trace which I ran for problematic query.</p>
<pre>
Table stats    Table: SCOTT_BILL   Alias: SYS_ALIAS_6
  TOTAL ::  CDN: 27451688  NBLKS:  661386  AVG_ROW_LEN:  158  

    INDEX NAME: SCOTT_BILL_FK7  COL#: 8 17 9
    TOTAL ::  LVLS: 2   #LB: 101624  #DK: 21675  LB/K: 4  DB/K: 710  CLUF: 15399740

  TABLE: SCOTT_BILL
      RSC_CPU: 0   RSC_IO: 3
  <b>IX_SEL:  7.8961e-06  TB_SEL:  2.4117e-11</b>
    Join:  resc: 66419  resp: 66419
  Access path: index (scan)

  Join order[9]:  SCOTT_PO[SCOTT_PO]#1  SCOTT_POIC[SYS_ALIAS_5]#0  SCOTT_BILL[SYS_ALIAS_6]#2  SCOTT_CUST[SCOTT_CUST]#4  SCOTT_DSST[C]#3
Best so far: TABLE#: 1  CST:         98  CDN:      21716  BYTES:     260592
Best so far: TABLE#: 0  CST:      65246  CDN:        391  BYTES:      27761
Best so far: TABLE#: 2  CST:      66419  CDN:          1  BYTES:        126
Best so far: TABLE#: 4  CST:      66421  CDN:          1  BYTES:        141
Best so far: TABLE#: 3  CST:      66433  CDN:          1  BYTES:        161
</pre>
<p>CBO has estimated cardinality to be 1 row, though I am not sure the way it has been calculated. I believe this is calculated as  round(Table_selectivity *num_rows) for SCOTT_BILL table.This comes out to 1.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary</title>
		<link>http://askdba.org/weblog/2008/12/index-access-best-approach-not-always/#comment-1067</link>
		<dc:creator>Gary</dc:creator>
		<pubDate>Wed, 17 Dec 2008 22:06:46 +0000</pubDate>
		<guid isPermaLink="false">http://askdba.org/weblog/?p=298#comment-1067</guid>
		<description>&quot;As B-Tree index does not index Null columns&quot;
Steady on. The index is on &quot;BILL_PO_NO, BILL_PO_SEQ_NO and BILL_RQMT_NO&quot;, so there will be an index entry even when BILL_RQMT_NO is null (except maybe for the 636 with null BILL_PO_NO). Which you can see because the filter condition on the index access 11 on the problem query plan shows the NVL being applied.
Now the table has at least 27 million rows, with 32,000 distinct values for BILL_PO_NO so each BILL_PO_NO has about 850 entries, spread across 4 BILL_PO_SEQ_NO, so may give 200 entries each (though I bet there&#039;s a lot of skew towards sequence no 1).  
The NVL clause will go for, I think, a 1% default selectivity so will assume 2 rows returned. [Not sure how it gets that down to 1, unless there&#039;s a lot more than 27 million rows in the table. ] In practice, we can see that with such a high proportion of nulls, we&#039;d get pretty much a 100% selectivity, not 1%.

It would be nice to see the original query for this, and the query plan with the hint.</description>
		<content:encoded><![CDATA[<p>&#8220;As B-Tree index does not index Null columns&#8221;<br />
Steady on. The index is on &#8220;BILL_PO_NO, BILL_PO_SEQ_NO and BILL_RQMT_NO&#8221;, so there will be an index entry even when BILL_RQMT_NO is null (except maybe for the 636 with null BILL_PO_NO). Which you can see because the filter condition on the index access 11 on the problem query plan shows the NVL being applied.<br />
Now the table has at least 27 million rows, with 32,000 distinct values for BILL_PO_NO so each BILL_PO_NO has about 850 entries, spread across 4 BILL_PO_SEQ_NO, so may give 200 entries each (though I bet there&#8217;s a lot of skew towards sequence no 1).<br />
The NVL clause will go for, I think, a 1% default selectivity so will assume 2 rows returned. [Not sure how it gets that down to 1, unless there's a lot more than 27 million rows in the table. ] In practice, we can see that with such a high proportion of nulls, we&#8217;d get pretty much a 100% selectivity, not 1%.</p>
<p>It would be nice to see the original query for this, and the query plan with the hint.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Served from: askdba.org @ 2012-02-12 16:29:17 by W3 Total Cache -->
