Re: Single Byte values

From: Antti Haapala <antti(dot)haapala(at)iki(dot)fi>
To: Jason Hihn <jhihn(at)paytimepayroll(dot)com>
Cc: Manfred Koizar <mkoi-pg(at)aon(dot)at>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Single Byte values
Date: 2003-04-05 11:27:19
Message-ID: Pine.GSO.4.44.0304051408400.10368-100000@paju.oulu.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> So I assume use of this is 'safe'? Any degridation on performance?

Hmm.. I believe it isn't standard...

> It appears that this datatype is also array compatible, CREATE TABLE
test3(a
> "char"[4]); works!
>
> I guess if space is so important, I could also just store
> (char[0]<<8|char[1]) into a smallint...

It's often better use int4(8) than char(1) as (primary) keys.

pros: int4 uses _less_ space, not affected by locales, operations are
surely -faster-. Larger range of values. I believe even int8 is faster
than char(1) and not many applications are ever going to exhaust 2^63
keyvalues.

cons: integer values often aren't quite mnemonic.

--
Antti Haapala

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Cristina Surroca 2003-04-05 14:01:24 Trying to Tunning DB
Previous Message pilsl 2003-04-05 09:24:58 convert human searchpattern to postgres-search