You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Doctrine currently seems to be blind for its own auto generated relation tables. This leads into several performance and other kind of problems.
For example, if you define a many-many-relation in the two Entities thru the annotations, and later have to access info thru this relation, it leads into several performance problems. Let's say you have a entity A and B, and now want to count the number of Bs related to A for each entry of A in an inner select, you currently have to use the sql command MEMBER OF:
(SELECT COUNT(at.id) FROM entityA at WHERE entityB MEMBER OF entityA.entitiesB)
It seems to happen often then, that Doctrine now converts this kind of simple information request to at least two additional subqueries, in addition to this one! In a complex query context, this will lead into drastical performance problems. Let's say that MEMBER OF seems to be a very costly function.
On the other hand, if you could access the relation table itself, you simply could do a:
(SELECT COUNT(rt.entity_a_id) FROM entityA_entityB rt WHERE rt.entity_b_id = entityB.id)
This one is a ton faster than the query above. So why are the relation tables invisible? It seems to me a unneccessary handicap for the programmer. Why is that?
The text was updated successfully, but these errors were encountered:
Doctrine currently seems to be blind for its own auto generated relation tables. This leads into several performance and other kind of problems.
For example, if you define a many-many-relation in the two Entities thru the annotations, and later have to access info thru this relation, it leads into several performance problems. Let's say you have a entity A and B, and now want to count the number of Bs related to A for each entry of A in an inner select, you currently have to use the sql command MEMBER OF:
(SELECT COUNT(at.id) FROM entityA at WHERE entityB MEMBER OF entityA.entitiesB)
It seems to happen often then, that Doctrine now converts this kind of simple information request to at least two additional subqueries, in addition to this one! In a complex query context, this will lead into drastical performance problems. Let's say that MEMBER OF seems to be a very costly function.
On the other hand, if you could access the relation table itself, you simply could do a:
(SELECT COUNT(rt.entity_a_id) FROM entityA_entityB rt WHERE rt.entity_b_id = entityB.id)
This one is a ton faster than the query above. So why are the relation tables invisible? It seems to me a unneccessary handicap for the programmer. Why is that?
The text was updated successfully, but these errors were encountered: