From: | Manfred Koizar <mkoi-pg(at)aon(dot)at> |
---|---|
To: | Jason Hihn <jhihn(at)paytimepayroll(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Single Byte values |
Date: | 2003-04-03 22:52:32 |
Message-ID: | d0cp8vg905jnro2q809japu8bclm0efo8k@4ax.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 03 Apr 2003 13:35:24 -0500, Jason Hihn
<jhihn(at)paytimepayroll(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Ed L. | 2003-04-03 23:37:03 | dbmirror revisions |
Previous Message | Tom Lane | 2003-04-03 22:41:35 | Re: ERROR: heap_mark4update: (am)invalid tid in triggers |