Created
January 10, 2024 13:58
-
-
Save vncsna/45b8767ecafb460c3ee5226bbf151a4b to your computer and use it in GitHub Desktop.
PostgreSQL Size of 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
-- Reference | |
-- https://stackoverflow.com/questions/46470030/postgresql-index-size-and-value-number | |
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='uploads' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment