Re: [HACKERS] varchar/char size

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: lockhart(at)alumni(dot)caltech(dot)edu (Thomas G(dot) Lockhart)
Cc: hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] varchar/char size
Date: 1998-01-08 03:24:21
Message-ID: 199801080324.WAA22919@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> Bruce Momjian wrote:
>
> > >
> > > > Does someone want to remind me why we allocate the full size for char()
> > > > and varchar(), when we really can just allocate the size of the given
> > > > string?
> > > > I relize char() has to be padded, but why varchar()?
> > >
> > > > In my experience, char() is full size as defined by create, and
> > > > varchar() is the the size of the actual data in the field, like text,
> > > > but with a pre-defined limit.
> > >
> > > Well, in many relational databases access can be optimized by having
> > > fixed-length tuple storage structures. Also, it allows re-use of deleted
> > > space in storage pages. It may be that neither of these points have any
> > > bearing on Postgres, and never will, but unless that clearly the case then
> > > I would be inclined to keep the storage scheme as it is currently.
> >
> > With Ingres and Informix char() is fixed size, while varchar() is
> > VARiable size.
>
> Go for it. Let me know if I can help with testing or anything...

I know we have text, and that it is better than the others, but if our
varchar() were both variable sized storage, and you could place a max on
it, it would be useful for certain applications.

--
Bruce Momjian
maillist(at)candle(dot)pha(dot)pa(dot)us

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-01-08 04:31:02 varchar() change
Previous Message Thomas G. Lockhart 1998-01-08 03:20:14 Re: [HACKERS] varchar/char size