Re:UUID, serial or identity columns for PostgreSQL auto-gene...
by Benjammer on Monday May 31, 2021 @03:04PM
(#27347169)
I think you can probably get the same "batching benefits" if you use a global ID generation service of some sort, with sequential IDs to improve indexing. Using sequential IDs doesn't necessitate using auto-generated sequential IDs.
[ Parent
| on HN ]
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).