Autotrace running total : autotrace « SQL Plus « Oracle PL / SQL

Home
Oracle PL / SQL
1.Aggregate Functions
2.Analytical Functions
3.Char Functions
4.Constraints
5.Conversion Functions
6.Cursor
7.Data Type
8.Date Timezone
9.Hierarchical Query
10.Index
11.Insert Delete Update
12.Large Objects
13.Numeric Math Functions
14.Object Oriented Database
15.PL SQL
16.Regular Expressions
17.Report Column Page
18.Result Set
19.Select Query
20.Sequence
21.SQL Plus
22.Stored Procedure Function
23.Subquery
24.System Packages
25.System Tables Views
26.Table
27.Table Joins
28.Trigger
29.User Previliege
30.View
31.XML
Oracle PL / SQL » SQL Plus » autotrace 




Autotrace running total
   
SQL>
SQL> set echo on
SQL>
SQL> create table t
  2  as
  3  select object_name ename,
  4         mod(object_id,50deptno,
  5         object_id sal
  6    from all_objects
  7    where rownum <= 1000
  8  /

Table created.

SQL>
SQL> create index t_idx on t(deptno,ename);

Index created.

SQL>
SQL> select ename, deptno, sal,
  2    (select sum(sal)
  3      from t e2
  4      where e2.deptno < emp.deptno
  5      or (e2.deptno = emp.deptno and e2.ename <= emp.ename ))
  6  running_total,
  7    (select sum(sal)
  8      from t e3
  9      where e3.deptno = emp.deptno
 10      and e3.ename <= emp.ename)
 11  department_total,
 12    (select count(ename)
 13      from t e3
 14      where e3.deptno = emp.deptno
 15      and e3.ename <= emp.enameseq
 16  from t emp
 17  order by deptno, ename
 18  /

1000 rows selected.


Execution Plan
----------------------------------------------------------
Plan hash value: 92139442

--------------------------------------------------------------------------------------
| Id  | Operation                    | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------------------
|   SELECT STATEMENT             |       |  1000 43000 |     4  (25)00:00:01 |
|   |  SORT AGGREGATE              |       |     |    43 |            |          |
|*  |   TABLE ACCESS FULL          | T     |    50 |  2150 |     3   (0)00:00:01 |
|   |  SORT AGGREGATE              |       |     |    43 |            |          |
|   |   TABLE ACCESS BY INDEX ROWID| T     |     |    43 |     2   (0)00:00:01 |
|*  |    INDEX RANGE SCAN          | T_IDX |     |       |     2   (0)00:00:01 |
|   |  SORT AGGREGATE              |       |     |    30 |            |          |
|*  |   INDEX RANGE SCAN           | T_IDX |     |    30 |     2   (0)00:00:01 |
|   |  SORT ORDER BY               |       |  1000 43000 |     4  (25)00:00:01 |
|   |   TABLE ACCESS FULL          | T     |  1000 43000 |     3   (0)00:00:01 |
--------------------------------------------------------------------------------------

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

   - filter("E2"."DEPTNO"<:B1 OR "E2"."DEPTNO"=:B2 AND "E2"."ENAME"<=:B3)
   - access("E3"."DEPTNO"=:B1 AND "E3"."ENAME"<=:B2)
   - access("E3"."DEPTNO"=:B1 AND "E3"."ENAME"<=:B2)

Note
-----
   - dynamic sampling used for this statement


Statistics
----------------------------------------------------------
         39  recursive calls
          0  db block gets
      15678  consistent gets
          4  physical reads
          0  redo size
      44533  bytes sent via SQL*Net to client
       1106  bytes received via SQL*Net from client
         68  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
       1000  rows processed

SQL>
SQL> set autotrace off

   
    
  














Related examples in the same category
1.autotrace command
2.Autotrace on and off
3.Autotrace lower text function
4.Autotrace a query on a huge table
5.Autotrace a large table
6.Autotrace a query with group clause
7.Execution Plan
8.autotrace a nested query
9.set autotrace on explain for every single statement
10.set autotrace traceonly explain for bitmap index
11.set autotrace traceonly explain, and condition
12.set autotrace traceonly statistics
13.set autotrace traceonly statistics for 'select * from tableName'
14.set autotrace traceonly
15.AUTOTRACE exists (subquery)
16.AUTOTRACE table joining
17.AUTOTRACE table joining and aggregate function
18.autotrace ansi full outer join
19.autotrace count(*)
20.autotrace ctxsys.context index
21.autotrace merge command
22.autotrace table with/without an index
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.