SQL优化-1.查看解析计划

SQL> explain plan for select a.name,b.id from a,b
  2   where b.class=300 and a.name=b.name;

已解释。

SQL> select plan_table_output from table (dbms_xplan.display('plan_table',null,'serial'));

....
SQL> set linesize 3000;
SQL> /
 
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
| Id  | Operation                   | Name               | Rows  | Bytes | Cost (%CPU)|
---------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |                    |    50 |  2450 |   144   (0)|
|   1 |  TABLE ACCESS BY INDEX ROWID| B                  |     1 |    25 |     3   (0)|
|   2 |   NESTED LOOPS              |                    |    50 |  2450 |   144   (0)|
|   3 |    TABLE ACCESS FULL        | A                  |    47 |  1128 |     3   (0)|
|*  4 |    INDEX RANGE SCAN         | Index_common_8     |     1 |       |     2   (0)|
---------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
   4 - access("B"."CLASS"=300 AND "A"."NAME"="B"."NAME")
Note
-----
   - 'PLAN_TABLE' is old version

作者: x-i-x   发布时间: 2010-11-22