Created
March 18, 2020 15:07
-
-
Save fljdin/9098f39950c9626fe619705debeb1fc3 to your computer and use it in GitHub Desktop.
This file contains 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
SELECT i.indrelid::regclass AS "Table", i.indexrelid::regclass AS "Index", | |
pg_size_pretty(pg_relation_size(i.indexrelid)) AS "Taille de l'index" | |
FROM pg_index i JOIN ( | |
SELECT indrelid, indclass, indkey, indexprs, indpred | |
FROM pg_index GROUP BY indrelid, indclass, indkey, indexprs, indpred | |
HAVING COUNT (*) > 1 | |
) g ON i.indrelid = g.indrelid AND i.indclass = g.indclass AND i.indkey = g.indkey | |
AND COALESCE(i.indexprs::text,'x') = COALESCE(g.indexprs::text,'x') | |
AND COALESCE(i.indpred::text,'x') = COALESCE(g.indpred::text,'x') | |
ORDER BY pg_relation_size(i.indexrelid) DESC, i.indexrelid::regclass; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment