RE: [Proposal] global sequence implemented by snowflake ID

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Nikita Malakhov' <hukutoc(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: RE: [Proposal] global sequence implemented by snowflake ID
Date: 2023-11-30 08:42:27
Message-ID: TY3PR01MB9889C4ED12BF54BA4FF59919F582A@TY3PR01MB9889.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Nikita,

Thanks for reading my patch!

>
I have reviewed the patch in this topic and have a question mentioning the machine ID -
INSERT INTO snowflake_sequence.machine_id
SELECT round((random() * (0 - 511))::numeric, 0) + 511;

This kind of ID generation does not seem to guarantee from not having the same ID in a pool
of instances, does it?
>

You are right. For now the part is randomly assigned, but it might be duplicated on another instance.
Maybe we should provide a way for setting it manually. Or, we may able to use another way
for determining machine ID.
(system_identifier is too long to use here...)

Note that the contrib module was provided just for the reference. We are now
discussing high-level items, like needs, use-cases and approaches. Could you
please your opinion around here if you have?

The implementation may be completely changed, so I did not change yet. Of course,
your comment is quite helpful so that it will be handled eventually.

Best Regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2023-11-30 08:51:39 Re: [dynahash] do not refill the hashkey after hash_search
Previous Message Andrei Lepikhov 2023-11-30 08:30:28 Re: POC, WIP: OR-clause support for indexes