Reputation: 351
I'm planning a database that might in future be used in a clustered \ replicated manner. However, the question is if I can actually use integer for primary keys in this case or I must consider using string UUIDs for primary keys to avoid potential replication issues?
I've looked into the High Availability, Load Balancing, and Replication documentation but there is no mention of the actual keys as a consideration. Does it mean that any potential conflicts are resolved somehow?
Upvotes: 0
Views: 57
Reputation: 10018
I've looked into the High Availability, Load Balancing, and Replication documentation but there is no mention of the actual keys as a consideration. Does it mean that any potential conflicts are resolved somehow?
By definition, a Primary Key is unique. Therefore, you shouldn't run into any conflict. However, if you're planning to use multi-master replication, you could run into insert-insert conflicts, where two nodes choose to insert with the same PK value. If this happens, it's not due to data type selection (i.e., int v. uuid v. something-else), and your replication engine should be selected based on whether it has the mechanism to resolve the conflicts for you.
Disclosure: I work for EnterpriseDB (EDB)
Upvotes: 1