reduce number of joins when possible (bug 983749)