Re: join by char(16) or by bytea? - Mailing list pgsql-general

From Tom Lane
Subject Re: join by char(16) or by bytea?
Date
Msg-id 10231.1176150826@sss.pgh.pa.us
Whole thread Raw
In response to join by char(16) or by bytea?  ("Sergei Shelukhin" <realgeek@gmail.com>)
List pgsql-general
"Sergei Shelukhin" <realgeek@gmail.com> writes:
> Due to limitations of both pg and php I gave up on the attempts to
> make bigint keys work;

Which limitations would those be?

> I have a choice between 16-byte character
> strings or "8-byte" bytea (decode(string_from_above, "hex")) for an
> index column for a table.
> Which one will be faster for exact matches and joins?

bytea, likely, especially if you are using a non-C locale.  In C locale
the charstring comparisons would degenerate to memcmp and probably not
be measurably different from bytea, but in other locales strcoll is
used and that can be pretty slow.  OTOH, the pain-in-the-neck factor
for using decode in all your queries seems pretty bad, so I'm really
wondering what problem you've got with bigint.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Problem with copying data
Next
From: Tom Lane
Date:
Subject: Re: NEWBIE: How do I get the oldest date contained in 3 tables