Sha256: e686ffef4d029b3a5d15d33d0c62f7f55d279ffd8a3a6940676c61209dd04b85
Contents?: true
Size: 713 Bytes
Versions: 18
Compression:
Stored size: 713 Bytes
Contents
/* Unused and almost unused indexes */ /* Ordered by their size relative to the number of index scans. Exclude indexes of very small tables (less than 5 pages), where the planner will almost invariably select a sequential scan, but may not in the future as the table grows */ 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;
Version data entries
18 entries across 18 versions & 3 rubygems