Currently, the multi-row INSERT rewrite doesn't check the values and blindly rewrites the statement into one INSERT per value tuple. Perform a value/shard check instead, and if all values belong to one shard, skip the rewrite and send the statement as-is to the destination shard.
Example
INSERT INTO sharded_table (id, value) VALUES (1, 2), (2, 2)
Same sharding key - same shard, no need to split.
Currently, the multi-row INSERT rewrite doesn't check the values and blindly rewrites the statement into one INSERT per value tuple. Perform a value/shard check instead, and if all values belong to one shard, skip the rewrite and send the statement as-is to the destination shard.
Example
Same sharding key - same shard, no need to split.