Re:UUID, serial or identity columns for PostgreSQL auto-gene...
by tehlike on Monday May 31, 2021 @03:12PM
(#27347243)
correct, but global service need local caching. Some "HiLo" type identity generation could work. Sequential-UUID simplifies it as you don't need that service, so it's preferable.
HiLo explanation below:
A client simply gets a range of ids to be used, exclusive to them. Then can use it without any roundtrip to server.
This can be achieved with a "hi" stored on service, and a batchSize that's constant in the system.
Each time a "hi" is requested, it's incremented by 1.
Now the client can generate (hi * batchsize, (hi+1) * batchsize - 1).
HiLo explanation below:
A client simply gets a range of ids to be used, exclusive to them. Then can use it without any roundtrip to server.
This can be achieved with a "hi" stored on service, and a batchSize that's constant in the system.
Each time a "hi" is requested, it's incremented by 1. Now the client can generate (hi * batchsize, (hi+1) * batchsize - 1).