One global query instead of one for each pair