Hi,

I read the documents that the sharding-proxy example uses user_id in the
defaultDatabaseStrategy to decide which database the query routed to. If I
want to separate the data horizontally for all tables which each table may
have their own keys, how to configure the yaml file?

For example I have database 0 and database 1 with all the tables identical.
I want the data separated in half bases on the tables' primary keys like
the one below. How to write the sharding rules in the yaml file?

database0.employee
Primary Key: emp_id
Sharding Rule: emp_id % 2 = 0

database0.computers
Primary Key: serial_no
Sharding Rule: serial_no % 2 = 0

database1.employee
Primary Key: emp_id
Sharding Rule: emp_id % 2 = 1

database1.computers
Primary key: serial_no
Sharding Rule: serial_no % 2 =1

Regards,
Eric

Reply via email to