DATATYPE for HEX

From: "Ilja Golshtein" <ilejn(at)yandex(dot)ru>
To: pgsql-general(at)postgresql(dot)org
Subject: DATATYPE for HEX
Date: 2005-06-16 06:32:00
Message-ID: 42B11CE0.000008.08859@mfront7.yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Simon Riggs 2005-06-16 06:52:00 Re: [HACKERS] INHERITS and planning
Previous Message Nico Callewaert 2005-06-16 06:28:07 Re: Installation on latest version of Suse Linux