pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: pgboy@guthrie.charm.net
To: pgsql-admin@postgresql.org
Subject: storage calculations
Date: Tue, 29 Jul 2003 14:09:26 -0400 (EDT)
Message-ID: <20030729180926.EFE0913EA6@guthrie.charm.net> (raw)

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



view thread (8+ messages)  latest in thread

Message-ID: <20030729180926.EFE0913EA6@guthrie.charm.net>
Permalink:  ../20030729180926.EFE0913EA6@guthrie.charm.net/
Also on:    postgresql.org/message-id/20030729180926.EFE0913EA6@guthrie.charm.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: pgboy@guthrie.charm.net
  Subject: Re: storage calculations
  In-Reply-To: <20030729180926.EFE0913EA6@guthrie.charm.net>
  References: <20030729180926.EFE0913EA6@guthrie.charm.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox