ITPub博客

PLAN_TABLE_OUTPUT中的 *

原创 Linux操作系统 作者:yxyup 时间:2007-03-30 00:00:00 0 删除 编辑

SQL> explain plan for select a.* from t a,t b where a.num=b.num;

Explained.

SQL> select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost |
--------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 6 | 5 |
|* 1 | HASH JOIN | | 1 | 6 | 5 |
| 2 | TABLE ACCESS FULL | T | 1 | 3 | 2 |
| 3 | TABLE ACCESS FULL | T | 1 | 3 | 2 |
--------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

1 - access("A"."NUM"="B"."NUM")

Note: cpu costing is off

16 rows selected.

SQL>
SQL>
SQL> set autotrace traceonly
SQL> select a.* from t a,t b where a.num=b.num;


Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=5 Card=1 Bytes=6)
1 0 HASH JOIN (Cost=5 Card=1 Bytes=6)
2 1 TABLE ACCESS (FULL) OF 'T' (Cost=2 Card=1 Bytes=3)
3 1 TABLE ACCESS (FULL) OF 'T' (Cost=2 Card=1 Bytes=3)


Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
14 consistent gets
0 physical reads
0 redo size
486 bytes sent via SQL*Net to client
655 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed

以前一直在用autotrace来看执行计划,最近在用explain plan for ...时发现在PLAN_TABLE_OUTPUT输出的内容中有些ID号有*,有些没有* 。所以做了一个测试比较了一下,发现有*的ID就是说明还有分支,是一个parent node. 而没有*就是child node .


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7364032/viewspace-17459/,如需转载,请注明出处,否则将追究法律责任。

下一篇: Parallel query & views
请登录后发表评论 登录
全部评论
暂无介绍

注册时间:2007-12-06

  • 博文量
    164
  • 访问量
    1314149