PLAN_TABLE_OUTPUT中的 *

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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/7364032/viewspace-17459/

你可能感兴趣的:(PLAN_TABLE_OUTPUT中的 *)