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:

  1. change sharding scheme shard based on key use data. if it's id, id, , shard id (db = id % 10)

  2. make primary key of user table username. enforce uniqueness , use username foreign key in other tables, not synthetic identifier.

  3. create lookup table can reference maps ids shards.


Comments

Popular posts from this blog

jQuery Ajax Render Fragments OR Whole Page -

javascript - Iterate over array and calculate average values of array-parts -

ASP.NET Javascript: window.open won't work twice -