If you ever see random deadlocks on concurrent batch
INSERT ... ON CONFLICT or ON DUPLICATE KEY UPDATE queries, check the ordering of your input array. Sorting the rows by primary or unique key before executing the batch ensures every worker acquires row locks in the exact same order.commit 4ea2c11