
<?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/"
	
	>
<channel>
	<title>
	《怪异的SQL执行计划》的评论	</title>
	<atom:link href="http://www.killdb.com/2014/10/20/%E6%80%AA%E5%BC%82%E7%9A%84sql%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.killdb.com/2014/10/20/%e6%80%aa%e5%bc%82%e7%9a%84sql%e6%89%a7%e8%a1%8c%e8%ae%a1%e5%88%92/</link>
	<description>Phone:18180207355 提供专业Oracle/MySQL/PostgreSQL数据恢复、性能优化、迁移升级、紧急救援等服务</description>
	<lastBuildDate>Sun, 11 Jan 2015 04:43:00 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.3.18</generator>
			<item>
				<title>
				作者：敬勇				</title>
				<link>http://www.killdb.com/2014/10/20/%e6%80%aa%e5%bc%82%e7%9a%84sql%e6%89%a7%e8%a1%8c%e8%ae%a1%e5%88%92/#comment-1479</link>
		<dc:creator><![CDATA[敬勇]]></dc:creator>
		<pubDate>Sun, 11 Jan 2015 04:43:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.killdb.com/?p=2417#comment-1479</guid>
					<description><![CDATA[可能在10g中如果先访问INDSMALL1索引作为驱动结果集，再过次object_id列上的索引访问BIG1表，是通过object_id列上的索引只能执行单块读取，这样计算出来的成本还不如先全表扫描BIG1表，让它作为驱动结果集。而在11g中对于嵌套循环在通过索引访问被驱动表时使用了向量I/O,在先访问INDSMALL1索引作为驱动结果集，再通过索引访问表BIG1时，就可以使用向量I/O。但这只是我的猜测，当在11g将版本降低为10g相同的版本后，执行结果与10g中一致。]]></description>
		<content:encoded><![CDATA[<p>可能在10g中如果先访问INDSMALL1索引作为驱动结果集，再过次object_id列上的索引访问BIG1表，是通过object_id列上的索引只能执行单块读取，这样计算出来的成本还不如先全表扫描BIG1表，让它作为驱动结果集。而在11g中对于嵌套循环在通过索引访问被驱动表时使用了向量I/O,在先访问INDSMALL1索引作为驱动结果集，再通过索引访问表BIG1时，就可以使用向量I/O。但这只是我的猜测，当在11g将版本降低为10g相同的版本后，执行结果与10g中一致。</p>
]]></content:encoded>
						</item>
						<item>
				<title>
				作者：敬勇				</title>
				<link>http://www.killdb.com/2014/10/20/%e6%80%aa%e5%bc%82%e7%9a%84sql%e6%89%a7%e8%a1%8c%e8%ae%a1%e5%88%92/#comment-1478</link>
		<dc:creator><![CDATA[敬勇]]></dc:creator>
		<pubDate>Sun, 11 Jan 2015 04:32:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.killdb.com/?p=2417#comment-1478</guid>
					<description><![CDATA[11g中嵌套循环在通过索引访问被驱动表时使用了向量I/O，从你的11g的执行计划中可以看到两次
NESTED LOOPS,而在10g中只有一次NESTED LOOPS.我测试的结果是当在11g中指定/*+ optimizer_features_enable(&#039;10.2.0.5&#039;) */ Hint后，11g中的执行结果与10g中是一样的。]]></description>
		<content:encoded><![CDATA[<p>11g中嵌套循环在通过索引访问被驱动表时使用了向量I/O，从你的11g的执行计划中可以看到两次<br />
NESTED LOOPS,而在10g中只有一次NESTED LOOPS.我测试的结果是当在11g中指定/*+ optimizer_features_enable(&#8216;10.2.0.5&#8217;) */ Hint后，11g中的执行结果与10g中是一样的。</p>
]]></content:encoded>
						</item>
						<item>
				<title>
				作者：carcase				</title>
				<link>http://www.killdb.com/2014/10/20/%e6%80%aa%e5%bc%82%e7%9a%84sql%e6%89%a7%e8%a1%8c%e8%ae%a1%e5%88%92/#comment-1467</link>
		<dc:creator><![CDATA[carcase]]></dc:creator>
		<pubDate>Thu, 23 Oct 2014 09:32:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.killdb.com/?p=2417#comment-1467</guid>
					<description><![CDATA[你的sql是不是写错了


SELECT t.*
  FROM BIG1 T
 WHERE T.OBJECT_ID IN
       (SELECT T1.OBJECT_ID FROM SMALL1 T1 WHERE T1.OWNER = &#039;SYS&#039;)]]></description>
		<content:encoded><![CDATA[<p>你的sql是不是写错了</p>
<p>SELECT t.*<br />
  FROM BIG1 T<br />
 WHERE T.OBJECT_ID IN<br />
       (SELECT T1.OBJECT_ID FROM SMALL1 T1 WHERE T1.OWNER = &#8216;SYS&#8217;)</p>
]]></content:encoded>
						</item>
						<item>
				<title>
				作者：ssaer				</title>
				<link>http://www.killdb.com/2014/10/20/%e6%80%aa%e5%bc%82%e7%9a%84sql%e6%89%a7%e8%a1%8c%e8%ae%a1%e5%88%92/#comment-1466</link>
		<dc:creator><![CDATA[ssaer]]></dc:creator>
		<pubDate>Wed, 22 Oct 2014 02:21:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.killdb.com/?p=2417#comment-1466</guid>
					<description><![CDATA[10g下本来就应该是走semi的. 那样的执行计划是正确的.
11g下应该是优化了算法或者说优化了半连接..]]></description>
		<content:encoded><![CDATA[<p>10g下本来就应该是走semi的. 那样的执行计划是正确的.<br />
11g下应该是优化了算法或者说优化了半连接..</p>
]]></content:encoded>
						</item>
						<item>
				<title>
				作者：roger				</title>
				<link>http://www.killdb.com/2014/10/20/%e6%80%aa%e5%bc%82%e7%9a%84sql%e6%89%a7%e8%a1%8c%e8%ae%a1%e5%88%92/#comment-1465</link>
		<dc:creator><![CDATA[roger]]></dc:creator>
		<pubDate>Tue, 21 Oct 2014 15:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.killdb.com/?p=2417#comment-1465</guid>
					<description><![CDATA[11g这里只是对比下，不是重点，你看我最后的测试，都是在10g测试的呀？]]></description>
		<content:encoded><![CDATA[<p>11g这里只是对比下，不是重点，你看我最后的测试，都是在10g测试的呀？</p>
]]></content:encoded>
						</item>
						<item>
				<title>
				作者：ssaer				</title>
				<link>http://www.killdb.com/2014/10/20/%e6%80%aa%e5%bc%82%e7%9a%84sql%e6%89%a7%e8%a1%8c%e8%ae%a1%e5%88%92/#comment-1464</link>
		<dc:creator><![CDATA[ssaer]]></dc:creator>
		<pubDate>Tue, 21 Oct 2014 03:35:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.killdb.com/?p=2417#comment-1464</guid>
					<description><![CDATA[你偷换了一个概念.把自己弄糊涂了.
在11g中,转换前后的SQL是不等价的.11g中采用了SORT UNIQUE避免了不等价.]]></description>
		<content:encoded><![CDATA[<p>你偷换了一个概念.把自己弄糊涂了.<br />
在11g中,转换前后的SQL是不等价的.11g中采用了SORT UNIQUE避免了不等价.</p>
]]></content:encoded>
						</item>
						<item>
				<title>
				作者：roger				</title>
				<link>http://www.killdb.com/2014/10/20/%e6%80%aa%e5%bc%82%e7%9a%84sql%e6%89%a7%e8%a1%8c%e8%ae%a1%e5%88%92/#comment-1463</link>
		<dc:creator><![CDATA[roger]]></dc:creator>
		<pubDate>Mon, 20 Oct 2014 13:49:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.killdb.com/?p=2417#comment-1463</guid>
					<description><![CDATA[10.2.0.4 ,windows 7 x64测试如下：

&lt;code&gt;

SQL&#062; select * from table(dbms_xplan.display_cursor(NULL,NULL,&#039;ALLSTATS&#039;));

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------
------------------------------------------------------------
SQL_ID  744z7fvx3unrc, child number 0
-------------------------------------
select /*+ gather_plan_statistics */ t.* FROM BIG1 T WHERE T.OBJECT_ID IN(SELECT
T1.OBJECT_ID FROM SMALL1 T1 WHERE  T.OWNER=&#039;SYS&#039;)

Plan hash value: 3425505090

------------------------------------------------------------------------------------------
&#124; Id  &#124; Operation          &#124; Name      &#124; Starts &#124; E-Rows &#124; A-Rows &#124;   A-Time   &#124; Buffers &#124;
------------------------------------------------------------------------------------------
&#124;*  1 &#124;  FILTER            &#124;           &#124;      2 &#124;        &#124;     12 &#124;00:00:00.02 &#124;   47640 &#124;
&#124;   2 &#124;   TABLE ACCESS FULL&#124; BIG1      &#124;      2 &#124;  50330 &#124;    100K&#124;00:00:00.01 &#124;    1396 &#124;
&#124;*  3 &#124;   FILTER           &#124;           &#124;    100K&#124;        &#124;     12 &#124;00:00:00.10 &#124;   46244 &#124;
&#124;*  4 &#124;    INDEX RANGE SCAN&#124; INDSMALL1 &#124;  46244 &#124;      1 &#124;     12 &#124;00:00:00.08 &#124;   46244 &#124;
------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter( IS NOT NULL)
   3 - filter(:B1=&#039;SYS&#039;)
   4 - access(&quot;T1&quot;.&quot;OBJECT_ID&quot;=:B1)]]></description>
		<content:encoded><![CDATA[<p>10.2.0.4 ,windows 7 x64测试如下：</p>
<p><code></p>
<p>SQL&gt; select * from table(dbms_xplan.display_cursor(NULL,NULL,'ALLSTATS'));</p>
<p>PLAN_TABLE_OUTPUT<br />
------------------------------------------------------------------------------------------<br />
------------------------------------------------------------<br />
SQL_ID  744z7fvx3unrc, child number 0<br />
-------------------------------------<br />
select /*+ gather_plan_statistics */ t.* FROM BIG1 T WHERE T.OBJECT_ID IN(SELECT<br />
T1.OBJECT_ID FROM SMALL1 T1 WHERE  T.OWNER='SYS')</p>
<p>Plan hash value: 3425505090</p>
<p>------------------------------------------------------------------------------------------<br />
| Id  | Operation          | Name      | Starts | E-Rows | A-Rows |   A-Time   | Buffers |<br />
------------------------------------------------------------------------------------------<br />
|*  1 |  FILTER            |           |      2 |        |     12 |00:00:00.02 |   47640 |<br />
|   2 |   TABLE ACCESS FULL| BIG1      |      2 |  50330 |    100K|00:00:00.01 |    1396 |<br />
|*  3 |   FILTER           |           |    100K|        |     12 |00:00:00.10 |   46244 |<br />
|*  4 |    INDEX RANGE SCAN| INDSMALL1 |  46244 |      1 |     12 |00:00:00.08 |   46244 |<br />
------------------------------------------------------------------------------------------</p>
<p>Predicate Information (identified by operation id):<br />
---------------------------------------------------</p>
<p>   1 - filter( IS NOT NULL)<br />
   3 - filter(:B1='SYS')<br />
   4 - access("T1"."OBJECT_ID"=:B1)</code></p>
]]></content:encoded>
						</item>
			</channel>
</rss>
