<?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: Hash Partitions</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2009/09/21/hash-partitions-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2009/09/21/hash-partitions-2/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Mon, 20 May 2013 01:44:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Index Explosion &#8211; 4 &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2009/09/21/hash-partitions-2/#comment-35277</link>
		<dc:creator><![CDATA[Index Explosion &#8211; 4 &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Fri, 22 Jan 2010 10:49:07 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2242#comment-35277</guid>
		<description><![CDATA[[...] This often looks like an easy winner. Create the index as a globally hash partitioned index, partitioned on the first column of the index. The number of partitions should take account of the degree of concurrency you have to deal with, and could easily be somewhere between 16 and 128 in extreme cases. (The number should always be a power of two because of the strategy that Oracle uses for hash partitioning). [...]]]></description>
		<content:encoded><![CDATA[<p>[...] This often looks like an easy winner. Create the index as a globally hash partitioned index, partitioned on the first column of the index. The number of partitions should take account of the degree of concurrency you have to deal with, and could easily be somewhere between 16 and 128 in extreme cases. (The number should always be a power of two because of the strategy that Oracle uses for hash partitioning). [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: svdixit</title>
		<link>http://jonathanlewis.wordpress.com/2009/09/21/hash-partitions-2/#comment-34883</link>
		<dc:creator><![CDATA[svdixit]]></dc:creator>
		<pubDate>Mon, 23 Nov 2009 05:24:01 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2242#comment-34883</guid>
		<description><![CDATA[Hi All,

sometime back I was back experimenting to understand hash partitioning algo. why should we use &quot;power of 2&quot; partitions.

please follow below link
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:981835183841#692992200346988718

Regards
Saurabh]]></description>
		<content:encoded><![CDATA[<p>Hi All,</p>
<p>sometime back I was back experimenting to understand hash partitioning algo. why should we use &#8220;power of 2&#8243; partitions.</p>
<p>please follow below link<br />
<a href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0" rel="nofollow">http://asktom.oracle.com/pls/asktom/f?p=100:11:0</a>::::P11_QUESTION_ID:981835183841#692992200346988718</p>
<p>Regards<br />
Saurabh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ora_hash function &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2009/09/21/hash-partitions-2/#comment-34874</link>
		<dc:creator><![CDATA[ora_hash function &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Sat, 21 Nov 2009 10:59:53 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2242#comment-34874</guid>
		<description><![CDATA[[...] Oracle&#8217;s strategy for hash partitioning is engineered to give an even data distribution when the number of partitions is a power of two. In one of the follow-up comments, Christo Kutrovsky pre-empted my planned follow-up by mentioning [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Oracle&#8217;s strategy for hash partitioning is engineered to give an even data distribution when the number of partitions is a power of two. In one of the follow-up comments, Christo Kutrovsky pre-empted my planned follow-up by mentioning [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pur</title>
		<link>http://jonathanlewis.wordpress.com/2009/09/21/hash-partitions-2/#comment-34851</link>
		<dc:creator><![CDATA[pur]]></dc:creator>
		<pubDate>Mon, 16 Nov 2009 05:52:37 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2242#comment-34851</guid>
		<description><![CDATA[hei all,i want to ask,so what true hash function work??
i am still confused

please explain more clearly
thanks]]></description>
		<content:encoded><![CDATA[<p>hei all,i want to ask,so what true hash function work??<br />
i am still confused</p>
<p>please explain more clearly<br />
thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Log Buffer #163: a Carnival of the Vanities for DBAs &#124; Pythian Group Blog</title>
		<link>http://jonathanlewis.wordpress.com/2009/09/21/hash-partitions-2/#comment-34516</link>
		<dc:creator><![CDATA[Log Buffer #163: a Carnival of the Vanities for DBAs &#124; Pythian Group Blog]]></dc:creator>
		<pubDate>Fri, 25 Sep 2009 17:05:18 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2242#comment-34516</guid>
		<description><![CDATA[[...] Tom&#8217;s Oak Table colleague, Jonathan Lewis, played no head games on us, but he has been at the hash partitions. He writes, &#8220;I made a throwaway comment in a recent posting about using powers of two for the [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Tom&#8217;s Oak Table colleague, Jonathan Lewis, played no head games on us, but he has been at the hash partitions. He writes, &#8220;I made a throwaway comment in a recent posting about using powers of two for the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://jonathanlewis.wordpress.com/2009/09/21/hash-partitions-2/#comment-34498</link>
		<dc:creator><![CDATA[Ben]]></dc:creator>
		<pubDate>Wed, 23 Sep 2009 17:28:03 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2242#comment-34498</guid>
		<description><![CDATA[Thanks very much for that.  The question of why only powers of two resulted in even distribution had been bugging me for a while.  Now I see the reason for the algorithm that seemed weird to me at first.]]></description>
		<content:encoded><![CDATA[<p>Thanks very much for that.  The question of why only powers of two resulted in even distribution had been bugging me for a while.  Now I see the reason for the algorithm that seemed weird to me at first.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Taral Desai</title>
		<link>http://jonathanlewis.wordpress.com/2009/09/21/hash-partitions-2/#comment-34495</link>
		<dc:creator><![CDATA[Taral Desai]]></dc:creator>
		<pubDate>Tue, 22 Sep 2009 22:49:56 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2242#comment-34495</guid>
		<description><![CDATA[Hi Jonathan,

There is always nice things you teach us everyday. I question regarding this would be lets say we have a table with hash partition 5. Which is inadequate as i learned today. But if we 

select * from t1 partition(SYS_P2161);

Will this going to touch some other partitions for getting data. If yes then how can we get this information that which partitions it&#039;s touching.]]></description>
		<content:encoded><![CDATA[<p>Hi Jonathan,</p>
<p>There is always nice things you teach us everyday. I question regarding this would be lets say we have a table with hash partition 5. Which is inadequate as i learned today. But if we </p>
<p>select * from t1 partition(SYS_P2161);</p>
<p>Will this going to touch some other partitions for getting data. If yes then how can we get this information that which partitions it&#8217;s touching.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lascoltodelvenerdi</title>
		<link>http://jonathanlewis.wordpress.com/2009/09/21/hash-partitions-2/#comment-34494</link>
		<dc:creator><![CDATA[lascoltodelvenerdi]]></dc:creator>
		<pubDate>Tue, 22 Sep 2009 20:05:34 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2242#comment-34494</guid>
		<description><![CDATA[The algorithm is clear.

I was pointing out that 7 is not a power of 2.

So I think, Jonathan made a &quot;running&quot; example in the sense that you have to track the change if you want to really understand it.

Anyway thank you for your long replay and always pay attention when the count star from 0 and not from 1! ;-)

Bye,
Antonio]]></description>
		<content:encoded><![CDATA[<p>The algorithm is clear.</p>
<p>I was pointing out that 7 is not a power of 2.</p>
<p>So I think, Jonathan made a &#8220;running&#8221; example in the sense that you have to track the change if you want to really understand it.</p>
<p>Anyway thank you for your long replay and always pay attention when the count star from 0 and not from 1! ;-)</p>
<p>Bye,<br />
Antonio</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christo Kutrovsky</title>
		<link>http://jonathanlewis.wordpress.com/2009/09/21/hash-partitions-2/#comment-34493</link>
		<dc:creator><![CDATA[Christo Kutrovsky]]></dc:creator>
		<pubDate>Tue, 22 Sep 2009 14:37:12 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2242#comment-34493</guid>
		<description><![CDATA[Right, with this been a design choice by Oracle, for optimizing partition addition.]]></description>
		<content:encoded><![CDATA[<p>Right, with this been a design choice by Oracle, for optimizing partition addition.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christo Kutrovsky</title>
		<link>http://jonathanlewis.wordpress.com/2009/09/21/hash-partitions-2/#comment-34491</link>
		<dc:creator><![CDATA[Christo Kutrovsky]]></dc:creator>
		<pubDate>Tue, 22 Sep 2009 14:18:19 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2242#comment-34491</guid>
		<description><![CDATA[Antonio, Ben,

The way I would summarize is, you only get even distribution when you use power of 2 partitions. Every time you add a hash partition, you split ONLY one existing into two new ones.

Regardless whether you add them one by one, or create them from scratch, the result will be the same. (Except high water mark been higher?)

With 1 partition , add a new one (split), you get 2 (power of 2) with 50%/50%.
With 2 partitions, add a new one (split), you get 3 (not power of 2) with 50%/25%/25% split
With 3 partitions, add a new one (split), you get 4 (power of 2) with 25%/25%/25%/25% split
With 4 partitions, add a new one (split), you get 5 (not power of 2) with 25%/25%/25%/13%/12% split
etc...

The idea behind this algorithm is when you add a new partitions, you wont copy data from ALL partitions, just split 1.

With this (oracle) algorithm, if you have a 1000 GiB table with 30 partitions you would have:
1000 / 32 = 31.25
28 partitions of 31.25 GiB
2 partitions of 62.50 GiB (twice the &quot;common&quot; size)

An add partitions command would result in:
Reading 1 of the big partitions (62.50 GiB) and writing out a new 31.25 GiB partition. (I guess the existing partition will have it&#039;s rows deleted - but let&#039;s skip that part for now).

So total IO (without deletion fact) 62.50 + 31.25 = 100 GiB.

With a &quot;pure&quot; hashing algorithm, the same table (1000 GiB) with 30 partitions would have:
30 partitions, each 33.3 GiB in size.

An add partition will have to:
Read ALL 30 partitions (1000 GiB) and write out a new 32.2 GiB partition.

Total IO (without deletion) would be: 1000 Gib + 32.2 = 1032.2 GiB. About 10 fold more.

For this reason, ora_hash cannot be used &quot;as is&quot; to predict which partition data would go to. I am sure Tanel or Christian could write some bit-offset edited version that will give the exact location.

Caveat for ora_hash, to split data in 8 buckets (power of 2) you have to use ora_hash([id],7) because the bucket is base 0 (not base 1).]]></description>
		<content:encoded><![CDATA[<p>Antonio, Ben,</p>
<p>The way I would summarize is, you only get even distribution when you use power of 2 partitions. Every time you add a hash partition, you split ONLY one existing into two new ones.</p>
<p>Regardless whether you add them one by one, or create them from scratch, the result will be the same. (Except high water mark been higher?)</p>
<p>With 1 partition , add a new one (split), you get 2 (power of 2) with 50%/50%.<br />
With 2 partitions, add a new one (split), you get 3 (not power of 2) with 50%/25%/25% split<br />
With 3 partitions, add a new one (split), you get 4 (power of 2) with 25%/25%/25%/25% split<br />
With 4 partitions, add a new one (split), you get 5 (not power of 2) with 25%/25%/25%/13%/12% split<br />
etc&#8230;</p>
<p>The idea behind this algorithm is when you add a new partitions, you wont copy data from ALL partitions, just split 1.</p>
<p>With this (oracle) algorithm, if you have a 1000 GiB table with 30 partitions you would have:<br />
1000 / 32 = 31.25<br />
28 partitions of 31.25 GiB<br />
2 partitions of 62.50 GiB (twice the &#8220;common&#8221; size)</p>
<p>An add partitions command would result in:<br />
Reading 1 of the big partitions (62.50 GiB) and writing out a new 31.25 GiB partition. (I guess the existing partition will have it&#8217;s rows deleted &#8211; but let&#8217;s skip that part for now).</p>
<p>So total IO (without deletion fact) 62.50 + 31.25 = 100 GiB.</p>
<p>With a &#8220;pure&#8221; hashing algorithm, the same table (1000 GiB) with 30 partitions would have:<br />
30 partitions, each 33.3 GiB in size.</p>
<p>An add partition will have to:<br />
Read ALL 30 partitions (1000 GiB) and write out a new 32.2 GiB partition.</p>
<p>Total IO (without deletion) would be: 1000 Gib + 32.2 = 1032.2 GiB. About 10 fold more.</p>
<p>For this reason, ora_hash cannot be used &#8220;as is&#8221; to predict which partition data would go to. I am sure Tanel or Christian could write some bit-offset edited version that will give the exact location.</p>
<p>Caveat for ora_hash, to split data in 8 buckets (power of 2) you have to use ora_hash([id],7) because the bucket is base 0 (not base 1).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
