Closed szarnyasg closed 4 years ago
We can keep the current optimization (using of TRIU) without sorting the persons. The query is symmetric and comparison of IDs is only used to filter duplicates and have a consistent output. A simple solution is to transform the output by swapping the IDs if necessary:
p1_id=...
p2_id=...
if(p1_id>p2_id):
temp=p1_id
p1_id=p2_id
p2_id=temp
We select the upper triangle to ensure p1 < p2 in the dense ids. This only maps back to the sparse ids correctly, we need to make sure that they were originally sorted.
Temporary workaround:
cc @sandordavid1124
A permanent solution would be to sort the
persons.csv
file beforehand.