Preliminary work to reduce the number of association queries