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