<?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: Data Cluster</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Sat, 18 May 2013 11:04:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: DBMS_REDEFINITION, clustering and how an outline helps to make it completely ONLINE &#171; Toine van Beckhoven&#8217;s Oracle blog</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-34501</link>
		<dc:creator><![CDATA[DBMS_REDEFINITION, clustering and how an outline helps to make it completely ONLINE &#171; Toine van Beckhoven&#8217;s Oracle blog]]></dc:creator>
		<pubDate>Thu, 24 Sep 2009 10:22:59 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-34501</guid>
		<description><![CDATA[[...] in Oracle and why it is beneficial from a performance perspective (for example Jonathan Lewis: http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/). It touches things like the clustering factor for Indexes and the db_file_sequential_read [...]]]></description>
		<content:encoded><![CDATA[<p>[...] in Oracle and why it is beneficial from a performance perspective (for example Jonathan Lewis: <a href="http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/" rel="nofollow">http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/</a>). It touches things like the clustering factor for Indexes and the db_file_sequential_read [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-10570</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Fri, 01 Jun 2007 10:47:11 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-10570</guid>
		<description><![CDATA[Robh,  Assume you have 1,000,000 rows indexed using a sequence number.  Now set the value to null in every row with a value less than 999,000 except for the multiples of 1000.

You now have an index with lots of empty space. It’s probably about 2,000 blocks long, every other block is completely empty but still in the structure, every other block has one entry in it.  (This is an approximation, I haven’t created the data to check accuracy but the image is about right).

If you run the query:


&lt;code&gt;select * from table where id_col is not null and some_flag = ‘X’&lt;/code&gt;


Oracle will (probably) use the index, and has to start at the left hand edge of the index (where the first available entry has id_col = 1000) and use the forward pointers to move from block to block in the index.

This is a fairly common coding method for queue driven tasks. If the task can’t process that small number of rows (those old multiples of 1,000) you see a lot of wasted work happening before the tasks gets to the usable data.

If your code allows you to ignore the “bad” table rows before you go to look at them, you reduce the waste. If you coalesce the index (possibly on a regular basis) you reduce the waste even more.

Important point: An index block does not go on to the free list until it is completely empty. Then, when it is on the free list, it is still linked into the index structure in its original position until it finally gets re-used.  In my example I might have 1,000 empty blocks on the free lists, but I&#039;m not going to take any of them out of the structure until I insert more rows into the table and need more space at the top, or right hand edge, of the index.  The &lt;strong&gt;coalesce&lt;/strong&gt; command cleans things up, and removes empty blocks from the structure.
]]></description>
		<content:encoded><![CDATA[<p>Robh,  Assume you have 1,000,000 rows indexed using a sequence number.  Now set the value to null in every row with a value less than 999,000 except for the multiples of 1000.</p>
<p>You now have an index with lots of empty space. It’s probably about 2,000 blocks long, every other block is completely empty but still in the structure, every other block has one entry in it.  (This is an approximation, I haven’t created the data to check accuracy but the image is about right).</p>
<p>If you run the query:</p>
<p><code>select * from table where id_col is not null and some_flag = ‘X’</code></p>
<p>Oracle will (probably) use the index, and has to start at the left hand edge of the index (where the first available entry has id_col = 1000) and use the forward pointers to move from block to block in the index.</p>
<p>This is a fairly common coding method for queue driven tasks. If the task can’t process that small number of rows (those old multiples of 1,000) you see a lot of wasted work happening before the tasks gets to the usable data.</p>
<p>If your code allows you to ignore the “bad” table rows before you go to look at them, you reduce the waste. If you coalesce the index (possibly on a regular basis) you reduce the waste even more.</p>
<p>Important point: An index block does not go on to the free list until it is completely empty. Then, when it is on the free list, it is still linked into the index structure in its original position until it finally gets re-used.  In my example I might have 1,000 empty blocks on the free lists, but I&#8217;m not going to take any of them out of the structure until I insert more rows into the table and need more space at the top, or right hand edge, of the index.  The <strong>coalesce</strong> command cleans things up, and removes empty blocks from the structure.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RobH</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-10074</link>
		<dc:creator><![CDATA[RobH]]></dc:creator>
		<pubDate>Tue, 29 May 2007 15:44:40 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-10074</guid>
		<description><![CDATA[Wow, simply perfect.  I&#039;ve run into this problem as stated in the post and have been looking into it for a while.  Jonathan, your post #14 is very good, but I still don&#039;t understand, why would you have to walk through the empty side of the index, wouldn&#039;t index just &quot;move right&quot; immediately when searching?

Sorry, I don&#039;t understand why the index would even bother walking the blocks where the table rows don&#039;t exist (the &lt;i&gt; As an added penalty . .  .&lt;/i&gt;).]]></description>
		<content:encoded><![CDATA[<p>Wow, simply perfect.  I&#8217;ve run into this problem as stated in the post and have been looking into it for a while.  Jonathan, your post #14 is very good, but I still don&#8217;t understand, why would you have to walk through the empty side of the index, wouldn&#8217;t index just &#8220;move right&#8221; immediately when searching?</p>
<p>Sorry, I don&#8217;t understand why the index would even bother walking the blocks where the table rows don&#8217;t exist (the <i> As an added penalty . .  .</i>).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-9933</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Mon, 28 May 2007 11:17:20 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-9933</guid>
		<description><![CDATA[Amir, I&#039;ve finally had time to review your comment and copy in the stats you sent me.
A lot of this may depend on the fact that you&#039;re talking about workflow. There is a lot of empty space in this index before rebuilding - but where is it, and how is it used ?

Workflow tends to add rows to the right hand end of a &quot;queueing&quot; index, and delete (most) rows from the left hand end. Such indexes are perfect candidates for something I call the &lt;em&gt;&lt;strong&gt;FIFO&lt;/strong&gt;&lt;/em&gt; problem (and Tom Kyte refers to as &lt;em&gt;&#039;sweepers&#039;&lt;/em&gt;).

The index may be nearly empty over a great long section of the left hand side, and well packed at the right-hand end. So your 50% space used may really be half the index with 0%, and half the index with 100% packing.

If you have to walk a long way through the empty part of the index before getting any useful table data, you are wasting resources in the index.  As an added penalty, if you have to walk through a lot of the index and then go to table rows that you can&#039;t process (which is probably why they&#039;re still there in an &#039;old&#039; part of the index) then you&#039;re wasting even more resources.

This looks like an example of an index where you need to do a detailed analysis (there are a couple of scripts on my website that may help: &lt;a href=&quot;http://www.jlcomp.demon.co.uk/index_efficiency.html&quot; rel=&quot;nofollow&quot;&gt;Index Efficiency&lt;/a&gt;,  and &lt;a href=&quot;http://www.jlcomp.demon.co.uk/index_efficiency_2.html&quot; rel=&quot;nofollow&quot;&gt;Index Efficiency pt. 2&lt;/a&gt;). It is possible, of course, that if you just think about the way the data is used and the impact this has on the index then you won&#039;t even need to investigate the index.

Once you understand the usage, you can decide if you need to do a rebuilds from time to time, or whether you can simply get by with a regular &lt;b&gt;coalesce&lt;/b&gt;.
]]></description>
		<content:encoded><![CDATA[<p>Amir, I&#8217;ve finally had time to review your comment and copy in the stats you sent me.<br />
A lot of this may depend on the fact that you&#8217;re talking about workflow. There is a lot of empty space in this index before rebuilding &#8211; but where is it, and how is it used ?</p>
<p>Workflow tends to add rows to the right hand end of a &#8220;queueing&#8221; index, and delete (most) rows from the left hand end. Such indexes are perfect candidates for something I call the <em><strong>FIFO</strong></em> problem (and Tom Kyte refers to as <em>&#8216;sweepers&#8217;</em>).</p>
<p>The index may be nearly empty over a great long section of the left hand side, and well packed at the right-hand end. So your 50% space used may really be half the index with 0%, and half the index with 100% packing.</p>
<p>If you have to walk a long way through the empty part of the index before getting any useful table data, you are wasting resources in the index.  As an added penalty, if you have to walk through a lot of the index and then go to table rows that you can&#8217;t process (which is probably why they&#8217;re still there in an &#8216;old&#8217; part of the index) then you&#8217;re wasting even more resources.</p>
<p>This looks like an example of an index where you need to do a detailed analysis (there are a couple of scripts on my website that may help: <a href="http://www.jlcomp.demon.co.uk/index_efficiency.html" rel="nofollow">Index Efficiency</a>,  and <a href="http://www.jlcomp.demon.co.uk/index_efficiency_2.html" rel="nofollow">Index Efficiency pt. 2</a>). It is possible, of course, that if you just think about the way the data is used and the impact this has on the index then you won&#8217;t even need to investigate the index.</p>
<p>Once you understand the usage, you can decide if you need to do a rebuilds from time to time, or whether you can simply get by with a regular <b>coalesce</b>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeroen Wilms</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-9541</link>
		<dc:creator><![CDATA[Jeroen Wilms]]></dc:creator>
		<pubDate>Thu, 24 May 2007 13:04:43 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-9541</guid>
		<description><![CDATA[Hi Jonathan,

Swathe is indeed the correct spelling based on the etymological lineage given in the 2nd edition of ODE which ties this word back to the Old High German word schwabe which is what you did in the mid-sixteenth century Germany when you had to clear a field of grass or wheat as there weren&#039;t a lot of database indices to clear in those days...

Cheers,
Jeroen]]></description>
		<content:encoded><![CDATA[<p>Hi Jonathan,</p>
<p>Swathe is indeed the correct spelling based on the etymological lineage given in the 2nd edition of ODE which ties this word back to the Old High German word schwabe which is what you did in the mid-sixteenth century Germany when you had to clear a field of grass or wheat as there weren&#8217;t a lot of database indices to clear in those days&#8230;</p>
<p>Cheers,<br />
Jeroen</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amir Hameed</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-9432</link>
		<dc:creator><![CDATA[Amir Hameed]]></dc:creator>
		<pubDate>Wed, 23 May 2007 17:15:38 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-9432</guid>
		<description><![CDATA[Jonathan,
- I just re-read chapter 5 of your book which makes perfect sense but the difference is that in our case, the optimizer is using the index in spite of reporting a high CF on it.
- We are using multiple freelists and there are 16 defined for this index. This is a high-concurrency workflow table.
- optimizer_index_cost_adj and optimizer_index_caching parameters are set to 100 and 0 respectively. This is Oracle&#039;s recommended setting for EBS and if I try to change it, Ahmed Alomari will personally come knocking at my door!
- This is a primary key index and therefore the number of rowids should be the same as the number of entries in the index.
I am not a big advicate of rebuilding indexes because of the same reasons that you have explained on page 71 of your book unless something has drastically changed that requires index rebuild, like massive deletes because the table retention policy has changed from , say 10 million to 1 million rows, etc. But in this case, it seems that this may be the only option available to optimize the statement because the query is using the index, it is just that it is reading too many index blocks. I am currently running &quot;validate structure&quot; on the index to see the space related statistics. I will also try to hack the CF to a lower value but I suspect that it will not help.
&lt;em&gt;&lt;strong&gt;(Statistics sent by email, and added by JPL).&lt;/strong&gt;&lt;/em&gt;
&lt;code&gt;
Pre-rebuild:
============
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DELETED
&#160;IDX&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;LEAF&#160;ROWS&#160;&#160;&#160;&#160;DELETED&#160;&#160;&#160;LEAF&#160;ROWS&#160;&#160;&#160;&#160;&#160;DIST
HEIGHT&#160;&#160;LEAF&#160;ROWS&#160;&#160;&#160;LENGTH(k)&#160;&#160;&#160;LEAF&#160;ROWS&#160;&#160;LENGTH(k)&#160;&#160;&#160;&#160;&#160;KEYS
------&#160;-----------&#160;-----------&#160;-----------&#160;----------&#160;-----------
&#160;&#160;&#160;&#160;&#160;4&#160;&#160;90,590,414&#160;&#160;&#160;3,019,115&#160;&#160;13,015,804&#160;&#160;&#160;&#160;368,400&#160;&#160;90,590,414

&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;OPTIMAL&#160;&#160;COMPR
&#160;&#160;&#160;&#160;BTREE&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;USED&#160;&#160;&#160;&#160;&#160;&#160;%SPACE&#160;&#160;COMPR&#160;&#160;&#160;SPACE
&#160;&#160;&#160;SPACE(k)&#160;&#160;&#160;&#160;&#160;&#160;&#160;SPACE(k)&#160;&#160;&#160;&#160;&#160;USED&#160;&#160;&#160;COUNT&#160;&#160;&#160;SAVE
--------------&#160;--------------&#160;------&#160;-------&#160;-------
&#160;&#160;&#160;&#160;&#160;5,990,670&#160;&#160;&#160;&#160;&#160;&#160;3,038,769&#160;&#160;&#160;&#160;&#160;51&#160;&#160;&#160;&#160;&#160;&#160;&#160;2&#160;&#160;&#160;&#160;&#160;&#160;&#160;0


Post-rebuild:
=============
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DELETED
&#160;IDX&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;LEAF&#160;ROWS&#160;&#160;&#160;&#160;DELETED&#160;&#160;&#160;LEAF&#160;ROWS&#160;&#160;&#160;&#160;&#160;DIST
HEIGHT&#160;&#160;LEAF&#160;ROWS&#160;&#160;&#160;LENGTH(k)&#160;&#160;&#160;LEAF&#160;ROWS&#160;&#160;LENGTH(k)&#160;&#160;&#160;&#160;&#160;KEYS
------&#160;-----------&#160;-----------&#160;-----------&#160;----------&#160;-----------
&#160;&#160;&#160;&#160;&#160;4&#160;&#160;77,574,670&#160;&#160;&#160;2,650,717&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;0&#160;&#160;77,574,670

&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;OPTIMAL&#160;&#160;COMPR
&#160;&#160;&#160;&#160;BTREE&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;USED&#160;&#160;&#160;&#160;&#160;&#160;%SPACE&#160;&#160;COMPR&#160;&#160;&#160;SPACE
&#160;&#160;&#160;SPACE(k)&#160;&#160;&#160;&#160;&#160;&#160;&#160;SPACE(k)&#160;&#160;&#160;&#160;&#160;USED&#160;&#160;&#160;COUNT&#160;&#160;&#160;SAVE
--------------&#160;--------------&#160;------&#160;-------&#160;-------
&#160;&#160;&#160;&#160;&#160;2,979,069&#160;&#160;&#160;&#160;&#160;&#160;2,662,420&#160;&#160;&#160;&#160;&#160;90&#160;&#160;&#160;&#160;&#160;&#160;&#160;2&#160;&#160;&#160;&#160;&#160;&#160;&#160;0
&lt;/code&gt;
]]></description>
		<content:encoded><![CDATA[<p>Jonathan,<br />
- I just re-read chapter 5 of your book which makes perfect sense but the difference is that in our case, the optimizer is using the index in spite of reporting a high CF on it.<br />
- We are using multiple freelists and there are 16 defined for this index. This is a high-concurrency workflow table.<br />
- optimizer_index_cost_adj and optimizer_index_caching parameters are set to 100 and 0 respectively. This is Oracle&#8217;s recommended setting for EBS and if I try to change it, Ahmed Alomari will personally come knocking at my door!<br />
- This is a primary key index and therefore the number of rowids should be the same as the number of entries in the index.<br />
I am not a big advicate of rebuilding indexes because of the same reasons that you have explained on page 71 of your book unless something has drastically changed that requires index rebuild, like massive deletes because the table retention policy has changed from , say 10 million to 1 million rows, etc. But in this case, it seems that this may be the only option available to optimize the statement because the query is using the index, it is just that it is reading too many index blocks. I am currently running &#8220;validate structure&#8221; on the index to see the space related statistics. I will also try to hack the CF to a lower value but I suspect that it will not help.<br />
<em><strong>(Statistics sent by email, and added by JPL).</strong></em><br />
<code><br />
Pre-rebuild:<br />
============<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DELETED<br />
&nbsp;IDX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LEAF&nbsp;ROWS&nbsp;&nbsp;&nbsp;&nbsp;DELETED&nbsp;&nbsp;&nbsp;LEAF&nbsp;ROWS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DIST<br />
HEIGHT&nbsp;&nbsp;LEAF&nbsp;ROWS&nbsp;&nbsp;&nbsp;LENGTH(k)&nbsp;&nbsp;&nbsp;LEAF&nbsp;ROWS&nbsp;&nbsp;LENGTH(k)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;KEYS<br />
------&nbsp;-----------&nbsp;-----------&nbsp;-----------&nbsp;----------&nbsp;-----------<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;90,590,414&nbsp;&nbsp;&nbsp;3,019,115&nbsp;&nbsp;13,015,804&nbsp;&nbsp;&nbsp;&nbsp;368,400&nbsp;&nbsp;90,590,414</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OPTIMAL&nbsp;&nbsp;COMPR<br />
&nbsp;&nbsp;&nbsp;&nbsp;BTREE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;USED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%SPACE&nbsp;&nbsp;COMPR&nbsp;&nbsp;&nbsp;SPACE<br />
&nbsp;&nbsp;&nbsp;SPACE(k)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SPACE(k)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;USED&nbsp;&nbsp;&nbsp;COUNT&nbsp;&nbsp;&nbsp;SAVE<br />
--------------&nbsp;--------------&nbsp;------&nbsp;-------&nbsp;-------<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5,990,670&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3,038,769&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;51&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0</p>
<p>Post-rebuild:<br />
=============<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DELETED<br />
&nbsp;IDX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LEAF&nbsp;ROWS&nbsp;&nbsp;&nbsp;&nbsp;DELETED&nbsp;&nbsp;&nbsp;LEAF&nbsp;ROWS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DIST<br />
HEIGHT&nbsp;&nbsp;LEAF&nbsp;ROWS&nbsp;&nbsp;&nbsp;LENGTH(k)&nbsp;&nbsp;&nbsp;LEAF&nbsp;ROWS&nbsp;&nbsp;LENGTH(k)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;KEYS<br />
------&nbsp;-----------&nbsp;-----------&nbsp;-----------&nbsp;----------&nbsp;-----------<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;77,574,670&nbsp;&nbsp;&nbsp;2,650,717&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;77,574,670</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OPTIMAL&nbsp;&nbsp;COMPR<br />
&nbsp;&nbsp;&nbsp;&nbsp;BTREE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;USED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%SPACE&nbsp;&nbsp;COMPR&nbsp;&nbsp;&nbsp;SPACE<br />
&nbsp;&nbsp;&nbsp;SPACE(k)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SPACE(k)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;USED&nbsp;&nbsp;&nbsp;COUNT&nbsp;&nbsp;&nbsp;SAVE<br />
--------------&nbsp;--------------&nbsp;------&nbsp;-------&nbsp;-------<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2,979,069&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2,662,420&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;90&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-9426</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 23 May 2007 15:26:41 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-9426</guid>
		<description><![CDATA[Jeroen, following your comment I did a quick dictionary check in case I had picked one of those English/American anomalies - and discovered that the more common spelling of the word appears be &quot;swath&quot; - which does have a very different meaning from the other meaning of &quot;swathe&quot;.

For those without immediate dictionary access, my original image was of a (traditional) farmer sweeping across a field with a scythe.
]]></description>
		<content:encoded><![CDATA[<p>Jeroen, following your comment I did a quick dictionary check in case I had picked one of those English/American anomalies &#8211; and discovered that the more common spelling of the word appears be &#8220;swath&#8221; &#8211; which does have a very different meaning from the other meaning of &#8220;swathe&#8221;.</p>
<p>For those without immediate dictionary access, my original image was of a (traditional) farmer sweeping across a field with a scythe.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeroen Wilms</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-9388</link>
		<dc:creator><![CDATA[Jeroen Wilms]]></dc:creator>
		<pubDate>Wed, 23 May 2007 08:15:51 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-9388</guid>
		<description><![CDATA[Interesting usage of the word &#039;swathe&#039;. I haven&#039;t seen it used in IT literature before, but it does seem to fit the bill nicely in the given context.]]></description>
		<content:encoded><![CDATA[<p>Interesting usage of the word &#8216;swathe&#8217;. I haven&#8217;t seen it used in IT literature before, but it does seem to fit the bill nicely in the given context.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-9349</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Tue, 22 May 2007 20:54:33 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-9349</guid>
		<description><![CDATA[Amir, the result is counter-intuitive, although can be explained after a little thought.

The first thing to remember, though, is that the &lt;b&gt;clustering_factor&lt;/b&gt; is Oracle&#039;s count of the number of table block jumps you take as you walk the index in order [See Chapter 5 of &lt;a href=&quot;http://www.jlcomp.demon.co.uk/cbo_book/ind_book.html&quot; rel=&quot;nofollow&quot;&gt;the book&lt;/a&gt; for a complete description]. But if you have (for example) multiple &lt;b&gt;freelists&lt;/b&gt;, or have used &lt;b&gt;ASSM (automatic segment space management)&lt;/b&gt; in the tablespace, then the number of jumps could be very large compared to the number of blocks visited, as you could keep revisiting the same blocks.

The second thing to consider is that the number of rowids you use from the index can be much less than the number of index row entries that you examine - and I suspect that this has happened here.

I would guess that the activity is similar to the following. Imagine an &lt;em&gt;&#039;order lines&#039;&lt;/em&gt; table with an index &lt;b&gt;(status, product_id, order_date)&lt;/b&gt;. Imagine a query &lt;i&gt;&#039;select ... where status = &#039;A&#039; and order_date = trunc(sysdate)&#039;&lt;/i&gt;.

All the rows for today will be packed into just a few blocks in the table, but if you use this index to drive the query, you could have thousands of index entries to scan in the index for (say) ProductX where ths status is &#039;A&#039; to find the few rows for today.  Do the same for ProductY and so on, and you find that you scan a HUGE swathe of the index, reading hundred of blocks, but just load and re-read a few dozen table blocks.

This type of accident can happen quite easily if you set the &lt;b&gt;optimizer_index_cost_adj&lt;/b&gt; to a low value (anything less than about 20 starts to look a little dangerous) and the &lt;b&gt;optimizer_index_caching&lt;/b&gt; to a high number (anything above about 80 starts to look a little dangerous).

I see that your input has been mess up by the way that white space is eliminated.  Check the notes about this on the opening page of the blog. If you want to do a global edit on the tkprof file to change all spaces to the &quot;nbsp&quot; tag and re-post just that piece as a new comment, I&#039;ll paste it back into the original post.
]]></description>
		<content:encoded><![CDATA[<p>Amir, the result is counter-intuitive, although can be explained after a little thought.</p>
<p>The first thing to remember, though, is that the <b>clustering_factor</b> is Oracle&#8217;s count of the number of table block jumps you take as you walk the index in order [See Chapter 5 of <a href="http://www.jlcomp.demon.co.uk/cbo_book/ind_book.html" rel="nofollow">the book</a> for a complete description]. But if you have (for example) multiple <b>freelists</b>, or have used <b>ASSM (automatic segment space management)</b> in the tablespace, then the number of jumps could be very large compared to the number of blocks visited, as you could keep revisiting the same blocks.</p>
<p>The second thing to consider is that the number of rowids you use from the index can be much less than the number of index row entries that you examine &#8211; and I suspect that this has happened here.</p>
<p>I would guess that the activity is similar to the following. Imagine an <em>&#8216;order lines&#8217;</em> table with an index <b>(status, product_id, order_date)</b>. Imagine a query <i>&#8216;select &#8230; where status = &#8216;A&#8217; and order_date = trunc(sysdate)&#8217;</i>.</p>
<p>All the rows for today will be packed into just a few blocks in the table, but if you use this index to drive the query, you could have thousands of index entries to scan in the index for (say) ProductX where ths status is &#8216;A&#8217; to find the few rows for today.  Do the same for ProductY and so on, and you find that you scan a HUGE swathe of the index, reading hundred of blocks, but just load and re-read a few dozen table blocks.</p>
<p>This type of accident can happen quite easily if you set the <b>optimizer_index_cost_adj</b> to a low value (anything less than about 20 starts to look a little dangerous) and the <b>optimizer_index_caching</b> to a high number (anything above about 80 starts to look a little dangerous).</p>
<p>I see that your input has been mess up by the way that white space is eliminated.  Check the notes about this on the opening page of the blog. If you want to do a global edit on the tkprof file to change all spaces to the &#8220;nbsp&#8221; tag and re-post just that piece as a new comment, I&#8217;ll paste it back into the original post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amir Hameed</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-9258</link>
		<dc:creator><![CDATA[Amir Hameed]]></dc:creator>
		<pubDate>Tue, 22 May 2007 01:37:42 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/17/data-cluster/#comment-9258</guid>
		<description><![CDATA[Hi Jonathan,
I did some analysis of the raw trace file to find out how many blocks, out of the total blocks visited by the statement, belonged to the table and how many blonged to the index (the index and table reside in their own tablespaces). Following is the statement, its explain plan and the wait statistics (I have taken out the actual values in the predicate section):
SELECT TO_NUMBER(ITEM_KEY) ITEM_KEY, ACTIVITY_STATUS
FROM WF_ITEM_ACTIVITY_STATUSES
WHERE ITEM_TYPE =  AND
       PROCESS_ACTIVITY =  AND
       ITEM_KEY IS NOT NULL
&lt;code&gt;
call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.01       0.01          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch     2006    110.94     655.55     232869     239492          0       30073
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total     2008    110.95     655.56     232869     239492          0       30073
Rows     Row Source Operation
-------  ---------------------------------------------------
  30073  TABLE ACCESS BY INDEX ROWID WF_ITEM_ACTIVITY_STATUSES 
  30073   INDEX RANGE SCAN WF_ITEM_ACTIVITY_STATUSES_PK (object id 33898)

Rows&#160;&#160;&#160;&#160;&#160;Execution&#160;Plan
-------&#160;&#160;---------------------------------------------------
&#160;&#160;&#160;&#160;&#160;&#160;0&#160;&#160;SELECT&#160;STATEMENT&#160;&#160;&#160;GOAL:&#160;CHOOSE
&#160;&#160;30073&#160;&#160;&#160;TABLE&#160;ACCESS&#160;&#160;&#160;GOAL:&#160;ANALYZED&#160;(BY&#160;INDEX&#160;ROWID)&#160;OF&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#039;WF_ITEM_ACTIVITY_STATUSES&#039;
&#160;&#160;30073&#160;&#160;&#160;&#160;INDEX&#160;&#160;&#160;GOAL:&#160;ANALYZED&#160;(RANGE&#160;SCAN)&#160;OF&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#039;WF_ITEM_ACTIVITY_STATUSES_PK&#039;&#160;(UNIQUE)

Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                    2006        0.00          0.00
  db file sequential read                    232869        0.34        599.23
  latch free                                      8        0.02          0.09
  SQL*Net message from client                  2006        0.03          6.37
********************************************************************************
&lt;/code&gt;
As it can be seen that there were 232,869 single block reads done during the course of the query. Per the raw trace file, 227861 of those reads were done against the index where as 5008 were against the table which adds up to 232,869. This translate to a ratio of almost 45:1 of index blocks read to the table blocks read. I was expecting larger number of table blocks read than the index blocks due to the high CF?
]]></description>
		<content:encoded><![CDATA[<p>Hi Jonathan,<br />
I did some analysis of the raw trace file to find out how many blocks, out of the total blocks visited by the statement, belonged to the table and how many blonged to the index (the index and table reside in their own tablespaces). Following is the statement, its explain plan and the wait statistics (I have taken out the actual values in the predicate section):<br />
SELECT TO_NUMBER(ITEM_KEY) ITEM_KEY, ACTIVITY_STATUS<br />
FROM WF_ITEM_ACTIVITY_STATUSES<br />
WHERE ITEM_TYPE =  AND<br />
       PROCESS_ACTIVITY =  AND<br />
       ITEM_KEY IS NOT NULL<br />
<code><br />
call     count       cpu    elapsed       disk      query    current        rows<br />
------- ------  -------- ---------- ---------- ---------- ----------  ----------<br />
Parse        1      0.01       0.01          0          0          0           0<br />
Execute      1      0.00       0.00          0          0          0           0<br />
Fetch     2006    110.94     655.55     232869     239492          0       30073<br />
------- ------  -------- ---------- ---------- ---------- ----------  ----------<br />
total     2008    110.95     655.56     232869     239492          0       30073<br />
Rows     Row Source Operation<br />
-------  ---------------------------------------------------<br />
  30073  TABLE ACCESS BY INDEX ROWID WF_ITEM_ACTIVITY_STATUSES <br />
  30073   INDEX RANGE SCAN WF_ITEM_ACTIVITY_STATUSES_PK (object id 33898)</p>
<p>Rows&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Execution&nbsp;Plan<br />
-------&nbsp;&nbsp;---------------------------------------------------<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;SELECT&nbsp;STATEMENT&nbsp;&nbsp;&nbsp;GOAL:&nbsp;CHOOSE<br />
&nbsp;&nbsp;30073&nbsp;&nbsp;&nbsp;TABLE&nbsp;ACCESS&nbsp;&nbsp;&nbsp;GOAL:&nbsp;ANALYZED&nbsp;(BY&nbsp;INDEX&nbsp;ROWID)&nbsp;OF&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'WF_ITEM_ACTIVITY_STATUSES'<br />
&nbsp;&nbsp;30073&nbsp;&nbsp;&nbsp;&nbsp;INDEX&nbsp;&nbsp;&nbsp;GOAL:&nbsp;ANALYZED&nbsp;(RANGE&nbsp;SCAN)&nbsp;OF&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'WF_ITEM_ACTIVITY_STATUSES_PK'&nbsp;(UNIQUE)</p>
<p>Elapsed times include waiting on following events:<br />
  Event waited on                             Times   Max. Wait  Total Waited<br />
  ----------------------------------------   Waited  ----------  ------------<br />
  SQL*Net message to client                    2006        0.00          0.00<br />
  db file sequential read                    232869        0.34        599.23<br />
  latch free                                      8        0.02          0.09<br />
  SQL*Net message from client                  2006        0.03          6.37<br />
********************************************************************************<br />
</code><br />
As it can be seen that there were 232,869 single block reads done during the course of the query. Per the raw trace file, 227861 of those reads were done against the index where as 5008 were against the table which adds up to 232,869. This translate to a ratio of almost 45:1 of index blocks read to the table blocks read. I was expecting larger number of table blocks read than the index blocks due to the high CF?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
