Re: table size is bigger than expected

From: Justin Pitts <justinpitts(at)gmail(dot)com>
To: Jian Shi <jshi(at)unitrends(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: table size is bigger than expected
Date: 2011-08-04 20:17:30
Message-ID: CAMYZu8U0k2DhAazY0xKhfjpCB-DkYgpD6cJy57e_dnaZwxCiTg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, Aug 4, 2011 at 2:56 PM, Jian Shi <jshi(at)unitrends(dot)com> wrote:
> Hey,
>
>   I’m a new user of PostgreSQL. I found one of my tables is taking
> unexpectedly large space:
>
> select
> pg_size_pretty(pg_relation_size('archive_files'));
>
>  pg_size_pretty
>
> ----------------
>
> 1113 MB
>
>
> the field “fname” stores file names without any directory names. In our
> case, each record is expected to take around 300 bytes.
>
> However, this table contains 934829 records, which means each record takes
> about 1.2KB.
>
what does this query yield?

select pg_size_pretty(sum(length(fname))) from archive_files;

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Claire Chang 2011-08-04 20:27:13 Postgres 8.4 memory related parameters
Previous Message Jian Shi 2011-08-04 18:56:56 table size is bigger than expected