DATATYPE for HEX - Mailing list pgsql-general

From Ilja Golshtein
Subject DATATYPE for HEX
Date
Msg-id 42B11CE0.000008.08859@mfront7.yandex.ru
Whole thread Raw
Responses Re: DATATYPE for HEX  ("Ilja Golshtein" <ilejn@yandex.ru>)
List pgsql-general
Hello!

I am choosing the best (fastest and smallest) datatype for
storing some 16-byte length application-level binary
identifiers.

This data probably must be indexed. The only operation
I really need is comparision (equal or not) and, probably,
ORDER BY.

Most natural type BINARY(16) is absent in PostgreSQL, so
my first choice was BYTEA. After that I discovered BIT(128)
is about 15% faster then BYTEA and NAME is approximately
10% faster then BIT(128).

NUMERIC is slower then BYTEA and CHAR is much slower (I use UNICODE).

Since NAME is intended for internal usage only, I am about
to switch from BYTEA to BIT.

My question are
1. What is the best datatype for my purposes?
2. Should I expect any hidden dangers here (e.g. some special types
of queries are significantly slower, say, for BIT than for BYTEA)?
3. Are there any general guidelines how to choose most suitable datatype?

Thanks a lot.

--
Best regards
Ilja Golshtein

pgsql-general by date:

Previous
From: Nico Callewaert
Date:
Subject: Re: Installation on latest version of Suse Linux
Next
From: Simon Riggs
Date:
Subject: Re: [HACKERS] INHERITS and planning