<?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: Order of keys inside index blocks</title>
	<atom:link href="http://www.adellera.it/blog/2009/05/24/order-keys-inside-index-blocks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.adellera.it/blog/2009/05/24/order-keys-inside-index-blocks/</link>
	<description>A blog about Oracle - Un blog riguardo Oracle</description>
	<lastBuildDate>Wed, 11 Aug 2010 14:30:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Alberto Dell'Era</title>
		<link>http://www.adellera.it/blog/2009/05/24/order-keys-inside-index-blocks/comment-page-1/#comment-139</link>
		<dc:creator>Alberto Dell'Era</dc:creator>
		<pubDate>Tue, 01 Sep 2009 08:29:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.adellera.it/blog/?p=233#comment-139</guid>
		<description>@Kostas

Yes, slot#0 &quot;contains&quot; &#039;00000000&#039;, slot#1 &quot;contains&quot; &#039;11111111&#039;, and hence a new row with the key value of &#039;88888888&#039; would be &quot;in&quot; slot#8, wherever it gets inserted in the block. 

Note that I have placed &quot;contains&quot; in double quotes because actually, each slot contains the &lt;i&gt;address&lt;/i&gt; of the index key, not the index key itself. For example, in the example of the post above, slot#0 contains the number 8020 that is the address of first byte of its key &#039;00000000&#039;.

The block dump routine simply walks the row directory (an array of 16 bit elements) starting from the first slot and prints both the address and the key value.

