|
|
|
|
|
by kenjackson
5370 days ago
|
|
I'm sure I missed something, but this doesn't guarantee unique keys across the database does it? What if you have two tables with the same autoincrement value being updated at the same millisecond by two users with the same UserID%NumShards? Or is there some relationship between physical and logical shards that makes this impossible? |
|
There's a 1:1 mapping between the user's hash modulo the number of shards, and the table they're writing to. So, if we had 1000 logical shards, we have 1000 schema/tablespaces, with the same tables in each. And the database's own 'nextval()' feature makes sure never have the same ID twice. Hope that clarified things.