<?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: How Many Topics can be Packed into a Short OTN Thread?</title>
	<atom:link href="http://hoopercharles.wordpress.com/2010/01/21/how-many-topics-can-be-packed-into-a-short-otn-thread/feed/" rel="self" type="application/rss+xml" />
	<link>http://hoopercharles.wordpress.com/2010/01/21/how-many-topics-can-be-packed-into-a-short-otn-thread/</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: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/01/21/how-many-topics-can-be-packed-into-a-short-otn-thread/#comment-226</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Fri, 22 Jan 2010 12:53:09 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=934#comment-226</guid>
		<description><![CDATA[I was hoping that Jonathan would see your question and provide you with a very carefully constructed answer to your questions.  The results could be different depending on whether you are using dictionary managed tablespaces, locally managed tablespaces with manual freelist management, or locally managed tablespaces with ASSM AUTO ALLOCATEd management.

How to demonstrate what is happening?  Setting event 10200 causes all logical IOs to be written to a trace file.  See:
http://www.freelists.org/post/oracle-l/Logical-IO,3
http://www.juliandyke.com/Diagnostics/Events/EventReference.html#10200

Keep in mind that Jonathan is referring to a very specific case in the response that you quoted, a case where there is a table with a single row in a table with a single column that also has an index on that single column.  In such a case, the index structure will contain a single block - the root block, so an index access to the one block would require reading the index root block, and then the table block pointed to by the index entry.  I believe that Richard Foote&#039;s blog contains several examples of how this would work for very small index structures.

So, how to set up a test case (note that I modified this to have a table with two columns)?
[code]
CREATE TABLE T1 (
  C1 NUMBER,
  C2 NUMBER,
  PRIMARY KEY (C1));
 
INSERT INTO T1 VALUES(1,1);
 
COMMIT;
 
EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=&gt;USER,TABNAME=&gt;&#039;T1&#039;,CASCADE=&gt;TRUE)
[/code]

OK, we now have a table defined with two columns, with a primary key index, and a single row.  Now the test case:
[code]
SELECT /*+ GATHER_PLAN_STATISTICS FULL(T1) */
  *
FROM
  T1;
 
SELECT
  *
FROM
  TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,&#039;ALLSTATS LAST&#039;));
 
SELECT /*+ GATHER_PLAN_STATISTICS INDEX(T1) */
  *
FROM
  T1;
 
SELECT
  *
FROM
  TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,&#039;ALLSTATS LAST&#039;));
 
ALTER SESSION SET EVENTS &#039;10200 TRACE NAME CONTEXT FOREVER, LEVEL 1&#039;;
ALTER SESSION SET TRACEFILE_IDENTIFIER = &#039;Event10200Test1&#039;;
 
SELECT /*+ GATHER_PLAN_STATISTICS FULL(T1) */
  *
FROM
  T1;
 
ALTER SESSION SET TRACEFILE_IDENTIFIER = &#039;Event10200Test2&#039;;
 
SELECT /*+ GATHER_PLAN_STATISTICS INDEX(T1) */
  *
FROM
  T1;
 
ALTER SESSION SET EVENTS &#039;10200 TRACE NAME CONTEXT OFF&#039;;
[/code]

The output from the above for Oracle 10.2.0.x with an ASSM AUTO ALLOCATEd tablespace follows:
[code]
SQL_ID  0yp492wfxqf3q, child number 0
-------------------------------------
SELECT /*+ GATHER_PLAN_STATISTICS FULL(T1) */   * FROM   T1
 
Plan hash value: 3617692013
 
------------------------------------------------------------------------------------
&#124; Id  &#124; Operation         &#124; Name &#124; Starts &#124; E-Rows &#124; A-Rows &#124;   A-Time   &#124; Buffers &#124;
------------------------------------------------------------------------------------
&#124;   1 &#124;  TABLE ACCESS FULL&#124; T1   &#124;      1 &#124;      1 &#124;      1 &#124;00:00:00.01 &#124;       7 &#124;
------------------------------------------------------------------------------------
 
SQL_ID  2v0wvvx7sjxj8, child number 0
-------------------------------------
SELECT /*+ GATHER_PLAN_STATISTICS INDEX(T1) */   * FROM   T1
 
Plan hash value: 3727918903
 
------------------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation                   &#124; Name         &#124; Starts &#124; E-Rows &#124; A-Rows &#124;   A-Time   &#124; Buffers &#124;
------------------------------------------------------------------------------------------------------
&#124;   1 &#124;  TABLE ACCESS BY INDEX ROWID&#124; T1           &#124;      1 &#124;      1 &#124;      1 &#124;00:00:00.01 &#124;       2 &#124;
&#124;   2 &#124;   INDEX FULL SCAN           &#124; SYS_C0020540 &#124;      1 &#124;      1 &#124;      1 &#124;00:00:00.01 &#124;       1 &#124;
------------------------------------------------------------------------------------------------------
[/code]

As you can see from the above, the full table scan required 7 logical IOs, and the index access required 2 logical IOs (1 for the index root block, and a second for the parent operation&#039;s table access).  Let&#039;s take a look in the trace files:
From event10200test1 (full table scan - slightly trimmed for space):
[code]
Consistent read started for block 4 : 0110ae0c
Consistent read finished for block 4 : 110ae0c
Consistent read finished for block 4 : 110ae0c
Consistent read started for block 4 : 0110ae0d
Consistent read finished for block 4 : 110ae0d
Consistent read finished for block 4 : 110ae0d
Consistent read started for block 4 : 0110ae0e
Consistent read finished for block 4 : 110ae0e
Consistent read finished for block 4 : 110ae0e
Consistent read started for block 4 : 0110ae0f
Consistent read finished for block 4 : 110ae0f
Consistent read finished for block 4 : 110ae0f
Consistent read started for block 4 : 0110ae10
Consistent read finished for block 4 : 110ae10
Consistent read finished for block 4 : 110ae10
[/code]
 
From event10200test1 (index full scan - slightly trimmed for space):
[code]
Consistent read started for block 4 : 0110ae1c
Consistent read finished for block 4 : 110ae1c
Consistent read started for block 4 : 0110ae0e
Consistent read finished for block 4 : 110ae0e
Consistent read finished for block 4 : 110ae0e
[/code]

So, what are those blocks?  Well, you could execute something like this to look at the table&#039;s blocks (note that this could be very slow):
[code]
SELECT /*+ ORDERED */
  DE.BLOCK_ID+C.COUNTER BLOCK_ID,
  TO_CHAR(DE.BLOCK_ID+C.COUNTER,&#039;XXXXXXXX&#039;) HEX_BLOCK_ID,
  DE.BLOCKS,
  C.COUNTER+1 COUNTER
FROM
  (SELECT
    BLOCK_ID,
    BLOCKS
  FROM
    DBA_EXTENTS
  WHERE
    OWNER=USER
    AND SEGMENT_NAME IN (&#039;T1&#039;)) DE,
  (SELECT
    ROWNUM-1 COUNTER
  FROM
    DUAL
  CONNECT BY
    LEVEL&lt;=64) C
WHERE
  DE.BLOCKS&gt;C.COUNTER
ORDER BY
  C.COUNTER;
 
  BLOCK_ID HEX_BLOCK     BLOCKS    COUNTER
---------- --------- ---------- ----------
   1093129    10AE09          8          1
   1093130    10AE0A          8          2
   1093131    10AE0B          8          3
   1093132    10AE0C          8          4
   1093133    10AE0D          8          5
   1093134    10AE0E          8          6
   1093135    10AE0F          8          7
   1093136    10AE10          8          8
[/code]

So, during the full table scan, Oracle read blocks 4, 5, 6, 7, and 8 - for a total of 5 logical IO blocks reads.  But, the DBMS_XPLAN output clearly showed that were 7 logical IO blocks read, so what about the other two logical IOs.  I suppose that there is another event that needs to be set to see those logical IOs.]]></description>
		<content:encoded><![CDATA[<p>I was hoping that Jonathan would see your question and provide you with a very carefully constructed answer to your questions.  The results could be different depending on whether you are using dictionary managed tablespaces, locally managed tablespaces with manual freelist management, or locally managed tablespaces with ASSM AUTO ALLOCATEd management.</p>
<p>How to demonstrate what is happening?  Setting event 10200 causes all logical IOs to be written to a trace file.  See:<br />
<a href="http://www.freelists.org/post/oracle-l/Logical-IO,3" rel="nofollow">http://www.freelists.org/post/oracle-l/Logical-IO,3</a><br />
<a href="http://www.juliandyke.com/Diagnostics/Events/EventReference.html#10200" rel="nofollow">http://www.juliandyke.com/Diagnostics/Events/EventReference.html#10200</a></p>
<p>Keep in mind that Jonathan is referring to a very specific case in the response that you quoted, a case where there is a table with a single row in a table with a single column that also has an index on that single column.  In such a case, the index structure will contain a single block &#8211; the root block, so an index access to the one block would require reading the index root block, and then the table block pointed to by the index entry.  I believe that Richard Foote&#8217;s blog contains several examples of how this would work for very small index structures.</p>
<p>So, how to set up a test case (note that I modified this to have a table with two columns)?</p>
<pre class="brush: plain; title: ; notranslate">
CREATE TABLE T1 (
  C1 NUMBER,
  C2 NUMBER,
  PRIMARY KEY (C1));
 
INSERT INTO T1 VALUES(1,1);
 
COMMIT;
 
EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=&gt;USER,TABNAME=&gt;'T1',CASCADE=&gt;TRUE)
</pre>
<p>OK, we now have a table defined with two columns, with a primary key index, and a single row.  Now the test case:</p>
<pre class="brush: plain; title: ; notranslate">
SELECT /*+ GATHER_PLAN_STATISTICS FULL(T1) */
  *
FROM
  T1;
 
SELECT
  *
FROM
  TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'ALLSTATS LAST'));
 
SELECT /*+ GATHER_PLAN_STATISTICS INDEX(T1) */
  *
FROM
  T1;
 
SELECT
  *
FROM
  TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'ALLSTATS LAST'));
 
ALTER SESSION SET EVENTS '10200 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET TRACEFILE_IDENTIFIER = 'Event10200Test1';
 
SELECT /*+ GATHER_PLAN_STATISTICS FULL(T1) */
  *
FROM
  T1;
 
ALTER SESSION SET TRACEFILE_IDENTIFIER = 'Event10200Test2';
 
SELECT /*+ GATHER_PLAN_STATISTICS INDEX(T1) */
  *
FROM
  T1;
 
ALTER SESSION SET EVENTS '10200 TRACE NAME CONTEXT OFF';
</pre>
<p>The output from the above for Oracle 10.2.0.x with an ASSM AUTO ALLOCATEd tablespace follows:</p>
<pre class="brush: plain; title: ; notranslate">
SQL_ID  0yp492wfxqf3q, child number 0
-------------------------------------
SELECT /*+ GATHER_PLAN_STATISTICS FULL(T1) */   * FROM   T1
 
Plan hash value: 3617692013
 
------------------------------------------------------------------------------------
| Id  | Operation         | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
------------------------------------------------------------------------------------
|   1 |  TABLE ACCESS FULL| T1   |      1 |      1 |      1 |00:00:00.01 |       7 |
------------------------------------------------------------------------------------
 
SQL_ID  2v0wvvx7sjxj8, child number 0
-------------------------------------
SELECT /*+ GATHER_PLAN_STATISTICS INDEX(T1) */   * FROM   T1
 
Plan hash value: 3727918903
 
------------------------------------------------------------------------------------------------------
| Id  | Operation                   | Name         | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
------------------------------------------------------------------------------------------------------
|   1 |  TABLE ACCESS BY INDEX ROWID| T1           |      1 |      1 |      1 |00:00:00.01 |       2 |
|   2 |   INDEX FULL SCAN           | SYS_C0020540 |      1 |      1 |      1 |00:00:00.01 |       1 |
------------------------------------------------------------------------------------------------------
</pre>
<p>As you can see from the above, the full table scan required 7 logical IOs, and the index access required 2 logical IOs (1 for the index root block, and a second for the parent operation&#8217;s table access).  Let&#8217;s take a look in the trace files:<br />
From event10200test1 (full table scan &#8211; slightly trimmed for space):</p>
<pre class="brush: plain; title: ; notranslate">
Consistent read started for block 4 : 0110ae0c
Consistent read finished for block 4 : 110ae0c
Consistent read finished for block 4 : 110ae0c
Consistent read started for block 4 : 0110ae0d
Consistent read finished for block 4 : 110ae0d
Consistent read finished for block 4 : 110ae0d
Consistent read started for block 4 : 0110ae0e
Consistent read finished for block 4 : 110ae0e
Consistent read finished for block 4 : 110ae0e
Consistent read started for block 4 : 0110ae0f
Consistent read finished for block 4 : 110ae0f
Consistent read finished for block 4 : 110ae0f
Consistent read started for block 4 : 0110ae10
Consistent read finished for block 4 : 110ae10
Consistent read finished for block 4 : 110ae10
</pre>
<p>From event10200test1 (index full scan &#8211; slightly trimmed for space):</p>
<pre class="brush: plain; title: ; notranslate">
Consistent read started for block 4 : 0110ae1c
Consistent read finished for block 4 : 110ae1c
Consistent read started for block 4 : 0110ae0e
Consistent read finished for block 4 : 110ae0e
Consistent read finished for block 4 : 110ae0e
</pre>
<p>So, what are those blocks?  Well, you could execute something like this to look at the table&#8217;s blocks (note that this could be very slow):</p>
<pre class="brush: plain; title: ; notranslate">
SELECT /*+ ORDERED */
  DE.BLOCK_ID+C.COUNTER BLOCK_ID,
  TO_CHAR(DE.BLOCK_ID+C.COUNTER,'XXXXXXXX') HEX_BLOCK_ID,
  DE.BLOCKS,
  C.COUNTER+1 COUNTER
FROM
  (SELECT
    BLOCK_ID,
    BLOCKS
  FROM
    DBA_EXTENTS
  WHERE
    OWNER=USER
    AND SEGMENT_NAME IN ('T1')) DE,
  (SELECT
    ROWNUM-1 COUNTER
  FROM
    DUAL
  CONNECT BY
    LEVEL&lt;=64) C
WHERE
  DE.BLOCKS&gt;C.COUNTER
ORDER BY
  C.COUNTER;
 
  BLOCK_ID HEX_BLOCK     BLOCKS    COUNTER
---------- --------- ---------- ----------
   1093129    10AE09          8          1
   1093130    10AE0A          8          2
   1093131    10AE0B          8          3
   1093132    10AE0C          8          4
   1093133    10AE0D          8          5
   1093134    10AE0E          8          6
   1093135    10AE0F          8          7
   1093136    10AE10          8          8
</pre>
<p>So, during the full table scan, Oracle read blocks 4, 5, 6, 7, and 8 &#8211; for a total of 5 logical IO blocks reads.  But, the DBMS_XPLAN output clearly showed that were 7 logical IO blocks read, so what about the other two logical IOs.  I suppose that there is another event that needs to be set to see those logical IOs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Taral Desai</title>
		<link>http://hoopercharles.wordpress.com/2010/01/21/how-many-topics-can-be-packed-into-a-short-otn-thread/#comment-223</link>
		<dc:creator><![CDATA[Taral Desai]]></dc:creator>
		<pubDate>Thu, 21 Jan 2010 06:44:14 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=934#comment-223</guid>
		<description><![CDATA[Hi Charles,

It&#039;s very interesting one. Also, can you please elaborate if possible from Jonathan post saying

&quot; through the index, you will hit the root block of the index one, and the table block once for a total of 2 LIOs. If you do a tablescan you will access the segment header block twice (9i onwards) and the table block once for a total of 3 LIO&quot;

1. Table scan will access segment block twice . How can we arrive at this number any proof

2. So, does this means that ever block access has 3 LIO for table.

3. If i am understanding right then for Index range scan it will hit root + branch + blevel (total 3 LIO) for ever scan.(every value scan)  any example]]></description>
		<content:encoded><![CDATA[<p>Hi Charles,</p>
<p>It&#8217;s very interesting one. Also, can you please elaborate if possible from Jonathan post saying</p>
<p>&#8221; through the index, you will hit the root block of the index one, and the table block once for a total of 2 LIOs. If you do a tablescan you will access the segment header block twice (9i onwards) and the table block once for a total of 3 LIO&#8221;</p>
<p>1. Table scan will access segment block twice . How can we arrive at this number any proof</p>
<p>2. So, does this means that ever block access has 3 LIO for table.</p>
<p>3. If i am understanding right then for Index range scan it will hit root + branch + blevel (total 3 LIO) for ever scan.(every value scan)  any example</p>
]]></content:encoded>
	</item>
</channel>
</rss>
