The router knows that some tables have been split into shards. If possible, the router tries to determine on the first transaction statement to which shard this transaction should be sent.
Copy
-- This query should works with properly sharding rulesINSERT INTO test(id, age) VALUES (10, 16);
But you can explicitly specify a shard or a sharding key in a comment request
Copy
-- But if you want to explicitly pass sharding key, you can do it like thisINSERT INTO test(id, age) VALUES (10, 16) /*__spqr__sharding_key: 30*/;
You can set a default shard for distribution. If there is a default shard, the router routes the query to that shard for an existing route.