I am weighing my options for integer primary keys that can be used in multi master replication. (I'm pretty much sold on using integer keys instead of GUIDs)
The best I can come up with is having the most significant data first and having the server number last: eg. invoice 1 on server 1 = 101 invoice 1 on server 2 = 102 where the non serverno part (invoiceno) comes from a db number generator
algorithmically: gen_id(INVOICENO_GEN, 1) * 100 + serverno and you can get the server number by both looking at the value and mathematically.
Which leaves room for 99 servers while still being short and readable and won't collide. Using that scheme and normal integer size column would make the max rows (21 474 836) or if bigint is used many billions.
for instance the invoice table keys would look like this:
Server 1
101
201
301
401
Server 2
102
202
302
402
So my question is: any critiques or flaws I have overlooked?
The database is Firebird.