Re: varchar as primary key

Поиск
Список
Период
Сортировка
Искать
От
Jeff Davis
Тема
Re: varchar as primary key
Дата
в 15:26:39
Msg-id
1178216787.28383.281.camel@dogma.v10.wvs
Ответ на
varchar as primary key (Matthew Hixson)
Список
Дерево обсуждения
varchar as primary key Matthew Hixson <hixson@poindextrose.org>
Re: varchar as primary key Jeff Davis <pgsql@j-davis.com>
Re: varchar as primary key "Dawid Kuroczko" <qnex42@gmail.com>
Re: varchar as primary key William Garrison <postgres@mobydisk.com>
Re: varchar as primary key Alvaro Herrera <alvherre@commandprompt.com>
Re: varchar as primary key "Alexander Staubo" <alex@purefiction.net>
Re: varchar as primary key Jeff Davis <pgsql@j-davis.com>
Re: varchar as primary key Tom Lane <tgl@sss.pgh.pa.us>
Re: varchar as primary key Jeff Davis <pgsql@j-davis.com>
Re: varchar as primary key Tom Lane <tgl@sss.pgh.pa.us>
Re: varchar as primary key Jeff Davis <pgsql@j-davis.com>
Re: varchar as primary key Tom Lane <tgl@sss.pgh.pa.us>
Re: varchar as primary key Martijn van Oosterhout <kleptog@svana.org>
Re: varchar as primary key Jeff Davis <pgsql@j-davis.com>
Re: varchar as primary key "Merlin Moncure" <mmoncure@gmail.com>
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
FAQ