Re: Single Byte values - Mailing list pgsql-general

From Antti Haapala
Subject Re: Single Byte values
Date
Msg-id Pine.GSO.4.44.0304051408400.10368-100000@paju.oulu.fi
Whole thread Raw
In response to Re: Single Byte values  (Jason Hihn <jhihn@paytimepayroll.com>)
Responses Re: Single Byte values  (Joel Rees <joel@alpsgiken.gr.jp>)
List 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


pgsql-general by date:

Previous
From: pilsl@goldfisch.at
Date:
Subject: convert human searchpattern to postgres-search
Next
From: "Cristina Surroca"
Date:
Subject: Trying to Tunning DB