Re: column size and storage efficiency

From: Bruce Hyatt <brucejhyatt(at)yahoo(dot)com>
To: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: column size and storage efficiency
Date: 2008-11-26 15:10:44
Message-ID: 618392.43969.qm@web34404.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

--- On Tue, 11/25/08, Sean Davis <sdavis2(at)mail(dot)nih(dot)gov> wrote:

> > My inclination when creating tables is to create
> columns using
> > varchar-sizes in increments of 10 or 5 but I suspect
> there must be
> > more-efficient sizes, specifically, values like 16,
> 32, 64 minus
> > header-bits.
> >
> > - Is this true? Does it really have much impact on
> storage?
> > - How many bits are the headers?
> > - How does TOAST factor in?
>
>
> Believe it or not, specifying the varchar size has no
> impact on storage
> size. So, a varchar and a varchar(2) if both have two
> characters take the
> same storage space.

After thinking about it more, there can't be a direct relationship between number-of-characters and number-of-bits but what I meant was, if varchar(14) fills a block of storage, does varchar(15) use 2 blocks? Does it use twice the storage?

Bruce

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2008-11-26 15:19:46 Re: column size and storage efficiency
Previous Message Sean Davis 2008-11-26 02:08:18 Re: column size and storage efficiency