pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[Fwd: how to determine storage size of a numeric column]
2+ messages / 2 participants
[nested] [flat]

* [Fwd: how to determine storage size of a numeric column]
@ 2005-01-26 03:06  Chris Hoover <revoohc@sermonaudio.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Chris Hoover @ 2005-01-26 03:06 UTC (permalink / raw)
  To: pgsql-admin

I did not see it come through.  resent.
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?

thanks,

Chris

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [Fwd: how to determine storage size of a numeric column]
@ 2005-01-26 09:36  Dawid Kuroczko <qnex42@gmail.com>
  parent: Chris Hoover <revoohc@sermonaudio.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Dawid Kuroczko @ 2005-01-26 09:36 UTC (permalink / raw)
  To: pgsql-admin

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-01-26 09:36 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-01-26 03:06 [Fwd: how to determine storage size of a numeric column] Chris Hoover <revoohc@sermonaudio.com>
2005-01-26 09:36 ` Dawid Kuroczko <qnex42@gmail.com>

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