psql -d appdb -c "SELECT pg_size_pretty(pg_indexes_size('users'));"

Category: Databases & SQL

psql -d appdb -c "SELECT pg_size_pretty(pg_indexes_size('users'));"

Show total index size of a table

Sums the bytes used by every index on the table, excluding the table data itself. Compare it with the table size to judge whether indexes are bloated; REINDEX shrinks them. Per-index sizes come from pg_indexes.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.