Optimized queries to exists in an entitie group