Is it possible to have a globally unique incremented primary key across all nodes? #7397
Unanswered
Nandor Krizbai (nandor23)
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
As I understand correctly, the
bigserialtype is unique across all nodes by doing the following:Citus shifts the start of a bigserial by
node_group_id * 2^48, which means that you are limited to a maximum of 2^18 shards that are practically unlimited.The problem:
I need to produce the shortest possible unique strings in a column, and that's achieved by inserting a row into a table and then taking its primary key and encoding it to produce a string (then updating the desired column with it). Values generated from bigserial would be too big, as the encoded values would be long from the start.
Can the generated ID be unique across all nodes? Even if it's possible, I assume it would be a bottleneck.
Can the bigserial generation be modified so the initial shift would be defined manually?
What are the possible solutions?
All reactions