pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dawid Kuroczko <qnex42@gmail.com>
To: pgsql-admin@postgresql.org
Subject: Re: [Fwd: how to determine storage size of a numeric column]
Date: Wed, 26 Jan 2005 10:36:00 +0100
Message-ID: <758d5e7f0501260136310da4ec@mail.gmail.com> (raw)
In-Reply-To: <41F70949.9080001@sermonaudio.com>
References: <41F70949.9080001@sermonaudio.com>

On Tue, 25 Jan 2005 22:06:49 -0500, Chris Hoover
<revoohc@sermonaudio.com> wrote:
> From: Chris Hoover <revoohc@sermonaudio.com>
> To: psql-admin@postgresql.org
> Date: Tue, 25 Jan 2005 16:27:45 -0500
> Subject: how to determine storage size of a numeric column
> I'm running 7.3.4, and am trying to calculate the space requirements for
> my tables.  However, I have several tables that have numeric columns,
> and am not sure how much space postgres is using for them.  Does anyone
> know how to determine this?
> 
> I have tried looking at pg_attribute.attlen, but it is -l, I have tried
> looking at pg_attribute.atttypmod, but it is returning what would be
> huge space requirements (some of them are 786,4400, 786442, 1,179,645, .
> . .).  Is that number really how many bytes it is taking up?  I am
> thinking (and hoping) not.
> 
> So, where else can I look for the size?

Be sure to use ANALYZE first.

You may want to use following select to find these values:
select attname,avg_width from pg_stats where tablename = 'foo';
...it certainly works well for me, v8 though. :)

   Regards,
      Dawid



view thread (2+ messages)

Message-ID: <758d5e7f0501260136310da4ec@mail.gmail.com>
Permalink:  ../758d5e7f0501260136310da4ec@mail.gmail.com/
Also on:    postgresql.org/message-id/758d5e7f0501260136310da4ec@mail.gmail.com

 · 

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: qnex42@gmail.com
  Subject: Re: [Fwd: how to determine storage size of a numeric column]
  In-Reply-To: <758d5e7f0501260136310da4ec@mail.gmail.com>
  References: <41F70949.9080001@sermonaudio.com> <758d5e7f0501260136310da4ec@mail.gmail.com>

* 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