I am working on cursor based pagination and need a unique column which is sequential, so it would give proper fetch result. I know this can be solved by setting column as auto_increment with datatype bigint but eventually it will hit the limit of it which is 9223372036854775807.
So I am thinking like generating a sequential UUID like below which has compareTo result is 1.
cf3ea0ca-282d-11ec-9624-a71256fa1790
cf3ea0cb-282d-11ec-9624-410ea2fdd62c
cf3ea0cc-282d-11ec-9624-3b1a2da8c7d0
cf3ea0cd-282d-11ec-9624-877d8646d279
I generated these UUIDs using https://github.com/cowtowncoder/java-uuid-generator library
UUID uuid = Generators.timeBasedGenerator().generate();
This is how UUID can be generated, but it is not giving consistent results.
It there any other way to generate UUID which is sequential in ascending order.