|
Hi, I’ve a critical performance problem while loading an
object containing several 1:m relations to other
objects. The generated SQL performs a recursive LEFT OUTER JOIN for each collections
found in the object. For instance, If object A references 2 collections, one of
objects A1 and the other of objects A2 then the generated SQL statement to load
object A will be: SELECT A.*, A1.*, A2.* FROM A LEFT OUTER JOIN A1 on A.id=A1.parentID LEFT OUTER JOIN A2 on A.id=A2.parentID WHERE A.id = ? This syntax seems strange and subject to performance issue as the first
join will be executed and then for EACH returned record, the second join will
be executed. This means that if A contains 20 objects of type A1 and 20 objects
of type A2, the statement will return 400 records (20x20). Is it a known issue or do I missed something ?? Regards, Benjamin. |
