Re: UUID or auto-increment

Поиск
Список
Период
Сортировка
От Israel Brewster
Тема Re: UUID or auto-increment
Дата
Msg-id ED656DD2-64D2-4340-9933-D9951FF21CEB@alaska.edu
обсуждение исходный текст
Ответ на Re: UUID or auto-increment  ("Peter J. Holzer" <hjp-pgsql@hjp.at>)
Ответы Re: UUID or auto-increment  (John W Higgins <wishdev@gmail.com>)
Список pgsql-general

> On Aug 10, 2020, at 12:06 PM, Peter J. Holzer <hjp-pgsql@hjp.at> wrote:
>
> On 2020-08-10 09:10:00 -0800, Israel Brewster wrote:
>> I would point out, however, that using a V1 UUID rather than a V4 can
>> help with this as it is sequential, not random (based on MAC address
>> and timestamp + random).
>
> If I read the specs correctly, a V1 UUID will roll over every 429
> seconds. I think that as far as index locality is concerned, this is
> essentially random for most applications.

According to wikipedia, the time value in a V1 UUID is a 60-bit number, and will roll over "around 3400AD”, depending
onthe algorithm used, or 5236AD if the software treats the timestamp as unsigned. This timestamp is extended by a 13 or
14-bit“uniqifying" clock sequence to handle cases of overlap, and then the 48bit MAC address (constant, so no rollover
there)is appended. So perhaps that 13 or 14 bit “uniqifying” sequence will roll over every 429 seconds, however the
timestamp*as a whole* won’t roll over for quite a while yet, thereby guaranteeing that the UUIDs will be sequential,
notrandom (since, last I checked, time was sequential). 

---
Israel Brewster
Software Engineer
Alaska Volcano Observatory
Geophysical Institute - UAF
2156 Koyukuk Drive
Fairbanks AK 99775-7320
Work: 907-474-5172
cell:  907-328-9145

>
>        hp
>
> --
>   _  | Peter J. Holzer    | Story must make more sense than reality.
> |_|_) |                    |
> | |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
> __/   | http://www.hjp.at/ |       challenge!"




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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Certficates
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: UUID or auto-increment