george young <gry@ll.mit.edu> writes:
> Does someone know the right way to map from database name to
> data directory name?
pg_database.oid column.
However, that's definitely the hard way. I'd just look at the relpages
column of pg_class, which should be reasonably accurate if you've done
a VACUUM or ANALYZE recently. For example:
regression=# select relname, relkind, relpages from pg_class where
regression-# relname like 'tenk1%';
relname | relkind | relpages
---------------+---------+----------
tenk1 | r | 358
tenk1_hundred | i | 30
tenk1_unique1 | i | 30
tenk1_unique2 | i | 30
(4 rows)
Here we have a table and its three indexes, and the index sizes look
reasonable. If the index sizes approach or exceed the table size,
you are probably suffering from index bloat --- try a reindex.
regards, tom lane