查看某个表的索引使用情况
select relname,indexrelname,idx_scan,idx_tup_read,idx_tup_fetch from pg_stat_user_indexes where relname = table_name order by idx_scan asc,idx_tup_read asc,idx_tup_fetch asc;
查看所有表的索引的使用情况
select relname,idx_tup_fetch from pg_stat_user_indexes order by idx_scan asc,idx_tup_fetch asc;
存放索引详细信息的表
data_name=# \d+ pg_stat_user_indexes; View "pg_catalog.pg_stat_user_indexes" Column | Type | Modifiers | Storage | Description ---------------+--------+-----------+---------+------------- relid | oid | | plain | indexrelid | oid | | plain | schemaname | name | | plain | relname | name | | plain | indexrelname | name | | plain | idx_scan | bigint | | plain | idx_tup_read | bigint | | plain | idx_tup_fetch | bigint | | plain | View deFinition: SELECT pg_stat_all_indexes.relid,pg_stat_all_indexes.indexrelid,pg_stat_all_indexes.schemaname,pg_stat_all_indexes.relname,pg_stat_all_indexes.indexrelname,pg_stat_all_indexes.idx_scan,pg_stat_all_indexes.idx_tup_read,pg_stat_all_indexes.idx_tup_fetch FROM pg_stat_all_indexes WHERE (pg_stat_all_indexes.schemaname <> ALL (ARRAY[‘pg_catalog‘::name,‘information_schema‘::name])) AND pg_stat_all_indexes.schemaname !~ ‘^pg_toast‘::text;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。