<?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: OC 5 Caches and Copies</title>
	<atom:link href="http://jonathanlewis.wordpress.com/oracle-core/oc-5-caches-and-copies/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Thu, 23 May 2013 12:47:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Martin</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-5-caches-and-copies/#comment-54149</link>
		<dc:creator><![CDATA[Martin]]></dc:creator>
		<pubDate>Sat, 16 Mar 2013 10:49:57 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7141#comment-54149</guid>
		<description><![CDATA[Hello Jonathan,

Thank you for your reply. What is the benefit of this processing? 
You need to find an available buffer, link it into the appropriate hash buffer chain, do the actual cloning (memory copy), and potentially exchange the old buffer on the checkpoint queue with the new current buffer (as described in chapter 6, page 140) - i.e. quite some additional work. On top of it this makes the hash buffer chains longer (because there is an additional copy of the same data block, which might never be used again) and it requires additional space in the buffer cache.
On the plus side I only see that other sessions that need a CR copy with a target SCN prior to the modification can access the old buffer, rather than having to create a CR copy by themselves. Is this the entire justification for the &quot;switch current to new buffer&quot; mechanism or are there any additional benefits?

thank you
kind regards
Martin]]></description>
		<content:encoded><![CDATA[<p>Hello Jonathan,</p>
<p>Thank you for your reply. What is the benefit of this processing?<br />
You need to find an available buffer, link it into the appropriate hash buffer chain, do the actual cloning (memory copy), and potentially exchange the old buffer on the checkpoint queue with the new current buffer (as described in chapter 6, page 140) &#8211; i.e. quite some additional work. On top of it this makes the hash buffer chains longer (because there is an additional copy of the same data block, which might never be used again) and it requires additional space in the buffer cache.<br />
On the plus side I only see that other sessions that need a CR copy with a target SCN prior to the modification can access the old buffer, rather than having to create a CR copy by themselves. Is this the entire justification for the &#8220;switch current to new buffer&#8221; mechanism or are there any additional benefits?</p>
<p>thank you<br />
kind regards<br />
Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-5-caches-and-copies/#comment-54038</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Sun, 10 Mar 2013 13:32:16 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7141#comment-54038</guid>
		<description><![CDATA[Sid,

I&#039;ve just been re-reading these comments and realised I misunderstood what you were saying. It is just a simple error (which I&#039;ve now added to the Errata) in the Note at the top of page 107. It should say &quot;changes the touch count on that buffer to one.&quot;]]></description>
		<content:encoded><![CDATA[<p>Sid,</p>
<p>I&#8217;ve just been re-reading these comments and realised I misunderstood what you were saying. It is just a simple error (which I&#8217;ve now added to the Errata) in the Note at the top of page 107. It should say &#8220;changes the touch count on that buffer to one.&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-5-caches-and-copies/#comment-53241</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Mon, 28 Jan 2013 19:54:35 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7141#comment-53241</guid>
		<description><![CDATA[Martin,

i) &amp; ii) I had to go back and read some old test scripts to check - and they say that the tch is not set (i.e. starts at zero) in 8i and 9i for tables less than 2% of the cache size, and that the blocks were loaded to the midpoint.

iiI) There is a bitmapped FLAGS column on the buffer header, and bit 19 is named &quot;only_sequential_read&quot;. This is set if the table was subject to a full tablescan. I have always assumed that this is what stopped subsequent buffer accesses from incrementing the tch.

iv) good question - it got a lot more complicated in recent versions - I suspect in the older versions when we said &quot;dropped to the end of the LRU&quot; we should have been saying &quot;transferred to the repl_aux&quot;.  Have you read the investigation into &quot;small&quot; tables I did a couple of years ago ? http://jonathanlewis.wordpress.com/2011/03/24/small-tables/]]></description>
		<content:encoded><![CDATA[<p>Martin,</p>
<p>i) &amp; ii) I had to go back and read some old test scripts to check &#8211; and they say that the tch is not set (i.e. starts at zero) in 8i and 9i for tables less than 2% of the cache size, and that the blocks were loaded to the midpoint.</p>
<p>iiI) There is a bitmapped FLAGS column on the buffer header, and bit 19 is named &#8220;only_sequential_read&#8221;. This is set if the table was subject to a full tablescan. I have always assumed that this is what stopped subsequent buffer accesses from incrementing the tch.</p>
<p>iv) good question &#8211; it got a lot more complicated in recent versions &#8211; I suspect in the older versions when we said &#8220;dropped to the end of the LRU&#8221; we should have been saying &#8220;transferred to the repl_aux&#8221;.  Have you read the investigation into &#8220;small&#8221; tables I did a couple of years ago ? <a href="http://jonathanlewis.wordpress.com/2011/03/24/small-tables/" rel="nofollow">http://jonathanlewis.wordpress.com/2011/03/24/small-tables/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-5-caches-and-copies/#comment-53238</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Mon, 28 Jan 2013 18:34:11 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7141#comment-53238</guid>
		<description><![CDATA[Martin,

Thanks for the reference.]]></description>
		<content:encoded><![CDATA[<p>Martin,</p>
<p>Thanks for the reference.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-5-caches-and-copies/#comment-53237</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Mon, 28 Jan 2013 18:33:43 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7141#comment-53237</guid>
		<description><![CDATA[Martin,

I don&#039;t think there&#039;s a lot to be said about this mechanism.

Basically a session may clone a CUR buffer before modifying it. The previous CUR copy is switched to CR as this takes place. The easiest way to see this is create a table with a few hundred block then update a few rows in the table by tablescan; each time you do the update you&#039;ll see that the blocks you&#039;ve updated are cloned before the update is applied.]]></description>
		<content:encoded><![CDATA[<p>Martin,</p>
<p>I don&#8217;t think there&#8217;s a lot to be said about this mechanism.</p>
<p>Basically a session may clone a CUR buffer before modifying it. The previous CUR copy is switched to CR as this takes place. The easiest way to see this is create a table with a few hundred block then update a few rows in the table by tablescan; each time you do the update you&#8217;ll see that the blocks you&#8217;ve updated are cloned before the update is applied.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-5-caches-and-copies/#comment-53236</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Mon, 28 Jan 2013 18:21:58 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7141#comment-53236</guid>
		<description><![CDATA[Martin,
I think you&#039;ve covered most of the points.

There is also the detail that the examination is attempted only if Oracle thinks that it is likely to be completed in a short time. For example when accessing an undo block to find an undo record, evey detail about where that record will be is fixed and there&#039;s no chance Oracle will have to do the equivalent of something like a block cleanout to find the right version of the record. 

Essentially, it probably comes down to a trade-off between the time it takes to create, attach and subsequently release a pin, compared to the time it will probably take to locate and extract the correct piece of information from the block.]]></description>
		<content:encoded><![CDATA[<p>Martin,<br />
I think you&#8217;ve covered most of the points.</p>
<p>There is also the detail that the examination is attempted only if Oracle thinks that it is likely to be completed in a short time. For example when accessing an undo block to find an undo record, evey detail about where that record will be is fixed and there&#8217;s no chance Oracle will have to do the equivalent of something like a block cleanout to find the right version of the record. </p>
<p>Essentially, it probably comes down to a trade-off between the time it takes to create, attach and subsequently release a pin, compared to the time it will probably take to locate and extract the correct piece of information from the block.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Maletinsky</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-5-caches-and-copies/#comment-53142</link>
		<dc:creator><![CDATA[Martin Maletinsky]]></dc:creator>
		<pubDate>Wed, 23 Jan 2013 21:50:14 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7141#comment-53142</guid>
		<description><![CDATA[Hello Jonathan,

I have some questions regarding the &quot;Tablescans&quot; section at the end of chapter 5.

When you describe the 8i and 9i strategy for &quot;small tables&quot;, you say the reads during scans of small tables were treated just as other reads but the touch count was not incremented when reading the blocks (nor during subsequent visits). This leads me to the following questions:
i) Is a newly read buffer linked at the midpoint into REPL_MAIN (i.e. at the location pointed to by cold_hd) as with other reads? 
ii) In the &quot;LRU/TCH&quot; section starting on page 104 you don&#039;t mention that the touch count is incremented for blocks that are (normally) read into the cache and linked at the midpoint into REPL_MAIN. Rather the touch count is set to 1 for these blocks. So what does it mean when you say that the touch count is not incremented for blocks read during a full scan of a small table - is the touch count set to 0?
iii) How does Oracle ensure that the touch count of blocks read during a full scan of a small table is not incremented during subsequent visits? Is there a flag on the buffer preventing such increments or is it maybe the touch count value 0 that indicates the block was read in by a full scan of a small table (see my guess in question ii).

vi) When you write &quot;...the table was larger than the 2 percent limit, then the buffers used to read the table were immediately dropped to the end of the LRU list..&quot;, does &quot;end of the LRU list&quot; mean REPL_AUX in this context, or the LRU end of REPL_MAIN?

thank you
kind regards
Martin]]></description>
		<content:encoded><![CDATA[<p>Hello Jonathan,</p>
<p>I have some questions regarding the &#8220;Tablescans&#8221; section at the end of chapter 5.</p>
<p>When you describe the 8i and 9i strategy for &#8220;small tables&#8221;, you say the reads during scans of small tables were treated just as other reads but the touch count was not incremented when reading the blocks (nor during subsequent visits). This leads me to the following questions:<br />
i) Is a newly read buffer linked at the midpoint into REPL_MAIN (i.e. at the location pointed to by cold_hd) as with other reads?<br />
ii) In the &#8220;LRU/TCH&#8221; section starting on page 104 you don&#8217;t mention that the touch count is incremented for blocks that are (normally) read into the cache and linked at the midpoint into REPL_MAIN. Rather the touch count is set to 1 for these blocks. So what does it mean when you say that the touch count is not incremented for blocks read during a full scan of a small table &#8211; is the touch count set to 0?<br />
iii) How does Oracle ensure that the touch count of blocks read during a full scan of a small table is not incremented during subsequent visits? Is there a flag on the buffer preventing such increments or is it maybe the touch count value 0 that indicates the block was read in by a full scan of a small table (see my guess in question ii).</p>
<p>vi) When you write &#8220;&#8230;the table was larger than the 2 percent limit, then the buffers used to read the table were immediately dropped to the end of the LRU list..&#8221;, does &#8220;end of the LRU list&#8221; mean REPL_AUX in this context, or the LRU end of REPL_MAIN?</p>
<p>thank you<br />
kind regards<br />
Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Maletinsky</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-5-caches-and-copies/#comment-53139</link>
		<dc:creator><![CDATA[Martin Maletinsky]]></dc:creator>
		<pubDate>Wed, 23 Jan 2013 19:16:53 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7141#comment-53139</guid>
		<description><![CDATA[Hello,

I found the note on top of page 115 a bit short and didn&#039;t fully understand what it was saying. When browsing Internet to find some clarification I came across the following blog that Jonathan has written and which helped me to fully understand the note. I just post the link here in the hope it may be useful to other readers.
http://www.jlcomp.demon.co.uk/buffer_handles.html

kind regards
Martin]]></description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>I found the note on top of page 115 a bit short and didn&#8217;t fully understand what it was saying. When browsing Internet to find some clarification I came across the following blog that Jonathan has written and which helped me to fully understand the note. I just post the link here in the hope it may be useful to other readers.<br />
<a href="http://www.jlcomp.demon.co.uk/buffer_handles.html" rel="nofollow">http://www.jlcomp.demon.co.uk/buffer_handles.html</a></p>
<p>kind regards<br />
Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Maletinsky</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-5-caches-and-copies/#comment-53123</link>
		<dc:creator><![CDATA[Martin Maletinsky]]></dc:creator>
		<pubDate>Tue, 22 Jan 2013 21:04:58 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7141#comment-53123</guid>
		<description><![CDATA[Hello Jonathan,

On page 115 you mention that Oracle does &quot;switch current to new buffer&quot; and you mention this mechanism again on page 116. Could you please briefly sketch what this mechanism is about or give a link where it is documented?

thanks a lot
kind regards
Martin]]></description>
		<content:encoded><![CDATA[<p>Hello Jonathan,</p>
<p>On page 115 you mention that Oracle does &#8220;switch current to new buffer&#8221; and you mention this mechanism again on page 116. Could you please briefly sketch what this mechanism is about or give a link where it is documented?</p>
<p>thanks a lot<br />
kind regards<br />
Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Maletinsky</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-5-caches-and-copies/#comment-53121</link>
		<dc:creator><![CDATA[Martin Maletinsky]]></dc:creator>
		<pubDate>Tue, 22 Jan 2013 20:58:23 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7141#comment-53121</guid>
		<description><![CDATA[Hello Jonathan,

When reading your comment on consistent gets - examination on page 114, two questions came into my mind. I have a hypothesis on the answer and I&#039;d appreciate if you could confirm my hypothesis or tell me why I am wrong.
i) What qualifies a logical read to be done at &quot;half-price&quot;, i.e. with only one latch get and without pinning the buffer?
ii) How does Oracle ensure there is no concurrent modification of the buffer while it is being read with a &quot;half-price&quot; logical IO, i.e. not protected by a pin? Concurrent modification of the buffer while it is being read might provide the reader with an inconsistent view of the buffer content (it might see only part of the modifications made to the buffer).

I believe the answer to the two questions is as follows, but I haven&#039;t verified it with any tests:
When Oracle expects that inspection of the buffer content can be completed within a short time, it does this inspection under protection of the cache buffers chains latch protecting the hash chain the buffer is currently linked on. I.e. after finding the buffer and while holding the cache buffers chains latch, Oracle checks that no exclusive pin is attached to the buffer. If this check succeeds, Oracle will inspect the content of the buffer (while still holding the cache buffers chains latch) and release the cache buffers chains latch, once the inspection of the buffer content is completed.
A separate code path must exist to handle the case where the buffer is pinned exclusively and thus may be subject to ongoing modifications - it doesn&#039;t seem unreasonable to me to assume that Oracle will fall back to the ordinary logical IO in this case, ie. attach a shared pin to the waiters list of the buffer and wait for the exclusive pin to be released.

thank you for reviewing this statement
kind regards
Martin]]></description>
		<content:encoded><![CDATA[<p>Hello Jonathan,</p>
<p>When reading your comment on consistent gets &#8211; examination on page 114, two questions came into my mind. I have a hypothesis on the answer and I&#8217;d appreciate if you could confirm my hypothesis or tell me why I am wrong.<br />
i) What qualifies a logical read to be done at &#8220;half-price&#8221;, i.e. with only one latch get and without pinning the buffer?<br />
ii) How does Oracle ensure there is no concurrent modification of the buffer while it is being read with a &#8220;half-price&#8221; logical IO, i.e. not protected by a pin? Concurrent modification of the buffer while it is being read might provide the reader with an inconsistent view of the buffer content (it might see only part of the modifications made to the buffer).</p>
<p>I believe the answer to the two questions is as follows, but I haven&#8217;t verified it with any tests:<br />
When Oracle expects that inspection of the buffer content can be completed within a short time, it does this inspection under protection of the cache buffers chains latch protecting the hash chain the buffer is currently linked on. I.e. after finding the buffer and while holding the cache buffers chains latch, Oracle checks that no exclusive pin is attached to the buffer. If this check succeeds, Oracle will inspect the content of the buffer (while still holding the cache buffers chains latch) and release the cache buffers chains latch, once the inspection of the buffer content is completed.<br />
A separate code path must exist to handle the case where the buffer is pinned exclusively and thus may be subject to ongoing modifications &#8211; it doesn&#8217;t seem unreasonable to me to assume that Oracle will fall back to the ordinary logical IO in this case, ie. attach a shared pin to the waiters list of the buffer and wait for the exclusive pin to be released.</p>
<p>thank you for reviewing this statement<br />
kind regards<br />
Martin</p>
]]></content:encoded>
	</item>
</channel>
</rss>
