Re: join by char(16) or by bytea?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Sergei Shelukhin" <realgeek(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: join by char(16) or by bytea?
Date: 2007-04-09 20:33:46
Message-ID: 10231.1176150826@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Sergei Shelukhin" <realgeek(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-04-09 20:38:34 Re: NEWBIE: How do I get the oldest date contained in 3 tables
Previous Message Tom Lane 2007-04-09 20:26:58 Re: Problem with copying data