typeorm-polymorphic icon indicating copy to clipboard operation
typeorm-polymorphic copied to clipboard

Creates N queries for hydrateMany

Open xtrinch opened this issue 3 years ago • 2 comments

This package creates one query per item for hydrateMany, and that is very slow as it would do 50 separate queries for 50 items that you want to hydrate.

It should make one query for all entities and then just map the result to the entities you want to hydrate.

xtrinch avatar Mar 12 '21 11:03 xtrinch

I think it should either do that OR execute 1 query per entity type.

@bashleigh , any thoughts on this? I'd potentially be interested in working on a PR if you were on board.

jspizziri avatar Jul 13 '21 13:07 jspizziri

@jspizziri Yes please do! That would've been a much better solution! Can't remember why I did each programatically! There's also an issue surrounding the calling to the database on the child->parent side that you might be able to resolve at the same time. The conditions I made seem to always favour the wrong relationship

bashleigh avatar Aug 16 '21 07:08 bashleigh