X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id BF81DD1C4B7 for ; Tue, 29 Jul 2003 18:19:53 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 88650-04 for ; Tue, 29 Jul 2003 15:18:50 -0300 (ADT) Received: from guthrie.charm.net (guthrie.charm.net [209.143.110.37]) by svr1.postgresql.org (Postfix) with ESMTP id E5920D1C4EC for ; Tue, 29 Jul 2003 15:19:47 -0300 (ADT) Received: by guthrie.charm.net (Postfix, from userid 503) id EFE0913EA6; Tue, 29 Jul 2003 14:09:26 -0400 (EDT) To: pgsql-admin@postgresql.org Subject: storage calculations Message-Id: <20030729180926.EFE0913EA6@guthrie.charm.net> Date: Tue, 29 Jul 2003 14:09:26 -0400 (EDT) From: pgboy@guthrie.charm.net X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/297 X-Sequence-Number: 9637 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