Re: fixed-length row - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: fixed-length row
Date
Msg-id 20040115211502.GA26587@svana.org
Whole thread Raw
In response to fixed-length row  (David Garamond <lists@zara.6.isreserved.com>)
Responses Re: fixed-length row
List 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@svana.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

Attachment

pgsql-general by date:

Previous
From: culley harrelson
Date:
Subject: why isn't TEXT a key word?
Next
From: Tom Lane
Date:
Subject: Re: serverless postgresql