DatabaseMeter

PostgreSQL guide

How to check PostgreSQL index size

Measure the index footprint attached to each table, then inspect individual indexes. Size is evidence for investigation—not proof that an index should be removed.

Table and attached-index footprint

SELECT
  n.nspname AS schema_name,
  c.relname AS table_name,
  pg_table_size(c.oid) AS table_bytes,
  pg_indexes_size(c.oid) AS index_bytes,
  pg_total_relation_size(c.oid) AS total_bytes,
  pg_size_pretty(pg_indexes_size(c.oid)) AS index_size
FROM pg_class AS c
JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE c.relkind = 'r'
  AND n.nspname NOT IN ('pg_catalog', 'information_schema')
  AND n.nspname !~ '^pg_toast'
ORDER BY index_bytes DESC
LIMIT 25;

pg_indexes_size sums indexes attached to the table. pg_table_size includes the table's main fork, free-space map, visibility map, and TOAST. pg_total_relation_size combines table and index footprint.

Largest individual indexes

SELECT
  n.nspname AS schema_name,
  t.relname AS table_name,
  i.relname AS index_name,
  pg_relation_size(i.oid) AS index_bytes,
  pg_size_pretty(pg_relation_size(i.oid)) AS index_size
FROM pg_index AS x
JOIN pg_class AS i ON i.oid = x.indexrelid
JOIN pg_class AS t ON t.oid = x.indrelid
JOIN pg_namespace AS n ON n.oid = t.relnamespace
WHERE n.nspname NOT IN ('pg_catalog', 'information_schema')
  AND n.nspname !~ '^pg_toast'
ORDER BY index_bytes DESC
LIMIT 25;

Do not drop an index from size alone

An index may support rare but critical queries, uniqueness, primary keys, foreign-key workflows, or maintenance tasks. Review workload over a representative period, dependencies, constraints, query plans, write overhead, and rollback strategy before changing it.

What size cannot tell you

Index size does not establish usefulness, bloat, cache residency, selectivity, or exact compute cost. PostgreSQL cumulative statistics can add evidence, but resets, replicas, role visibility, and workload seasonality must be considered.

Definitions and sources

Provider and PostgreSQL statements last reviewed August 27, 2026. Pricing consoles and invoices remain authoritative.