<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OS与Oracle &#187; _small_table_threshold</title>
	<atom:link href="http://www.os2ora.com/tag/_small_table_threshold/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.os2ora.com</link>
	<description>专注于现实世界Oracle数据库的高性能，高可扩展性与新一代数据库Exadata架构</description>
	<lastBuildDate>Mon, 19 Sep 2011 09:10:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>11g新特性: OLTP中的Adaptive Direct Read算法</title>
		<link>http://www.os2ora.com/11g-new-feature-adaptive-direct-read/</link>
		<comments>http://www.os2ora.com/11g-new-feature-adaptive-direct-read/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 07:17:45 +0000</pubDate>
		<dc:creator>Kaya</dc:creator>
				<category><![CDATA[Exadata]]></category>
		<category><![CDATA[数据库性能调优]]></category>
		<category><![CDATA[11G]]></category>
		<category><![CDATA[Adaptive Direct Read]]></category>
		<category><![CDATA[Smart Scan]]></category>
		<category><![CDATA[_serial_direct_read]]></category>
		<category><![CDATA[_small_table_threshold]]></category>

		<guid isPermaLink="false">http://www.os2ora.com/11g-new-feature-adaptive-direct-read/</guid>
		<description><![CDATA[direct read是直接把数据块读到PGA的一种操作，在并行查询中这是唯一的模式。这明显地区别于非并行查询把数据块读到SGA的做法。读到SGA的目的主要是为了共享，这特别适用于OLTP场合。不过，与此同时，访问SGA会引入更多的latch等待，例如cache buffer chains, cache buffer lru等等。

在非并行查询中也可以使用direct read，可以通过一个隐含参数_serial_direct_read进行设置。

值得注意，_serial_direct_read对解析过程起作用，这意味着为了使_serial_direct_read对当前运行中的SQL起作用，我们必须先flush当前的shared_pool。

11g中，Oracle有了一个自适应的算法决定是否对serial execution启用direct read。不过，这是在运行时才决定的。它取决于多个统计信息，例如当前buffer cache的大小，_small_table_threshold的大小，当前dirty blocks还占的比例等等。因此，即使在11g中_serial_direct_read的值为false，serial direct read也可能起作用。这个算法其实就叫做Adaptive Direct Read.......]]></description>
			<content:encoded><![CDATA[<p>Kaya 发表于 <a href="http://www.os2ora.com">os2ora.com</a></p>
<p>direct read是直接把数据块读到PGA的一种操作，在并行查询中这是唯一的模式。这明显地区别于非并行查询把数据块读到SGA的做法。读到SGA的目的主要是为了共享，这特别适用于OLTP场合。不过，与此同时，访问SGA会引入更多的latch等待，例如cache buffer chains, cache buffer lru等等。</p>
<p>在非并行查询中也可以使用direct read，可以通过一个隐含参数_serial_direct_read进行设置。</p>
<p>值得注意，_serial_direct_read对解析过程起作用，这意味着为了使_serial_direct_read对当前运行中的SQL起作用，我们必须先flush当前的shared_pool。</p>
<p>11g中，Oracle有了一个自适应的算法决定是否对serial execution启用direct read。不过，这是在运行时才决定的。它取决于多个统计信息，例如当前buffer cache的大小，_small_table_threshold的大小，当前dirty blocks还占的比例等等。因此，即使在11g中_serial_direct_read的值为false，serial direct read也可能起作用。这个算法其实就叫做Adaptive Direct Read.</p>
<p>下面是两个模式对资源的利用情况对比:</p>
<table border="1" cellspacing="0" cellpadding="2" width="570">
<tbody>
<tr>
<td width="190" valign="top"> </td>
<td width="173" valign="top">direct read</td>
<td width="205" valign="top">traditional way</td>
</tr>
<tr>
<td width="190" valign="top">consistent gets</td>
<td width="173" valign="top">80,577</td>
<td width="205" valign="top">80,589</td>
</tr>
<tr>
<td width="190" valign="top">physical reads direct</td>
<td width="173" valign="top">80,498</td>
<td width="205" valign="top">0</td>
</tr>
<tr>
<td width="190" valign="top">cache buffers chains</td>
<td width="173" valign="top">395</td>
<td width="205" valign="top">161,029</td>
</tr>
<tr>
<td width="190" valign="top">wait events</td>
<td width="173" valign="top">&#8216;cell smart table scan’</td>
<td width="205" valign="top">&#8216;cell multiblock physical read&#8217;<br />
&#8216;gc cr multi block request’</td>
</tr>
</tbody>
</table>
<p>当使用direct read时，cache buffers chains明显减少，但物理读每次都保持恒定。对于传统方法，物理读只发生在第一次执行时。</p>
<p>对于等待事件也有所不同，direct read的等待事件是&#8217;cell smart table scan’，而非direct read的等待事件是&#8217;cell multiblock physical read&#8217;。这体现出Exadata的独有的优势: direct read可以利用Exadata的smart scan功能，从而实现把DB节点的CPU负载offload到存贮节点上。</p>
<p>一些Tips:</p>
<p>利用下面这个event 可以disable 这个特性:</p>
<pre lang="”SQL”">alter session set events '10949 trace name context forever, level 1';</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.os2ora.com/11g-new-feature-adaptive-direct-read/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

