PostgreSQL Index Usage Analysis

前端 未结 9 1656
伪装坚强ぢ
伪装坚强ぢ 2021-01-29 17:43

Is there a tool or method to analyze Postgres, and determine what missing indexes should be created, and which unused indexes should be removed? I have a little experience doing

9条回答
  •  一向
    一向 (楼主)
    2021-01-29 18:10

    On the determine missing indexes approach....Nope. But there's some plans to make this easier in future release, like pseudo-indexes and machine readable EXPLAIN.

    Currently, you'll need to EXPLAIN ANALYZE poor performing queries and then manually determine the best route. Some log analyzers like pgFouine can help determine the queries.

    As far as an unused index, you can use something like the following to help identify them:

    select * from pg_stat_all_indexes where schemaname <> 'pg_catalog';
    

    This will help identify tuples read, scanned, fetched.

提交回复
热议问题