You can use batching, see https://medium.com/mendix/five-tips-for-working-with-large-database-tables-in-mendix-170210f6f6fd
or
https://www.mendix.com/blog/limits-and-offsets/
“Should I use xpath constraint to check for missing association and put that in a list?” Yes.
An alternative is to retrieve your objects using OQL, although in this situation the performance-difference will not be substantial.