oracle中与索引相关的视图---all_indexes(一)

2014-11-24 09:14:15 · 作者: · 浏览: 0

ALL_INDEXES描述了与索引有关的信息,为了使部分字段的内容更准确,我们需要通过analyze或者dbms_stats包来收集与索引有关的统计信息(这部分字段标记为带*)。

首先看一下官网给出的各个字段的解释:

Column Datatype NULL Description
OWNER VARCHAR2(30) NOT NULL Owner of the index(索引拥有者)
INDEX_NAME VARCHAR2(30) NOT NULL Name of the index
INDEX_TYPE VARCHAR2(27) Type of the index:

NORMAL

NORMAL/REV

BITMAP

FUNCTION-BASED NORMAL

FUNCTION-BASED NORMAL/REV

FUNCTION-BASED BITMAP

CLUSTER

IOT - TOP (索引组织表对应的索引,注意IOT - TOP 之间存有空格,个人观察:表的类型为IOT;对应索引类型为IOT - TOP;对应overflow表类型为IOT-OVERFLOW)

DOMAIN(自定义索引类型)

TABLE_OWNER VARCHAR2(30) NOT NULL Owner of the indexed object
TABLE_NAME VARCHAR2(30) NOT NULL Name of the indexed object
TABLE_TYPE CHAR(5) Type of the indexed object:

NEXT OBJECT

INDEX

TABLE

CLUSTER

VIEW

SYNONYM

SEQUENCE

UNIQUENESS VARCHAR2(9) Indicates whether the index is unique (UNIQUE) or nonunique (NONUNIQUE)
COMPRESSION VARCHAR2(8) Indicates whether index compression is enabled (ENABLED) or not (DISABLED)
PREFIX_LENGTH NUMBER Number of columns in the prefix of the compression key(索引压缩中被压缩的字段数量,唯一索引最大值为索引列数-1,非唯一索引最大值为索引列数)
TABLESPACE_NAME VARCHAR2(30) Name of the tablespace containing the index
INI_TRANS NUMBER Initial number of transactions
MAX_TRANS NUMBER Maximum number of transactions
INITIAL_EXTENT NUMBER Size of the initial extent
NEXT_EXTENT NUMBER Size of secondary extents
MIN_EXTENTS NUMBER Minimum number of extents allowed in the segment
MAX_EXTENTS NUMBER Maximum number of extents allowed in the segment
PCT_INCREASE NUMBER Percentage increase in extent size
PCT_THRESHOLD NUMBER Threshold percentage of block space allowed per index entry
INCLUDE_COLUMN NUMBER Column ID of the last column to be included in index-organized table primary key (non-overflow) index. This column maps to the COLUMN_ID column of the *_TAB_COLUMNS view(该字段具体的含义参见下文的解释).
FREELISTS NUMBER Number of process freelists allocated to this segment
FREELIST_GROUPS NUMBER Number of freelist groups allocated to this segment
PCT_FREE NUMBER Minimum percentage of free space in a block
LOGGING VARCHAR2(3) Indicates whether or not changes to the index are logged:

YES

NO

BLEVEL* NUMBER B*-Tree level (depth of the index from its root block to its leaf blocks). A depth of 0 indicates that the root block and leaf block are the same.
LEAF_BLOCKS* NUMBER Number of leaf blocks in the index
DISTINCT_KEYS* NUMBER Number of distinct indexed values. For indexes that enforce UNIQUE and PRIMARY KEY constraints, this value is the same as the number of rows in the table (*_TABLES.NUM_ROWS)
AVG_LEAF_BLOCKS_PER_KEY* NUMBER Average number of leaf blocks in which each distinct value in the index appears, rounded to the nearest integer. For indexes that enforce UNIQUE and PRIMARY KEY constraints, this value is always 1.
AVG_DATA_BLOCKS_PER_KEY* NUMBER Average number of data blocks in the table that are pointed to by a distinct value in the index rounded to the nearest integer. This statistic is the average number of data blocks that contain rows that contain a given value for the indexed columns.
CLUSTERING_FACTOR* NUMBER Indicates the amount of order of the rows in the table based on the values of the index.

If the value is near the number of blocks, then the table is very well ordered. In this case, the index entries in a sin