<?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; 11G</title>
	<atom:link href="http://www.os2ora.com/tag/11g/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>cardinality feedback</title>
		<link>http://www.os2ora.com/cardinality-feedback/</link>
		<comments>http://www.os2ora.com/cardinality-feedback/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 02:55:51 +0000</pubDate>
		<dc:creator>Kaya</dc:creator>
				<category><![CDATA[数据库性能调优]]></category>
		<category><![CDATA[11G]]></category>
		<category><![CDATA[cardinality feedback]]></category>
		<category><![CDATA[Tunning]]></category>

		<guid isPermaLink="false">http://www.os2ora.com/cardinality-feedback/</guid>
		<description><![CDATA[到了10g的时代，cardinality feedback这个词正在变得越来越流行。我想，开始导致这个词流行的或许不是来自Oracle官方的推广，而是来自Wolfgang Breitling在Hotsos Symposium 2006上的一个演讲。
到了11g，Oracle有个new feature就叫做cardinality feedback...]]></description>
			<content:encoded><![CDATA[<p><span class="Apple-style-span" style="word-spacing: 0px; font: medium simsun; text-transform: none; color: rgb(0,0,0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span class="Apple-style-span" style="font-size: 12px; color: rgb(85,85,85); font-family: verdana, &#39;BitStream vera Sans&#39;, helvetica, sans-serif; text-align: left">Kaya 发表于<span class="Apple-converted-space">&#160;</span><a style="font-weight: bold; color: rgb(102,102,102); text-decoration: underline" href="http://www.os2ora.com/">os2ora.com</a></span></span></p>
<p><span class="Apple-style-span" style="word-spacing: 0px; font: medium simsun; text-transform: none; color: rgb(0,0,0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span class="Apple-style-span" style="font-size: 12px; color: rgb(85,85,85); font-family: verdana, &#39;BitStream vera Sans&#39;, helvetica, sans-serif; text-align: left">到了10g的时代，cardinality feedback这个词正在变得越来越流行。我想，开始导致这个词流行的或许不是来自Oracle官方的推广，而是来自Wolfgang Breitling在<a href="https://portal.hotsos.com/events/SYM06">Hotsos Symposium 2006</a>上的一个演讲: </span></span>Tuning by Cardinality Feedback: Method and Examples. 从作者的网站有下面的信息:</p>
<blockquote><p><b>Tuning by Cardinality Feedback</b></p>
<p>Tuning by cardinality feedback looks at discrepancies between estimated and real row source cardinalities of an execution plan and attempts to find ways to correct the CBO’s error in estimation and trusting it to find a better plan based on the corrected, more accurate estimates.</p>
<p>Faced with an underperforming SQL, the question the TCF method is trying to answer is not      <br />&#160;&#160;&#160; What would be a better access plan?       <br />But instead       <br />&#160;&#160;&#160; Why is this plan, which the CBO chose as optimal, performing so poorly?</p>
<p>Once the answer to that question is found, the next goal is to find a way to remedy the cause for the miscalculation, but ultimately get out of the way and let the CBO do its job again.</p>
<p>The presentation was given at the 2006 Hotsos Symposium on Oracle® System Performance March 5–9, 2006 in Dallas, Texas and at CBO Days June 21-22 in Zurich, Switzerland.</p>
<p><a href="http://www.centrexcc.com/Tuning%20by%20Cardinality%20Feedback.pdf">Paper</a>&#160; <a href="http://www.centrexcc.com/Tuning%20by%20Cardinality%20Feedback.ppt.pdf">Presentation</a></p>
</blockquote>
<p>这种方法，也是我们平常调优SQL的最主要方法。虽然以前没有专门介绍过，不过有一些文章还是偶尔提及的，例如这篇: <a href="http://www.os2ora.com/fantastic-11gr2-sql-monitor-report/">11gR2出色的SQL Monitor Report</a>, 提到了用SQL Monitor Report查看actual rows与estimate rows的方法。</p>
<p>网上的另一个介绍cardinality feedback的演讲可以参考这一篇，<a href="http://jonathanlewis.wordpress.com/2009/05/11/cardinality-feedback/">http://jonathanlewis.wordpress.com/2009/05/11/cardinality-feedback/</a>,作者是<span class="Apple-style-span" style="word-spacing: 0px; font: medium simsun; text-transform: none; color: rgb(0,0,0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span class="Apple-style-span" style="font-size: 13px; line-height: 21px; font-family: verdana, tahoma, arial, sans-serif"><strong><em>Michelle Deng，</em></strong><strong><em>Sanofi Aventis.</em></strong><font color="#555555" size="2">注意这里已经是2009年的事情了。</font></span></span></p>
<p>看看Oracle内部开发人员的演讲吧，这是VLDB 2008上的一个演讲.</p>
<p>Allison W. Lee, Mohamed Zaït: Closing the query processing loop in Oracle 11g: <a href="http://www.vldb.org/pvldb/1/1454178.pdf">Paper</a>, <a href="https://www.se.auckland.ac.nz/conferences/VLDB2008resources/presentations/papers/I14.ppt">Presentation</a></p>
<p>这俨然成为了11g的一个new feature，如何你手头有Oracle 11g，你甚至现在就可以演练一下。</p>
<p>下面是一个用到了cardinality feedback的执行计划，注意最后一行: cardinality feedback used for this statement</p>
<p>&#160;</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">---------------------------------------------------------------------------------------------------------------</span>
<span style="color: #66cc66;">|</span> Id  <span style="color: #66cc66;">|</span> Operation                      <span style="color: #66cc66;">|</span> Name                         <span style="color: #66cc66;">|</span> Rows  <span style="color: #66cc66;">|</span> Bytes <span style="color: #66cc66;">|</span> Cost <span style="color: #66cc66;">&#40;</span>%CPU<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">|</span> Time     <span style="color: #66cc66;">|</span>
<span style="color: #808080; font-style: italic;">---------------------------------------------------------------------------------------------------------------</span>
<span style="color: #66cc66;">|</span>   <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">|</span> <span style="color: #993333; font-weight: bold;">SELECT</span> STATEMENT               <span style="color: #66cc66;">|</span>                              <span style="color: #66cc66;">|</span>       <span style="color: #66cc66;">|</span>       <span style="color: #66cc66;">|</span> <span style="color: #cc66cc;">98089</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">|</span>          <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">|</span>   <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">|</span>  SORT <span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span>                 <span style="color: #66cc66;">|</span>                              <span style="color: #66cc66;">|</span>     <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">|</span>    <span style="color: #cc66cc;">97</span> <span style="color: #66cc66;">|</span> <span style="color: #cc66cc;">98089</span>   <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">|</span> 00:<span style="color: #cc66cc;">19</span>:<span style="color: #cc66cc;">38</span> <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">|*</span>  <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">|</span>   HASH <span style="color: #993333; font-weight: bold;">JOIN</span>                    <span style="color: #66cc66;">|</span>                              <span style="color: #66cc66;">|</span>     <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">|</span>    <span style="color: #cc66cc;">97</span> <span style="color: #66cc66;">|</span> <span style="color: #cc66cc;">98088</span>   <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">|</span> 00:<span style="color: #cc66cc;">19</span>:<span style="color: #cc66cc;">38</span> <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">|</span>   <span style="color: #cc66cc;">3</span> <span style="color: #66cc66;">|</span>    <span style="color: #993333; font-weight: bold;">VIEW</span>                        <span style="color: #66cc66;">|</span> VW_NSO_1                     <span style="color: #66cc66;">|</span>     <span style="color: #cc66cc;">4</span> <span style="color: #66cc66;">|</span>    <span style="color: #cc66cc;">36</span> <span style="color: #66cc66;">|</span> <span style="color: #cc66cc;">47108</span>   <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">|</span> 00:09:<span style="color: #cc66cc;">26</span> <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">|</span>   <span style="color: #cc66cc;">4</span> <span style="color: #66cc66;">|</span>     SORT <span style="color: #993333; font-weight: bold;">UNIQUE</span>                <span style="color: #66cc66;">|</span>                              <span style="color: #66cc66;">|</span>     <span style="color: #cc66cc;">4</span> <span style="color: #66cc66;">|</span>   <span style="color: #cc66cc;">148</span> <span style="color: #66cc66;">|</span> <span style="color: #cc66cc;">47108</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">51</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">|</span> 00:09:<span style="color: #cc66cc;">26</span> <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">|</span>   <span style="color: #cc66cc;">5</span> <span style="color: #66cc66;">|</span>      UNION<span style="color: #66cc66;">-</span><span style="color: #993333; font-weight: bold;">ALL</span>                 <span style="color: #66cc66;">|</span>                              <span style="color: #66cc66;">|</span>       <span style="color: #66cc66;">|</span>       <span style="color: #66cc66;">|</span>            <span style="color: #66cc66;">|</span>          <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">|*</span>  <span style="color: #cc66cc;">6</span> <span style="color: #66cc66;">|</span>       <span style="color: #993333; font-weight: bold;">TABLE</span> ACCESS STORAGE <span style="color: #993333; font-weight: bold;">FULL</span><span style="color: #66cc66;">|</span> TA                           <span style="color: #66cc66;">|</span>     <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">|</span>    <span style="color: #cc66cc;">62</span> <span style="color: #66cc66;">|</span> <span style="color: #cc66cc;">23549</span>   <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">|</span> 00:04:<span style="color: #cc66cc;">43</span> <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">|*</span>  <span style="color: #cc66cc;">7</span> <span style="color: #66cc66;">|</span>       <span style="color: #993333; font-weight: bold;">TABLE</span> ACCESS STORAGE <span style="color: #993333; font-weight: bold;">FULL</span><span style="color: #66cc66;">|</span> TA                           <span style="color: #66cc66;">|</span>     <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">|</span>    <span style="color: #cc66cc;">86</span> <span style="color: #66cc66;">|</span> <span style="color: #cc66cc;">23558</span>   <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">|</span> 00:04:<span style="color: #cc66cc;">43</span> <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">|*</span>  <span style="color: #cc66cc;">8</span> <span style="color: #66cc66;">|</span>    <span style="color: #993333; font-weight: bold;">TABLE</span> ACCESS STORAGE <span style="color: #993333; font-weight: bold;">FULL</span>   <span style="color: #66cc66;">|</span> TB                           <span style="color: #66cc66;">|</span>   469K<span style="color: #66cc66;">|</span>    39M<span style="color: #66cc66;">|</span> <span style="color: #cc66cc;">50978</span>   <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">|</span> 00:<span style="color: #cc66cc;">10</span>:<span style="color: #cc66cc;">12</span> <span style="color: #66cc66;">|</span>
<span style="color: #808080; font-style: italic;">---------------------------------------------------------------------------------------------------------------</span>
&nbsp;
<span style="color: #66cc66;">....</span>
&nbsp;
Note
<span style="color: #808080; font-style: italic;">-----</span>
   <span style="color: #66cc66;">-</span> cardinality feedback used <span style="color: #993333; font-weight: bold;">FOR</span> this statement</pre></div></div>

<p>可以google下”<a href="http://www.google.com/search?q=%2B%22cardinality+feedback+used+for+this+statement%22+%2Boracle">cardinality feedback</a>”。会有人其它人的演练报告。</p>
<p>想想吧，以后的DBA，回顾这段历史，想想以前的人们如何用手工的方法用cardinality feedback 进行调优，是不是会和我们现在想着过去人们如何用手工方法进行space management, memory management的场景类似？ evolving, evolving, evolving…</p>
]]></content:encoded>
			<wfw:commentRss>http://www.os2ora.com/cardinality-feedback/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>
		<item>
		<title>11G, 一个注定疯狂的时代</title>
		<link>http://www.os2ora.com/11g-a-crazy-time-is-coming/</link>
		<comments>http://www.os2ora.com/11g-a-crazy-time-is-coming/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 06:03:06 +0000</pubDate>
		<dc:creator>Kaya</dc:creator>
				<category><![CDATA[Exadata]]></category>
		<category><![CDATA[数据库性能调优]]></category>
		<category><![CDATA[11G]]></category>
		<category><![CDATA[auto DoP]]></category>
		<category><![CDATA[Hybrid Columnar Compression]]></category>
		<category><![CDATA[new feature]]></category>
		<category><![CDATA[Statement Queue]]></category>
		<category><![CDATA[Storage Index]]></category>

		<guid isPermaLink="false">http://www.os2ora.com/11g-a-crazy-time-is-coming/</guid>
		<description><![CDATA[在10G, Oracle已经有了Database Resource Manager，在数据仓库中，有两个系统资源非常重要，它们可以通过DBRM进行控制，它们就是Active Sessions和DoP(Degree of Parallelism)。一般而言，不同的工作负载会有一个最优的Active Sessions和DoP。甚至于有时必须对工作负载再进行细分，分别应用不同的策略(active sessions + DoP)。这有时是一个烦琐的调优过程。

在即将到来的11G中，有两个新的特性，Auto DoP和Statement Queuing机制。相信对上面的DBRM会带来一定的冲击。

“Storage Index”，对Oracle中已有的Index大家耳熟能详，B-Tree Index, Bitmap Index。这些都是基于行的，有没基于更大的存贮单元的呢？例如1M的存贮区域？Storage Index来了，这以于Cluster的列而说，pruning功能会使一个查询提高成千上万倍。这可能又是一个后来者居上的特性。

“Hybrid Columnar Compression”, 不甘落后的，又一个Oracle新引入的技术。对于数据仓库查询这无疑是天大的福音。

还有很多很多……

就让我们一起疯狂吧......]]></description>
			<content:encoded><![CDATA[<p>Kaya 发表于 <a href="http://www.os2ora.com">os2ora.com</a></p>
<p>在10G, Oracle已经有了Database Resource Manager，在数据仓库中，有两个系统资源非常重要，它们可以通过DBRM进行控制，它们就是Active Sessions和DoP(Degree of Parallelism)。一般而言，不同的工作负载会有一个最优的Active Sessions和DoP。甚至于有时必须对工作负载再进行细分，分别应用不同的策略(active sessions + DoP)。这有时是一个烦琐的调优过程。</p>
<p>在即将到来的11G中，有两个新的特性，Auto DoP和Statement Queuing机制。相信对上面的DBRM会带来一定的冲击。</p>
<p>“Storage Index”，对Oracle中已有的Index大家耳熟能详，B-Tree Index, Bitmap Index。这些都是基于行的，有没基于更大的存贮单元的呢？例如1M的存贮区域？Storage Index来了，这以于Cluster的列而说，pruning功能会使一个查询提高成千上万倍。这可能又是一个后来者居上的特性。</p>
<p>“Hybrid Columnar Compression”, 不甘落后的，又一个Oracle新引入的技术。对于数据仓库查询这无疑是天大的福音。</p>
<p>还有很多很多……</p>
<p>就让我们一起疯狂吧!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.os2ora.com/11g-a-crazy-time-is-coming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

