cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[NFR] Eager loading support of Phalcon\Mvc\Model

Open hilyjiang opened this issue 13 years ago • 79 comments

Once we use model, we always define relationships between models.

In most cases, we need to implement a list view, displaying objects with its foreign key field's value.

This will cause a N+1 selects problem (http://use-the-index-luke.com/sql/join/nested-loops-join-n1-problem), slowing down the performance.

So I think it is necessary to implement the eager loading feature of Phalcon\Mvc\Model.

hilyjiang avatar Aug 19 '13 16:08 hilyjiang

+1

joeyew avatar Aug 28 '13 08:08 joeyew

+1

Raistlfiren avatar Oct 11 '13 12:10 Raistlfiren

+1

ghost avatar Dec 04 '13 12:12 ghost

Your can use leftJoint at another ORM but in phalcon leftJoin relations isn`t selected to object only run in sql https://github.com/phalcon/cphalcon/issues/1111?

ovr avatar Dec 04 '13 13:12 ovr

+1

nazieb avatar Apr 15 '14 08:04 nazieb

+1

kamote avatar Apr 20 '14 15:04 kamote

What's the status of this one? Or do I have to give up phalcon?..

olegrom32 avatar Jun 16 '14 21:06 olegrom32

+1

dcwq avatar Sep 18 '14 12:09 dcwq

+1

mrthebob avatar Sep 18 '14 16:09 mrthebob

+1

calinrada avatar Sep 19 '14 10:09 calinrada

+1

Can we expect anything to happen with it? It's quite a basic feature I think, it should be handled with high priority if I may categorize its severity.

But at least a tiny feedback would be good about it to know if we can expect it to be implented or should learn a different ORM. Because without this feature this ORM handles only separate entities, not entities with relations. Lazy loading is only a tiny help but doesn't care about data integrity and mostly not about performance. But on the other hand, Phalcon is so good, should make its ORM to be usable as well, big +1 vote for this feature.

dexx086 avatar Sep 22 '14 10:09 dexx086

+1

boedy avatar Sep 22 '14 12:09 boedy

+1

AndreBaumeier avatar Sep 24 '14 10:09 AndreBaumeier

Is there an alternative to solving this N+1 problem?

boedy avatar Sep 24 '14 10:09 boedy

I could think of creating stubs and populating explicitly joined data in those stubs, for other unavailable attributes I'd fall back to lazy loading/ load them once requested.

AndreBaumeier avatar Sep 24 '14 10:09 AndreBaumeier

+1

tanagorns avatar Oct 04 '14 14:10 tanagorns

+1

giftymalik avatar Oct 07 '14 06:10 giftymalik

+1

scarbo87 avatar Oct 07 '14 20:10 scarbo87

+1

titus-toia avatar Oct 24 '14 09:10 titus-toia

+1

fatihkurt avatar Oct 27 '14 14:10 fatihkurt