T
T
tukreb2020-06-12 09:32:31
Doctrine ORM
tukreb, 2020-06-12 09:32:31

How harmful is it to join tables where there is no information?

Doctrine uses JOINED table inheritance . For example: Item - (and many of its descendants)

In some tasks, it is necessary to refer to the ancestor of Item, namely to its common fields, and this leads to this
https://www.doctrine-project.org/projects/doctrine.. .

Quote from the site
There is a general performance consideration with Class Table Inheritance: If the target-entity of a many-to-one or one-to-one
association is a CTI entity, it is preferable for performance reasons that it be a leaf entity in the inheritance hierarchy, (ie. have no subclasses).
Otherwise Doctrine CANNOT create proxy instances of this entity and will ALWAYS load the entity eagerly.


That is, the JOIN doctrine of absolutely all children of the Item table, as a result, we get dozens of JOINs and maybe hundreds or more fields, of which 99% will be null, because they simply do not exist in the database.

So the question is, how much does it harm performance and is it necessary to reinvent the wheel to avoid it? Or will it have such a negligible effect that it is worth slaughtering and waiting for Doctine 3.0 ( https://github.com/doctrine/orm/issues/3509 )?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-06-12
@tukreb

And you measure time using doctrine and without, and you will get an answer. The fact that join is not free is a fact, how much depends on the specific task.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question