PostgreSQL查看索引的使用情况

Posted Ryan.zheng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PostgreSQL查看索引的使用情况相关的知识,希望对你有一定的参考价值。

查看某个表的索引使用情况

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, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch from pg_stat_user_indexes order by idx_scan asc, idx_tup_read 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;

 

以上是关于PostgreSQL查看索引的使用情况的主要内容,如果未能解决你的问题,请参考以下文章

c_cpp UV Index Indicator订阅PubNub并使用颜色显示UV索引值。博文的代码片段。在这里查看项目:https:/

javascript UV Index Monitor App订阅PubNub并显示UV索引值。博文的代码片段。在这里查看项目:https:// githu

postgresql —— 查看索引

postgresql——索引

PostgreSQL查看表表索引视图表结构以及参数设置

在 PostgreSQL 中列出具有索引的列