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.SPQR supports both single-column and composite (multi-column) sharding keys.
Copy
-- This query works with properly configured 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
-- 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*/;
For composite sharding keys, specify all key values separated by commas: