Re: fixed-length row

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: David Garamond <lists(at)zara(dot)6(dot)isreserved(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: fixed-length row
Date: 2004-01-15 21:15:02
Message-ID: 20040115211502.GA26587@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 15, 2004 at 09:17:55PM +0700, David Garamond wrote:
> The MySQL manual recommends that we create a "fixed-length row" if
> possible, for speed (especially scanning speed). A fixed-length row is a
> row which is comprised of only fixed-length fields. A fixed-length field
> takes a fixed amount of bytes for storage (e.g. INT = 4 bytes, CHAR(M) =
> M bytes, etc).

Just remember that there are no fixed length string types. Your assumption
that char(M) = M bytes is wrong. M characters can take essentially any
length in bytes depending on the encoding. Storing strings as CHAR a field
takes the same amount of space as in a VARCHAR or TEXT field. The only
difference is in the contraint checking on insert and the handling of
trailing spaces.

That said, somewhere in the pg_attriute table is a column that says the size
in bytes or variable.
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> (... have gone from d-i being barely usable even by its developers
> anywhere, to being about 20% done. Sweet. And the last 80% usually takes
> 20% of the time, too, right?) -- Anthony Towns, debian-devel-announce

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message culley harrelson 2004-01-15 21:18:16 why isn't TEXT a key word?
Previous Message Ralph Spitzer 2004-01-15 20:39:54 Survey: Motivations to Contribute