Optimize loading datastructures from DB

When a datastructure has one parent datastructureentity and then several child datastructure entities with ‘Normal’ relation, then the childs are loaded independently with ‘EXISTS’ part of where clause, where all the parent filters are repeated.

Optimization idea:
when the parent query returns 0 rows, than we know for sure there won’t be any data in childs for that parent rows. So we don’t have to even issue a query to the database. In some cases it saves a huge amount of resources.

Other idea would be to search children with clause ‘in’ and list of all parent ids. (but this deserves more effort now).

Done. Data structures are not loaded from database if query to their parent data structure table returned no results as suggested. This is only applied to data structures with “Normal” relation to their parent data structures.