2016-10-24 12 views

答えて

2

次のクエリはあなたを与えるだろう、比較的未使用のインデックス(50 < idx_scan):

SELECT schemaname || '.' || relname AS table, 
     indexrelname AS index, 
     pg_size_pretty(pg_relation_size(i.indexrelid)) AS index_size, 
     idx_scan as index_scans 
FROM pg_stat_user_indexes ui 
    JOIN pg_index i ON ui.indexrelid = i.indexrelid 
WHERE NOT indisunique 
    AND idx_scan < 50 
    AND pg_relation_size(relid) > 5 * 8192 
ORDER BY pg_relation_size(i.indexrelid)/nullif(idx_scan, 0) DESC NULLS FIRST, 
     pg_relation_size(i.indexrelid) DESC; 
関連する問題