Re: varchar as primary key

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: varchar as primary key
Дата
Msg-id 1178216787.28383.281.camel@dogma.v10.wvs
обсуждение исходный текст
Ответ на varchar as primary key  (Matthew Hixson <hixson@poindextrose.org>)
Ответы Re: varchar as primary key  ("Dawid Kuroczko" <qnex42@gmail.com>)
Список pgsql-general
On Thu, 2007-05-03 at 08:58 -0700, Matthew Hixson wrote:
> I'm investigating the usage of a UUID primary key generator using
> Hibernate and Postgres.  The reason for using a UUID is that we will
> have an application hosted at different sites in different
> databases.  We will need to aggregate the data back into a single
> database from time to time and we want to avoid PK collisions.
>    Is there a significant performance difference between using int
> primary keys and string primary keys in Postgres?

If the only thing you need to do is avoid primary key collisions, why
not just store an extra int that represents the "site ID" and have a
primary key on (the_key, site_id)?

That way you're *sure* no collisions happen. A UUID has a lot of bits,
but if the random generator is flawed a collision can still happen.

Regards,
    Jeff Davis


В списке pgsql-general по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: varchar as primary key
Следующее
От: "Alexander Staubo"
Дата:
Сообщение: Re: varchar as primary key