Re: Single Byte values - Mailing list pgsql-general

From Manfred Koizar
Subject Re: Single Byte values
Date
Msg-id d0cp8vg905jnro2q809japu8bclm0efo8k@4ax.com
Whole thread Raw
In response to Single Byte values  (Jason Hihn <jhihn@paytimepayroll.com>)
Responses Re: Single Byte values  (Jason Hihn <jhihn@paytimepayroll.com>)
List pgsql-general
On Thu, 03 Apr 2003 13:35:24 -0500, Jason Hihn
<jhihn@paytimepayroll.com> wrote:
>As someone pointed out, CHAR(1) costs 5 bytes.

Jason, you already found out, that char(1) uses

>4 bytes(stored string length) + 1 data in the case of char(1).

All char(n) types are stored on 4 byte boundaries, so char(1) costs up
to 8 bytes.

>But in returning to my question, what should I be using for char(1) to
>char(4) storage?

Instead of char(1) you can use the Postgres specific type "char"
(*with* the quotes) which only needs one byte.

For char(n) a little toy has been posted to -hackers half a year ago
(cf. discussion around
http://archives.postgresql.org/pgsql-hackers/2002-10/msg00501.php).
Feel free to play around with it.  Though I wouldn't take the trouble
if only a few thousand rows are involved...

Servus
 Manfred


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: ERROR: heap_mark4update: (am)invalid tid in triggers
Next
From: "Ed L."
Date:
Subject: dbmirror revisions