ANALYZE TABLE employee COMPUTE STATISTICS : Analyze « SQL Plus « Oracle PL / SQL






ANALYZE TABLE employee COMPUTE STATISTICS

  



create table emp(
         no            integer         primary key
        ,name          varchar2(20)    not null
        ,region        number
        ,sales         number
);

insert into emp(no, name, region, sales)
        values (1, 'Tom', 100, 10000);

insert into emp(no, name, region, sales)
        values (2, 'Tom', 200, 20000);

insert into emp(no, name, region, sales)
        values (3, 'Tom', 200, 30000);

insert into emp(no, name, region, sales)
        values (4, 'Tom', 100, 40000);






Execution Plan
----------------------------------------------------------
Plan hash value: 1624656943

-------------------------------------------------------------------------------
| Id  | Operation          | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
-------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |          |     9 |   234 |     3  (34)| 00:00:01 |
|   1 |  HASH GROUP BY     |          |     9 |   234 |     3  (34)| 00:00:01 |
|   2 |   TABLE ACCESS FULL| EMPLOYEE |     9 |   234 |     2   (0)| 00:00:01 |
-------------------------------------------------------------------------------

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

SELECT region, SUM(sales)
    FROM emp
    GROUP BY region;


    REGION SUM(SALES)
---------- ----------
       100      50000
       200      50000

2 rows selected.

Statistics
----------------------------------------------------------
         48  recursive calls
          0  db block gets
         11  consistent gets
          0  physical reads
          0  redo size
        479  bytes sent via SQL*Net to client
        380  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed

SQL>
SQL> set autotrace off
SQL>
SQL> ANALYZE TABLE employee COMPUTE STATISTICS;

Table analyzed.
   
  








Related examples in the same category

1.analyze materialized view
2.analyze index
3.Analyze table with primary key and foreign key
4.Demonstrate IN versus EXISTS performance
5.analyze table tableName compute statistics for table, for all indexes, for all indexed columns;
6.analyze index validate structure
7.analyze table compute statistics
8.analyze table compute statistics for all indexes
9.analyze table compute statistics for a table with two indexes
10.create or replace outline and analyze table compute statistics
11.Analyze a table with/without index
12.Anayze all objects in the APPOWNER schema.
13.Analyze index on varchar2 value and date type value
14.analyze and autotrace full outer join and union
15.analyze and autotrace single column key and multi-column key
16.analyze and autotrace table with primary key
17.analyze index t_idx validate structure
18.analyze table TABLENAME compute statistics;
19.analyze table after creating index
20.analyze table estimate statistics
21.analyze table students compute statistics
22.analyze table t compute statistics for table for columns id;
23.analyze table t compute statistics for table, for all indexes, for all indexed columns