i've been browsing the documentation online, and i can't
find where the storage layouts for tables and indexes are
explained.
i'd like to be able to figure out, given a table or two
with a simple schema (no ineritance) and some indexes, and
a number of rows currently in these tables, how much disk
space is being used.
the underlying problem being worked here, by the way, is
to come up with a task that monitors space used by the database
so as to issue a warning of some sort when the partition
upon which the database resides is getting full. i had originally
used the statfs output from the (unix) os, but for this to accurately
reflect the "used" space, i found i had to do a "vacuum full" and
compress the database. i'd rather come up with a heuristic where
i can take a number of rows (which i get from the reltuples column
in pg_class, which seems to be accurate after running 'analyze')
and multiply by some number i have calculated based on the table
schema to get a fairly accurate guess at the real space used.
any and all advice welcome, and thanks.
pg