moved limit to nested query to avoid missing many-to-one delete targets that exceed limit