heavy optimization of update_relationship