Created
November 14, 2023 06:45
-
-
Save Charmatzis/bac546af24cf6c62f197d9f73e0cb5f4 to your computer and use it in GitHub Desktop.
Get index size (Postgres)
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
SELECT i.relname "Table Name",indexrelname "Index Name", | |
pg_size_pretty(pg_total_relation_size(relid)) As "Total Size", | |
pg_size_pretty(pg_indexes_size(relid)) as "Total Size of all Indexes", | |
pg_size_pretty(pg_relation_size(relid)) as "Table Size", | |
pg_size_pretty(pg_relation_size(indexrelid)) "Index Size", | |
reltuples::bigint "Estimated table row count" | |
FROM pg_stat_all_indexes i JOIN pg_class c ON i.relid=c.oid | |
WHERE i.relname='table_name'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment