Last active
July 7, 2024 10:24
-
-
Save haseebeqx/54282b74de62fa6392d5c9037d9e22ce to your computer and use it in GitHub Desktop.
query.sql
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.relname AS index_name, | |
t.relname AS table_name, | |
s.idx_scan AS times_used, | |
pg_size_pretty(pg_relation_size(i.oid)) AS index_size | |
FROM | |
pg_stat_user_indexes s | |
JOIN | |
pg_index ix | |
ON | |
s.indexrelid = ix.indexrelid | |
JOIN | |
pg_class t | |
ON | |
s.relid = t.oid | |
JOIN | |
pg_class i | |
ON | |
s.indexrelid = i.oid | |
ORDER BY | |
s.idx_scan DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment