INDEX_STATISTIC
INDEX_STATISTIC视图存储当前数据库的索引信息。
表 1 INDEX_STATISTIC字段
|
名称
|
类型
|
描述
|
|
namespace
|
name
|
索引所属表空间
|
|
table
|
name
|
索引所属表
|
|
non_unique
|
boolean
|
是否是唯一索引
|
|
key_name
|
name
|
索引名
|
|
seq_in_index
|
smallint
|
索引列在索引中的序号
|
|
column_name
|
name
|
索引列的列名
|
|
collation
|
text
|
取值有A(默认,升序),D(降序)、NULL(索引不支持排序)
|
|
cardinality
|
double precision
|
根据pg_statistic.stadistinct和pg_class.reltuples计算得到: stadistinct > 0: stadistinct stadistinct = 0: NULL stadistinct < 0: reltuples * stadistinct * -1
|
|
sub_part
|
text
|
索引前缀。如果该列仅被部分索引,则是索引字符的数量;如果整个列都被索引,则是NULL。当前不支持前缀索引,恒为NULL
|
|
packed
|
text
|
如何打包key值,create table时指定pack_keys;否则返回NULL。当前不支持,为NULL
|
|
null
|
text
|
可能包含NULL值则是YES,否则为空字符串''
|
|
index_type
|
name
|
使用的索引方法:BTREE、HASH等
|
|
comment
|
text
|
pg_index表中记录的indisusable为true则显示disabled,false则显示空字符串''
|
|
index_comment
|
text
|
创建索引时COMMENT指定的注释信息
|