postgresql: Avoid deadlocks by ordering rows before insertion
It's a common issue when concurrently inserting batches which contain the same items in different order; reordering them consistently worked on both the indexer-storage and the provenance-storage, so it should work here too.
https://sentry.softwareheritage.org/share/issue/5294cd5d125d49c18fb1eac29c29fe56/