[ 
https://issues.apache.org/jira/browse/PHOENIX-1422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14242194#comment-14242194
 ] 

Lars Hofhansl commented on PHOENIX-1422:
----------------------------------------

:)

START WITH and INCREMENT BY would not be supported. GENERATE_ID() is nice. On 
another channel I proposed something like CREATE STATELESS SEQUENCE.

As for collisions... It depends how we do it. In theory we could just generate 
a 64 bit number (or 63 bit maybe). The chances of there being duplicate are 
lower than a meteor destroying your data center (assuming a good random number 
generator). Similarly to what is proposed above, it's possible to generate 

HLC looks like it needs some global state (c as described in the link)?

> Stateless Sequences
> -------------------
>
>                 Key: PHOENIX-1422
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1422
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: Lars Hofhansl
>
> [~apurtell] and I were chatting yesterday.
> It would be good if Phoenix had stateless sequences, i.e. sequences that give 
> out unique ids with (very) high probability.
> We can do that by starting with a timestamp, shifting it left 16 or 24 bits 
> left and fill in the new bits with a random number.
> So we're guaranteed to get a new id for each millisecond and within a 
> millisecond we break the tie with a random number. If we can make the 
> likelihood of duplicate numbers lower than (say) a data center failure, we're 
> OK. I would test this with a upsert into x ... select from x ... type query 
> inserting 100's of millions of rows.
> Need to think of a syntax too.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to