-
-
Save kenvac/a84b88337cc147fe12c07cb30462b288 to your computer and use it in GitHub Desktop.
PostgreSQL query: completely unused indexes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Completely unused indexes: | |
SELECT relid::regclass as table, indexrelid::regclass as index | |
, pg_size_pretty(pg_relation_size(indexrelid)) | |
FROM pg_stat_user_indexes | |
JOIN pg_index | |
USING (indexrelid) | |
WHERE idx_scan = 0 | |
AND indisunique IS FALSE order by pg_relation_size(indexrelid); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment