<?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: Column Order in a Table &#8211; Does it Matter? 1</title>
	<atom:link href="http://hoopercharles.wordpress.com/2010/05/22/column-order-in-a-table-does-it-matter-1/feed/" rel="self" type="application/rss+xml" />
	<link>http://hoopercharles.wordpress.com/2010/05/22/column-order-in-a-table-does-it-matter-1/</link>
	<description>Miscellaneous Random Oracle Topics: Stop, Think, ... Understand</description>
	<lastBuildDate>Thu, 23 May 2013 04:02:42 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Log Buffer #190, A Carnival of the Vanities for DBAs &#124; The Pythian Blog</title>
		<link>http://hoopercharles.wordpress.com/2010/05/22/column-order-in-a-table-does-it-matter-1/#comment-1185</link>
		<dc:creator><![CDATA[Log Buffer #190, A Carnival of the Vanities for DBAs &#124; The Pythian Blog]]></dc:creator>
		<pubDate>Fri, 28 May 2010 16:55:58 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2226#comment-1185</guid>
		<description><![CDATA[[...] Hooper posted a small series on how column order in the query can impact performance. Sometimes. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Hooper posted a small series on how column order in the query can impact performance. Sometimes. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/05/22/column-order-in-a-table-does-it-matter-1/#comment-1043</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Sun, 23 May 2010 15:00:41 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2226#comment-1043</guid>
		<description><![CDATA[I have attempted to replace the missing &quot;&lt;=&quot; code in your comment.

Thank you for posting the test case.]]></description>
		<content:encoded><![CDATA[<p>I have attempted to replace the missing &#8220;&lt;=&#8221; code in your comment.</p>
<p>Thank you for posting the test case.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Neumueller</title>
		<link>http://hoopercharles.wordpress.com/2010/05/22/column-order-in-a-table-does-it-matter-1/#comment-1042</link>
		<dc:creator><![CDATA[Chris Neumueller]]></dc:creator>
		<pubDate>Sun, 23 May 2010 14:20:22 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2226#comment-1042</guid>
		<description><![CDATA[Well, now Wordpress ate my less-or-equal 1000000 at the end of the connect-by, but readers should get the idea...]]></description>
		<content:encoded><![CDATA[<p>Well, now WordPress ate my less-or-equal 1000000 at the end of the connect-by, but readers should get the idea&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Neumueller</title>
		<link>http://hoopercharles.wordpress.com/2010/05/22/column-order-in-a-table-does-it-matter-1/#comment-1041</link>
		<dc:creator><![CDATA[Chris Neumueller]]></dc:creator>
		<pubDate>Sun, 23 May 2010 14:17:03 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2226#comment-1041</guid>
		<description><![CDATA[Oops, sorry. Of course, T1 was the table with first 19 nulls and then one 1, for T2 it was the other way around. The test is trivial, but I&#039;ll post it anyway, just in case ;-)

&lt;pre&gt;
SQL&gt; create table t1 (
  2    x01 number, x02 number, x03 number, x04 number, x05 number,
  3    x06 number, x07 number, x08 number, x09 number, x10 number,
  4    x11 number, x12 number, x13 number, x14 number, x15 number,
  5    x16 number, x17 number, x18 number, x19 number, x20 number
  6  )
  7  /

Tabelle wurde erstellt.

SQL&gt; insert into t1
  2  select
  3    null, null, null, null, null,
  4    null, null, null, null, null,
  5    null, null, null, null, null,
  6    null, null, null, null, 1
  7  from dual
  8  connect by level &lt;= 1000000;
 
SQL&gt; create table t2 (
  2    x01 number, x02 number, x03 number, x04 number, x05 number,
  3    x06 number, x07 number, x08 number, x09 number, x10 number,
  4    x11 number, x12 number, x13 number, x14 number, x15 number,
  5    x16 number, x17 number, x18 number, x19 number, x20 number
  6  )
  7  /

Tabelle wurde erstellt.

SQL&gt; insert into t2
  2  select
  3    1   , null, null, null, null,
  4    null, null, null, null, null,
  5    null, null, null, null, null,
  6    null, null, null, null, null
  7  from dual
  8  connect by level  &lt;= 1000000;
   
SQL&gt; select sum(x01),sum(x20),count(*) from t1
  2  /

  SUM(X01)   SUM(X20)   COUNT(*)
---------- ---------- ----------
              1000000    1000000

1 Zeile wurde ausgewählt.

SQL&gt; select sum(x01),sum(x20),count(*) from t2
  2  /

  SUM(X01)   SUM(X20)   COUNT(*)
---------- ---------- ----------
   1000000               1000000

1 Zeile wurde ausgewählt.

SQL&gt; select segment_name, blocks,bytes
  2  from user_segments
  3  where segment_name in (&#039;T1&#039;,&#039;T2&#039;)
  4  /

SEGMENT_NAME                       BLOCKS      BYTES
------------------------------ ---------- ----------
T1                                   3840   31457280
T2                                   1664   13631488

2 Zeilen ausgewählt.
&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>Oops, sorry. Of course, T1 was the table with first 19 nulls and then one 1, for T2 it was the other way around. The test is trivial, but I&#8217;ll post it anyway, just in case <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<pre>
SQL&gt; create table t1 (
  2    x01 number, x02 number, x03 number, x04 number, x05 number,
  3    x06 number, x07 number, x08 number, x09 number, x10 number,
  4    x11 number, x12 number, x13 number, x14 number, x15 number,
  5    x16 number, x17 number, x18 number, x19 number, x20 number
  6  )
  7  /

Tabelle wurde erstellt.

SQL&gt; insert into t1
  2  select
  3    null, null, null, null, null,
  4    null, null, null, null, null,
  5    null, null, null, null, null,
  6    null, null, null, null, 1
  7  from dual
  8  connect by level &lt;= 1000000;
 
SQL&gt; create table t2 (
  2    x01 number, x02 number, x03 number, x04 number, x05 number,
  3    x06 number, x07 number, x08 number, x09 number, x10 number,
  4    x11 number, x12 number, x13 number, x14 number, x15 number,
  5    x16 number, x17 number, x18 number, x19 number, x20 number
  6  )
  7  /

Tabelle wurde erstellt.

SQL&gt; insert into t2
  2  select
  3    1   , null, null, null, null,
  4    null, null, null, null, null,
  5    null, null, null, null, null,
  6    null, null, null, null, null
  7  from dual
  8  connect by level  &lt;= 1000000;
   
SQL&gt; select sum(x01),sum(x20),count(*) from t1
  2  /

  SUM(X01)   SUM(X20)   COUNT(*)
---------- ---------- ----------
              1000000    1000000

1 Zeile wurde ausgewählt.

SQL&gt; select sum(x01),sum(x20),count(*) from t2
  2  /

  SUM(X01)   SUM(X20)   COUNT(*)
---------- ---------- ----------
   1000000               1000000

1 Zeile wurde ausgewählt.

SQL&gt; select segment_name, blocks,bytes
  2  from user_segments
  3  where segment_name in ('T1','T2')
  4  /

SEGMENT_NAME                       BLOCKS      BYTES
------------------------------ ---------- ----------
T1                                   3840   31457280
T2                                   1664   13631488

2 Zeilen ausgewählt.
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/05/22/column-order-in-a-table-does-it-matter-1/#comment-1040</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Sun, 23 May 2010 14:02:56 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2226#comment-1040</guid>
		<description><![CDATA[Chris (N.),

That is another excellent point about column position and the effect that NULL values in columns have on storage requirements - that could also be the reason why Oracle only permits adding columns at the end of a table&#039;s column list, as a column with a NULL default value will occupy no additional space in a row piece, thus eliminating or delaying row chaining and/or row migration when a column is added.

Could you verify that table T1&#039;s first column contains a value and that table T2&#039;s last column contains a value?  It could just be a typo, but your block counts for the two tables seem to conflict with your first paragraph in your comment (the first paragraph agrees with my understanding and at least one test case on this blog).  It would seem that table T2 would require more blocks than table T1 due to T2 having to indicate NULL values in the first 19 columns in the table, while that is not required for the last 19 columns in table T1.

I think that if you supplied your test script in a comment, that would help to add value to this blog article by allowing someone else to reproduce the test.]]></description>
		<content:encoded><![CDATA[<p>Chris (N.),</p>
<p>That is another excellent point about column position and the effect that NULL values in columns have on storage requirements &#8211; that could also be the reason why Oracle only permits adding columns at the end of a table&#8217;s column list, as a column with a NULL default value will occupy no additional space in a row piece, thus eliminating or delaying row chaining and/or row migration when a column is added.</p>
<p>Could you verify that table T1&#8242;s first column contains a value and that table T2&#8242;s last column contains a value?  It could just be a typo, but your block counts for the two tables seem to conflict with your first paragraph in your comment (the first paragraph agrees with my understanding and at least one test case on this blog).  It would seem that table T2 would require more blocks than table T1 due to T2 having to indicate NULL values in the first 19 columns in the table, while that is not required for the last 19 columns in table T1.</p>
<p>I think that if you supplied your test script in a comment, that would help to add value to this blog article by allowing someone else to reproduce the test.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/05/22/column-order-in-a-table-does-it-matter-1/#comment-1038</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Sun, 23 May 2010 13:20:22 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2226#comment-1038</guid>
		<description><![CDATA[Chris (A.),

Thank you for adding the comment about row chaining; the comment certainly adds value to this blog article.

I agree that row chaining should be a third bullet point item (I forgot that you mentioned it in your book).  The follow-up article, which should appear on the site Monday, was originally intended to precede this article.  The follow-up looks at the effects of row chaining for tables that have up to 1,000 columns.  In the follow-up article, the row chaining will be limited to that which happens due to the 255 column per row piece limit, and will not explore row chaining caused by updates of rows.]]></description>
		<content:encoded><![CDATA[<p>Chris (A.),</p>
<p>Thank you for adding the comment about row chaining; the comment certainly adds value to this blog article.</p>
<p>I agree that row chaining should be a third bullet point item (I forgot that you mentioned it in your book).  The follow-up article, which should appear on the site Monday, was originally intended to precede this article.  The follow-up looks at the effects of row chaining for tables that have up to 1,000 columns.  In the follow-up article, the row chaining will be limited to that which happens due to the 255 column per row piece limit, and will not explore row chaining caused by updates of rows.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Neumueller</title>
		<link>http://hoopercharles.wordpress.com/2010/05/22/column-order-in-a-table-does-it-matter-1/#comment-1037</link>
		<dc:creator><![CDATA[Chris Neumueller]]></dc:creator>
		<pubDate>Sun, 23 May 2010 12:54:43 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2226#comment-1037</guid>
		<description><![CDATA[An interesting read, thanks.

Another approach to optimal column order is from the storage side, if the table contains empty columns. When they are at the end of the table, the segment requires less blocks, which is nice by itself and of course has an impact on the buffer cache&#039;s efficiency. 

My test case includes 2 tables T1 and T2 with 20 columns x01-x20. Both contain 1000000 records. T1&#039;s x01 contains 1, all it&#039;s other columns are null. T2&#039;s x20 contains 1, all it&#039;s other columns are null. On my machine, T1 occupies 3840 blocks while T2 occupies 1664 blocks.]]></description>
		<content:encoded><![CDATA[<p>An interesting read, thanks.</p>
<p>Another approach to optimal column order is from the storage side, if the table contains empty columns. When they are at the end of the table, the segment requires less blocks, which is nice by itself and of course has an impact on the buffer cache&#8217;s efficiency. </p>
<p>My test case includes 2 tables T1 and T2 with 20 columns x01-x20. Both contain 1000000 records. T1&#8242;s x01 contains 1, all it&#8217;s other columns are null. T2&#8242;s x20 contains 1, all it&#8217;s other columns are null. On my machine, T1 occupies 3840 blocks while T2 occupies 1664 blocks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Antognini</title>
		<link>http://hoopercharles.wordpress.com/2010/05/22/column-order-in-a-table-does-it-matter-1/#comment-1031</link>
		<dc:creator><![CDATA[Chris Antognini]]></dc:creator>
		<pubDate>Sun, 23 May 2010 08:55:53 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2226#comment-1031</guid>
		<description><![CDATA[Hi Charles

First of all, thank you for referencing my book on that matter.

I would like to point out that, IMO, the column order is also relevant in a third situation. Specifically, for chained rows. In fact, as I wrore at page 537:

&quot;The impact on performance caused by chaining is independent of the access path. In fact, every time the first piece is found, it is necessary to read all the other pieces through the rowid as well. There is one exception, however. As discussed in the section “Optimal Column Order,” when only part of a row is needed, not all pieces may need to be accessed. For example, if only columns stored in the first piece are needed, there is no need to access all other pieces.&quot;

Hence, for rows that are usually chained, it might be sensible to add a new column near the beginning of the row.

Cheers,
Chris]]></description>
		<content:encoded><![CDATA[<p>Hi Charles</p>
<p>First of all, thank you for referencing my book on that matter.</p>
<p>I would like to point out that, IMO, the column order is also relevant in a third situation. Specifically, for chained rows. In fact, as I wrore at page 537:</p>
<p>&#8220;The impact on performance caused by chaining is independent of the access path. In fact, every time the first piece is found, it is necessary to read all the other pieces through the rowid as well. There is one exception, however. As discussed in the section “Optimal Column Order,” when only part of a row is needed, not all pieces may need to be accessed. For example, if only columns stored in the first piece are needed, there is no need to access all other pieces.&#8221;</p>
<p>Hence, for rows that are usually chained, it might be sensible to add a new column near the beginning of the row.</p>
<p>Cheers,<br />
Chris</p>
]]></content:encoded>
	</item>
</channel>
</rss>
