Re: Sequential UUID Generation

From: Uday Bhaskar V <uday(dot)bhaskar579(at)gmail(dot)com>
To: tomas(dot)vondra(at)2ndquadrant(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Sequential UUID Generation
Date: 2018-10-30 13:22:15
Message-ID: CAFowjW2QcUx-xhEXTMi=6QbeBCNjjttYzVyunv+Tv7s9PmE=hA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks Tomas! I will try.

Regards,
Uday

On Tue, Oct 30, 2018 at 6:43 PM Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
wrote:

> I don't think PostgreSQL has anything like that at the moment. It would
> not be difficult to tweak the UUID generator to generate sequential (or
> monotonic) values, the tricky part seems to be durability requirements.
>
> One idea would be to simply store the value in (shared) memory, but that
> would mean losing the state on restart/crash, so there would need to be
> some sort of protection against generating duplicate values (say, using
> postmaster timestamp as the first 64 bits of the UUID).
>
> Another idea is to piggy-back this on bigint sequence somehow - split
> the 128bit range into 64+64, use the sequence value for the first 64b
> and pick the other half by random. That would guarantee both uniqueness,
> monotonicity and durability. And it would also be fairly random, making
> it difficult to guess UUIDs.
>
> regards
>
> On 10/29/2018 04:06 PM, Uday Bhaskar V wrote:
> > Hi,
> >
> > We have migrated from Oracle to Postgres, there because of the
> > replication requirements we used UUID columns.
> > I did a POC(in postgres) with sequential UUID against Non sequential
> > which has shown lot of different in space utilization and index size.
> > Sql server has "newsequentialid" which generates sequential UUID. I
> > need similar functionality here.
> > I want to create a function which generates a sequential UUIDs, Any
> > suggestions or support would be much appreciated.
> >
> > Thanks,
> > Uday
>
> --
> Tomas Vondra http://www.2ndQuadrant.com
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Banck 2018-10-30 13:22:26 Re: Online verification of checksums
Previous Message Laurenz Albe 2018-10-30 13:18:12 Re: Getting fancy errors when accessing information_schema on 10.5