sql 代码
- 连接到:
- Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
- With the Partitioning, OLAP and Data Mining options
- SQL> explain plan set statement_id='me' for select * from employee
- 2 /
- 已解释。
- SQL> @D:\oracle\product\10.1.0\db_1\RDBMS\ADMIN\utlxpls.sql
- PLAN_TABLE_OUTPUT
- --------------------------------------------------------------------------------
- Plan hash value: 1837852109
- ------------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
- ------------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 2 | 98 | 2 (0)| 00:00:01 |
- | 1 | TABLE ACCESS FULL| EMPLOYEE | 2 | 98 | 2 (0)| 00:00:01 |
- ------------------------------------------------------------------------------
- 已选择8行。
- SQL> SELECT A.OPERATION,OPTIONS,OBJECT_NAME,OBJECT_TYPE,ID,PARENT_ID
- 2 from plan_table a where a.statement_id='me' order by id
- 3 /
- OPERATION
- ------------------------------
- OPTIONS
- --------------------------------------------------------------------------------
- OBJECT_NAME OBJECT_TYPE ID
- ------------------------------ ------------------------------ ----------
- PARENT_ID
- ----------
- SELECT STATEMENT
- 0
- OPERATION
- ------------------------------
- OPTIONS
- --------------------------------------------------------------------------------
- OBJECT_NAME OBJECT_TYPE ID
- ------------------------------ ------------------------------ ----------
- PARENT_ID
- ----------
- TABLE ACCESS
- FULL
- EMPLOYEE TABLE 1
- 0
- SQL> set timing on
- SQL> set autorrace on
- SP2-0158: 未知的 SET 选项 "autorrace"
- SQL> set autotrace on
- SQL> select * from employee
- 2 /
- ID FIRST_NAME LAST_NAME START_DATE END_DATE SALARY CITY
- ---- ---------- ---------- -------------- -------------- ---------- ----------
- DESCRIPTION
- ---------------
- 01 Jason Martin 25-7月 -96 25-7月 -06 1234.56 Toronto
- Programmer
- 02 Alison Mathews 21-3月 -76 21-2月 -86 6661.78 Vancouver
- Tester
- 已用时间: 00: 00: 00.03
- 执行计划
- ----------------------------------------------------------
- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2 Card=2 Bytes=98)
- 1 0 TABLE ACCESS (FULL) OF 'EMPLOYEE' (TABLE) (Cost=2 Card=2 B
- ytes=98)
- 统计信息
- ----------------------------------------------------------
- 1 recursive calls
- 0 db block gets
- 4 consistent gets
- 2 physical reads
- 0 redo size
- 940 bytes sent via SQL*Net to client
- 512 bytes received via SQL*Net from client
- 2 SQL*Net roundtrips to/from client
- 0 sorts (memory)
- 0 sorts (disk)
- 2 rows processed
- SQL> set autotrace traceonly
- SQL> select * from employee
- 2 /
- 已用时间: 00: 00: 00.00
- 执行计划
- ----------------------------------------------------------
- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2 Card=2 Bytes=98)
- 1 0 TABLE ACCESS (FULL) OF 'EMPLOYEE' (TABLE) (Cost=2 Card=2 B
- ytes=98)
- 统计信息
- ----------------------------------------------------------
- 0 recursive calls
- 0 db block gets
- 4 consistent gets
- 0 physical reads
- 0 redo size
- 940 bytes sent via SQL*Net to client
- 512 bytes received via SQL*Net from client
- 2 SQL*Net roundtrips to/from client
- 0 sorts (memory)
- 0 sorts (disk)
- 2 rows processed
- SQL>