RE: [Proposal] global sequence implemented by snowflake ID - Mailing list pgsql-hackers

From Hayato Kuroda (Fujitsu)
Subject RE: [Proposal] global sequence implemented by snowflake ID
Date
Msg-id TY3PR01MB9889C4ED12BF54BA4FF59919F582A@TY3PR01MB9889.jpnprd01.prod.outlook.com
Whole thread Raw
In response to Re: [Proposal] global sequence implemented by snowflake ID  (Nikita Malakhov <hukutoc@gmail.com>)
List 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


pgsql-hackers by date:

Previous
From: Andrei Lepikhov
Date:
Subject: Re: POC, WIP: OR-clause support for indexes
Next
From: John Naylor
Date:
Subject: Re: [dynahash] do not refill the hashkey after hash_search