Re: UUID column as pimrary key?

Поиск
Список
Период
Сортировка
От Michael Satterwhite
Тема Re: UUID column as pimrary key?
Дата
Msg-id 201101051711.35715.michael@weblore.com
обсуждение исходный текст
Ответ на Re: UUID column as pimrary key?  (Andrew Sullivan <ajs@crankycanuck.ca>)
Ответы Re: UUID column as pimrary key?
Re: *****SPAM***** Re: UUID column as pimrary key?
Список pgsql-general
I've been enjoying this discussion, but it seems to me there are two
possibilities that guarantee unique results, use less storage, and neither
would use a UUID for the primary key.

The first would assume that only one machine is doing the work on the database.
As has been pointed out earlier, in this case the simplest solution would be
to simply use a series. As that is guaranteed unique on a single machine and
is incredibly simple to implement.

Once multiple machines are linked to maintain the database, this has a flaw in
it as a series is not guaranteed to be unique between machines (actually I
think they're pretty well guaranteed *NOT* to be, but that's another issue. In
that case, another field is needed as follows:

     Create table test
    (  id serial,
      machine_id integer,
    .....
    primary_key(machine_id, id);
    )

Each machine would have a unique machine_id. This would guarantee uniqueness
and be very easy to maintain. In addition - *IF* it were ever necessary - it
would be easy to determine which machine generated records.

OK, I'm probably going to regret jumping in here, but I couldn't resist.

Sorry

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

Предыдущее
От: Rob Sargent
Дата:
Сообщение: Re: UUID column as pimrary key?
Следующее
От: dennis jenkins
Дата:
Сообщение: Re: UUID column as pimrary key?