日期:2014-05-16  浏览次数:20484 次

查看表的相关特性
SQL> select table_name,num_rows,blocks,avg_row_len,to_char(last_analyzed,'yyyy/mm/dd hh24:mi:ss')

          from dba_tables where table_name in ('EMP');
TABLE_NAME       NUM_ROWS     BLOCKS  AVG_ROW_LEN    TO_CHAR(LAST_ANALYZ
---------------------        ----------        ----------            -----------                         -------------------
EMP                            14                      5                   37                        2010/03/02 10:44:51

索引验证信息:

SQL> select index_name "name",num_rows,distinct_keys "distinct",blcoks,clustering_factor "cf",blevel "level",

          avg_leaf_blocks_per_key "alfbpkey" from dba_indexes where owner='SCOTT';

name                             NUM_ROWS   distinct  LEAF_BLOCKS         cf      level   alfbpkey
------------------------------ ---------- ---------- ----------- ---------- ---------- ----------
PK_DEPT                                 4               4           1          1          0          1
PK_EMP                                 14             14           1          1          0          1

索引中的行数num_rows:基数

不同关键字的数目distinct:定义了索引的选择性

索引的等级或高度blevel:指出为了查找某数据所需探测数据的深度

叶块leaf block的数目:代表为查找到预期的数据行所需进行I/O的数目

聚类因子clustering factor:指出索引块相对于数据块的配置数量如果索引的CF值越大,那么优化器也就更加可能会选择该索引。

验证列统计信息:

SQL>select table_name,column_name,num_distinct,num_nulls,num_buckets,density

          from dba_tab_col_statistics where table_name='EMP';

TABLE_NAME    COLUMN_NAME                    NUM_DISTINCT  NUM_NULLS NUM_BUCKETS    DENSITY
------------------------------ ------------------------------ ------------ ---------- ----------- ----------
EMP               &