From: | G Hasse <gorhas(at)raditex(dot)nu> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Sequence vs UUID |
Date: | 2023-01-27 01:54:13 |
Message-ID: | d98cd2d2-f3ca-5096-4baa-3172bffc53f9@raditex.nu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 also have
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 the blogs(one is below) across multiple databases, I saw over the internet and all are mostly stating the sequence is better as compared to UUID. But I think in the case of concurrent data load scenarios UUID will spread the contention point whereas 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 available for each of those to understand the exact scenario in which we should go for one over other? Basically I wantedto see if we can perform some test on sample data to see the percentage of overhead on read and write performances of the query in presence of UUID VS Sequence to draw some conclusion in general? And also considering open source postgres as the base for many databases like redshift etc, so the results which apply to progress would apply to others as well.
>
> 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(at)raditex(dot)nu
http://www.raditex.nu
Raditex Control AB
Bo 229, 715 91 ODENSBACKEN
Mob: 070-5530148
From | Date | Subject | |
---|---|---|---|
Next Message | Max Nikulin | 2023-01-27 12:12:08 | timestamptz, local time in the future, and Don't do it wiki |
Previous Message | Ron | 2023-01-27 00:48:50 | Re: Sequence vs UUID |