Note: of course the index key order is as above because my database charset is AL32UTF8, and hence the binary representation of the pure-ASCII strings I have used is ordered as the language conventions dictate. Index keys are always stored in the block using the binary value.</description>
		<content:encoded><![CDATA[<p>@Kostas</p>
<p>Yes, slot#0 &#8220;contains&#8221; &#8216;00000000&#8242;, slot#1 &#8220;contains&#8221; &#8216;11111111&#8242;, and hence a new row with the key value of &#8216;88888888&#8242; would be &#8220;in&#8221; slot#8, wherever it gets inserted in the block. </p>
<p>Note that I have placed &#8220;contains&#8221; in double quotes because actually, each slot contains the <i>address</i> of the index key, not the index key itself. For example, in the example of the post above, slot#0 contains the number 8020 that is the address of first byte of its key &#8216;00000000&#8242;.</p>
<p>The block dump routine simply walks the row directory (an array of 16 bit elements) starting from the first slot and prints both the address and the key value.</p>
<p>Note: of course the index key order is as above because my database charset is AL32UTF8, and hence the binary representation of the pure-ASCII strings I have used is ordered as the language conventions dictate. Index keys are always stored in the block using the binary value.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kostas Hairopoulos</title>
		<link>http://www.adellera.it/blog/2009/05/24/order-keys-inside-index-blocks/comment-page-1/#comment-136</link>
		<dc:creator>Kostas Hairopoulos</dc:creator>
		<pubDate>Mon, 31 Aug 2009 16:10:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.adellera.it/blog/?p=233#comment-136</guid>
		<description>Alberto, thank you for sharing this article with us however can please give some lights in your phrase like &quot;  ... that is, the addresses in the row directory are ordered by the (binary) value of the key they point to&quot;.
Its still not clear to me. 
As far as I understand from the leaf block dump, the row slot in row directory follows the key order  ( &#039;0000000&#039; is in slot 0, &#039;11111111&#039; is in slot 1 etc) and not the. What will be the order of a new row number 8 and value  &#039;88888888&#039; in position  7898? 

Best Regards,
Kostas Hairopoulos


Thank you in advance,
khair</description>
		<content:encoded><![CDATA[<p>Alberto, thank you for sharing this article with us however can please give some lights in your phrase like &#8221;  &#8230; that is, the addresses in the row directory are ordered by the (binary) value of the key they point to&#8221;.<br />
Its still not clear to me.<br />
As far as I understand from the leaf block dump, the row slot in row directory follows the key order  ( &#8216;0000000&#8242; is in slot 0, &#8216;11111111&#8242; is in slot 1 etc) and not the. What will be the order of a new row number 8 and value  &#8216;88888888&#8242; in position  7898? </p>
<p>Best Regards,<br />
Kostas Hairopoulos</p>
<p>Thank you in advance,<br />
khair</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alberto Dell'Era</title>
		<link>http://www.adellera.it/blog/2009/05/24/order-keys-inside-index-blocks/comment-page-1/#comment-58</link>
		<dc:creator>Alberto Dell'Era</dc:creator>
		<pubDate>Wed, 01 Jul 2009 22:00:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.adellera.it/blog/?p=233#comment-58</guid>
		<description>@Dennis

Thank you very much! Your observation makes this post complete ... 

For better readability, here&#039;s your observation &quot;decoded&quot; from hex to decimal, in the same format as above:
[text]
1F50=8016 address of &#039;000000&#039;
1F30=7984 address of &#039;111111&#039;
1F10=7952 address of &#039;222222&#039;
1EF0=7920 address of &#039;333333&#039;
1EE0=7904 address of &#039;444444&#039;
1F00=7936 address of &#039;555555&#039;
1F20=7968 address of &#039;666666&#039;
1F40=8000 address of &#039;777777&#039;
[/text]</description>
		<content:encoded><![CDATA[<p>@Dennis</p>
<p>Thank you very much! Your observation makes this post complete &#8230; </p>
<p>For better readability, here&#8217;s your observation &#8220;decoded&#8221; from hex to decimal, in the same format as above:</p>
<pre class="brush: plain;">
1F50=8016 address of '000000'
1F30=7984 address of '111111'
1F10=7952 address of '222222'
1EF0=7920 address of '333333'
1EE0=7904 address of '444444'
1F00=7936 address of '555555'
1F20=7968 address of '666666'
1F40=8000 address of '777777'
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dennis Sun</title>
		<link>http://www.adellera.it/blog/2009/05/24/order-keys-inside-index-blocks/comment-page-1/#comment-57</link>
		<dc:creator>Dennis Sun</dc:creator>
		<pubDate>Wed, 01 Jul 2009 20:28:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.adellera.it/blog/?p=233#comment-57</guid>
		<description>Great job. I tested it on sun sparc server(big-endians). don&#039;t need to swap the high and low 2 bytes:
[text]
106751080 00000000 1F600000 1F501F30 1F101EF0  [.....`...P.0....]
106751090 1EE01F00 1F201F40 1D391D1D 1D011CE5  [..... .@.9......]


row#0[8016] flag: ------, lock: 2, len=16            
col 0; len 6; (6):  30 30 30 30 30 30
col 1; len 6; (6):  01 80 05 7f 00 00
row#1[7984] flag: ------, lock: 2, len=16            
col 0; len 6; (6):  31 31 31 31 31 31
col 1; len 6; (6):  01 80 05 7f 00 02
row#2[7952] flag: ------, lock: 2, len=16                
col 0; len 6; (6):  32 32 32 32 32 32
col 1; len 6; (6):  01 80 05 7f 00 04
row#3[7920] flag: ------, lock: 2, len=16            
col 0; len 6; (6):  33 33 33 33 33 33
col 1; len 6; (6):  01 80 05 7f 00 06
row#4[7904] flag: ------, lock: 2, len=16            
col 0; len 6; (6):  34 34 34 34 34 34
col 1; len 6; (6):  01 80 05 7f 00 07
row#5[7936] flag: ------, lock: 2, len=16
col 0; len 6; (6):  35 35 35 35 35 35
col 1; len 6; (6):  01 80 05 7f 00 05
row#6[7968] flag: ------, lock: 2, len=16
col 0; len 6; (6):  36 36 36 36 36 36
col 1; len 6; (6):  01 80 05 7f 00 03
row#7[8000] flag: ------, lock: 2, len=16
col 0; len 6; (6):  37 37 37 37 37 37
col 1; len 6; (6):  01 80 05 7f 00 01
[/text]</description>
		<content:encoded><![CDATA[<p>Great job. I tested it on sun sparc server(big-endians). don&#8217;t need to swap the high and low 2 bytes:</p>
<pre class="brush: plain;">
106751080 00000000 1F600000 1F501F30 1F101EF0  [.....`...P.0....]
106751090 1EE01F00 1F201F40 1D391D1D 1D011CE5  [..... .@.9......]

row#0[8016] flag: ------, lock: 2, len=16
col 0; len 6; (6):  30 30 30 30 30 30
col 1; len 6; (6):  01 80 05 7f 00 00
row#1[7984] flag: ------, lock: 2, len=16
col 0; len 6; (6):  31 31 31 31 31 31
col 1; len 6; (6):  01 80 05 7f 00 02
row#2[7952] flag: ------, lock: 2, len=16
col 0; len 6; (6):  32 32 32 32 32 32
col 1; len 6; (6):  01 80 05 7f 00 04
row#3[7920] flag: ------, lock: 2, len=16
col 0; len 6; (6):  33 33 33 33 33 33
col 1; len 6; (6):  01 80 05 7f 00 06
row#4[7904] flag: ------, lock: 2, len=16
col 0; len 6; (6):  34 34 34 34 34 34
col 1; len 6; (6):  01 80 05 7f 00 07
row#5[7936] flag: ------, lock: 2, len=16
col 0; len 6; (6):  35 35 35 35 35 35
col 1; len 6; (6):  01 80 05 7f 00 05
row#6[7968] flag: ------, lock: 2, len=16
col 0; len 6; (6):  36 36 36 36 36 36
col 1; len 6; (6):  01 80 05 7f 00 03
row#7[8000] flag: ------, lock: 2, len=16
col 0; len 6; (6):  37 37 37 37 37 37
col 1; len 6; (6):  01 80 05 7f 00 01
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alberto Dell'Era</title>
		<link>http://www.adellera.it/blog/2009/05/24/order-keys-inside-index-blocks/comment-page-1/#comment-26</link>
		<dc:creator>Alberto Dell'Era</dc:creator>
		<pubDate>Thu, 04 Jun 2009 14:45:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.adellera.it/blog/?p=233#comment-26</guid>
		<description>Sorry for answering late, since I&#039;ve just got back from a internet-less vacation :)

@Cristian

the bytes are ordered in groups of two because in order to address a byte inside the block we need 16 bits (2^16 = 65535, which is enough for all configurable dimensions of the Oracle block). 

We need 16+2 bytes because 16 is the length of the entry itself (see len=16 in the block dump) and 2 is the size of the pointer in the row directory that points to the entry.

@zfriese

I will check whether I can find a standard notation to express the logarithm base as well; even if the base is not strictly necessary when performing big-O analysis, I think it adds value in this context. 
Thanks for your comment.</description>
		<content:encoded><![CDATA[<p>Sorry for answering late, since I&#8217;ve just got back from a internet-less vacation :)</p>
<p>@Cristian</p>
<p>the bytes are ordered in groups of two because in order to address a byte inside the block we need 16 bits (2^16 = 65535, which is enough for all configurable dimensions of the Oracle block). </p>
<p>We need 16+2 bytes because 16 is the length of the entry itself (see len=16 in the block dump) and 2 is the size of the pointer in the row directory that points to the entry.</p>
<p>@zfriese</p>
<p>I will check whether I can find a standard notation to express the logarithm base as well; even if the base is not strictly necessary when performing big-O analysis, I think it adds value in this context.<br />
Thanks for your comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zfriese</title>
		<link>http://www.adellera.it/blog/2009/05/24/order-keys-inside-index-blocks/comment-page-1/#comment-20</link>
		<dc:creator>zfriese</dc:creator>
		<pubDate>Wed, 03 Jun 2009 13:15:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.adellera.it/blog/?p=233#comment-20</guid>
		<description>Great article! However, your use of asymptotic notation is non-standard, and might be confusing. Consider simplifying to O(log n). Binary searches have logarithmic complexity. Thanks.</description>
		<content:encoded><![CDATA[<p>Great article! However, your use of asymptotic notation is non-standard, and might be confusing. Consider simplifying to O(log n). Binary searches have logarithmic complexity. Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cristian</title>
		<link>http://www.adellera.it/blog/2009/05/24/order-keys-inside-index-blocks/comment-page-1/#comment-19</link>
		<dc:creator>Cristian</dc:creator>
		<pubDate>Fri, 29 May 2009 15:48:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.adellera.it/blog/?p=233#comment-19</guid>
		<description>Hi Alberto,
congratulations, i will try to follow your example writing a question in English (correct me if i make some mistakes :) ). I&#039;ve get in trouble with the point in wich you demonstrate that items in row directory are ordered by binary value of the key. Why are the byte grouped by groups of two? Another question is about storage needed by each key, you say that in your example is 16+2 bytes: what are the 4+2 bytes over keys used for?</description>
		<content:encoded><![CDATA[<p>Hi Alberto,<br />
congratulations, i will try to follow your example writing a question in English (correct me if i make some mistakes :) ). I&#8217;ve get in trouble with the point in wich you demonstrate that items in row directory are ordered by binary value of the key. Why are the byte grouped by groups of two? Another question is about storage needed by each key, you say that in your example is 16+2 bytes: what are the 4+2 bytes over keys used for?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Two Excellent Index Related Blog Posts &#171; Richard Foote&#8217;s Oracle Blog</title>
		<link>http://www.adellera.it/blog/2009/05/24/order-keys-inside-index-blocks/comment-page-1/#comment-15</link>
		<dc:creator>Two Excellent Index Related Blog Posts &#171; Richard Foote&#8217;s Oracle Blog</dc:creator>
		<pubDate>Mon, 25 May 2009 11:15:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.adellera.it/blog/?p=233#comment-15</guid>
		<description>[...] second is by Alberto Dell&#8217;Era who discusses in a post called Order of keys inside index blocks exactly how Oracle orders and stores the index keys within an index block. I&#8217;ve exchanged a [...]</description>
		<content:encoded><![CDATA[<p>[...] second is by Alberto Dell&#8217;Era who discusses in a post called Order of keys inside index blocks exactly how Oracle orders and stores the index keys within an index block. I&#8217;ve exchanged a [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
