Skip site navigation (1) Skip section navigation (2)

Re: [Fwd: how to determine storage size of a numeric column]

From: Dawid Kuroczko <qnex42(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: [Fwd: how to determine storage size of a numeric column]
Date: 2005-01-26 09:36:00
Message-ID: 758d5e7f0501260136310da4ec@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-admin
On Tue, 25 Jan 2005 22:06:49 -0500, Chris Hoover
<revoohc(at)sermonaudio(dot)com> wrote:
> From: Chris Hoover <revoohc(at)sermonaudio(dot)com>
> To: psql-admin(at)postgresql(dot)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

In response to

pgsql-admin by date

Next:From: Luis SousaDate: 2005-01-26 13:12:56
Subject: Re: Restore postgres database problem
Previous:From: Chris HooverDate: 2005-01-26 03:06:49
Subject: [Fwd: how to determine storage size of a numeric column]

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group