mysql - I can't tell in which DB a row is located from just the global identifier -
if have user table (with global id primary key) sharded across 10 databases (db1-db10) based on username, , table tries refer user table using user table row's global id, there no way me know db (1-10) user located in.
what solution problem?
either:
- change sharding scheme shard based on key use data. if it's id, id, , shard id (db = id % 10) 
- make primary key of - usertable- username. enforce uniqueness , use- usernameforeign key in other tables, not synthetic identifier.
- create lookup table can reference maps - ids shards.
Comments
Post a Comment