Difference Between Non-Indexed and Indexed Table: Elapsed: 00:11:33.29
Difference Between Non-Indexed and Indexed Table: Elapsed: 00:11:33.29
Difference Between Non-Indexed and Indexed Table: Elapsed: 00:11:33.29
############################################################################################
SYSTIMESTAMP
---------------------------------------------------------------------------
13-JAN-11 12.26.30.640314 PM +05:30
SCOTT>>set autotrace on
SCOTT>>set timing on
SCOTT>>desc emp
Name Null? Type
----------------------------------------- -------- ----------------------------
EMPNO NOT NULL NUMBER(38)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
SCOTT>>desc dept
Name Null? Type
----------------------------------------- -------- ----------------------------
DEPTNO NUMBER(2)
DNAME VARCHAR2(14)
LOC VARCHAR2(13)
SCOTT>>select a.empno,a.ename,a.job,a.hiredate,a.sal,a.deptno,b.dname,b.loc
2 from emp a,dept b
3 where a.deptno=b.deptno
4* and a.empno=(select max(empno) from emp)
##############################################
# Elapsed: 00:11:33.29 #
##############################################
Execution Plan
----------------------------------------------------------
Plan hash value: 3269051146
-----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 91 | 307K (1)| 01:01:26 |
|* 1 | HASH JOIN | | 1 | 91 | 153K (1)| 00:30:44 |
|* 2 | TABLE ACCESS FULL | EMP | 1 | 61 | 153K (1)| 00:30:44 |
| 3 | SORT AGGREGATE | | 1 | 13 | | |
| 4 | TABLE ACCESS FULL| EMP | 77M| 957M| 153K (1)| 00:30:42 |
| 5 | TABLE ACCESS FULL | DEPT | 4 | 120 | 2 (0)| 00:00:01 |
-----------------------------------------------------------------------------
1 - access("A"."DEPTNO"="B"."DEPTNO")
2 - filter("A"."EMPNO"= (SELECT MAX("EMPNO") FROM "EMP" "EMP"))
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
292 recursive calls
0 db block gets
2254721 consistent gets
1127491 physical reads
0 redo size
880 bytes sent via SQL*Net to client
415 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
Index created.
##############################################
# Elapsed: 00:07:41.14 #
##############################################
SCOTT>>conn / as sysdba
Connected.
SYS>>alter system flush buffer_cache;
System altered.
Elapsed: 00:00:00.56
SYS>>alter system flush shared_pool;
System altered.
Elapsed: 00:00:03.98
SYS>>conn scott/tiger
Connected.
SCOTT>>set autotrace on
SCOTT>>set timing on
SCOTT>>select a.empno,a.ename,a.job,a.hiredate,a.sal,a.deptno,b.dname,b.loc
2 from emp a,dept b
3 where a.deptno=b.deptno
4 and a.empno=(select max(empno) from emp);
#############################################
# Elapsed: 00:00:01.61 #
#############################################
Execution Plan
----------------------------------------------------------
Plan hash value: 1735671770
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
| 4 | SORT AGGREGATE | | 1 | 13 | | |
-------------------------------------------------------------------------------------------
1 - access("A"."DEPTNO"="B"."DEPTNO")
3 - access("A"."EMPNO"= (SELECT MAX("EMPNO") FROM "EMP" "EMP"))
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
698 recursive calls
0 db block gets
233 consistent gets
170 physical reads
0 redo size
880 bytes sent via SQL*Net to client
415 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
11 sorts (memory)
0 sorts (disk)
1 rows processed
SCOTT>>spool off