Re: Sequence vs UUID

Поиск
Список
Период
Сортировка
От G Hasse
Тема Re: Sequence vs UUID
Дата
Msg-id d98cd2d2-f3ca-5096-4baa-3172bffc53f9@raditex.nu
обсуждение исходный текст
Ответ на Sequence vs UUID  (veem v <veema0000@gmail.com>)
Ответы Re: Sequence vs UUID  (Rob Sargent <robjsargent@gmail.com>)
Список pgsql-general
Hello.

I have been using UUID for quite a long time now. The reason I began to use UUID was the need to be able to move data
between
databases and the need to create record outside the database. You should use UUID as a primary key for a record and
alsohave
 
some bookkeeping UUID:s in the record like "origin" of the record. In this way it is "easy" to handle different sources
of
data.

We have also written some nice replicating software on this basis (postsync) that can check for alterations in one
database
and update others. In this way we can keep one or many replicas of databases.

So forget about performance issues (there will ALWAYS be need for faster systems). The ease and functionality with
UUID
is so mutch better. Sequence keys are a terrible idea!

// GH


Den 2023-01-26 kl. 20:17, skrev veem v:
> Hello, We were trying to understand whether we should use UUID or Sequence in general for primary keys. In many of
theblogs(one is below) across multiple databases, I saw over the internet and all are mostly stating the sequence is
betteras compared to UUID. But I think in the case of concurrent data load scenarios UUID will spread the contention
pointwhereas sequence can be a single point of contention.
 
> 
> So we want to understand from experts here, if there are anyclear rules available or if we haveany pros vs cons list
availablefor each of those to understand the exact scenario in which we should go for one over other? Basically I
wantedtosee if we can perform some test on sample data to see the percentage of overhead on read and write performances
ofthe query in presence of UUID VS Sequence to draw some conclusion in general? And also considering open source
postgres asthe base for many databases like redshift etc, so the results which apply to progress would apply to others
aswell.
 
> 
> https://www.percona.com/blog/2019/11/22/uuids-are-popular-but-bad-for-performance-lets-discuss/
<https://www.percona.com/blog/2019/11/22/uuids-are-popular-but-bad-for-performance-lets-discuss/>
> 

-- 
gorhas@raditex.nu
http://www.raditex.nu
Raditex Control AB
Bo 229, 715 91 ODENSBACKEN
Mob: 070-5530148



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

Предыдущее
От: Ron
Дата:
Сообщение: Re: Sequence vs UUID
Следующее
От: Max Nikulin
Дата:
Сообщение: timestamptz, local time in the future, and Don't do it wiki