New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media tree loading performs badly because EntityRepository is fetching all property data for media #3457

Closed
clausjensen opened this Issue Oct 27, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@clausjensen
Copy link
Contributor

clausjensen commented Oct 27, 2018

EntityRepository is fetching all property data for media items since this commit (34cebe9#diff-2528351576cfa71144920691d767da0bR126).

Not really sure why... EntityRepository should really only be fetching really slim versions of entities, but I guess there was a reason why this was done this way back then.

The problem is that since the EntityService / EntityRepository is also being used by other things such as the tree, this can easily create performance issues. The tree cannot use paging for its queries (since a tree needs to list everything at once) so these queries will be fetching all entities, with all property data even though the property data isn't really needed for trees.

When a site has a large amount of property data to query in (this can be any data - such as many content versions = a lot of property data) - this will basically kill the database having to query in this table with the joins created by this code.

The best solution would be to clean up the EntityRepository to not do this and move the responsibility for getting media entities with property data somewhere else. This would however mean a breaking change, so instead we could create new internal methods that work around this issue - meaning we won't break any existing API functionality, but we still make sure the media tree doesn't kill the database in these circumstances.

@Shazwazza

This comment has been minimized.

Copy link
Member

Shazwazza commented Nov 1, 2018

PR: #3460

@Shazwazza

This comment has been minimized.

Copy link
Member

Shazwazza commented Nov 1, 2018

I've updated the PR and it's all merged in now. Unfortunately i forgot to do a squash merge, so it's just merged. If we need to put this into a path release then we can cherry pick the 3 or so commits.

@Shazwazza Shazwazza closed this Nov 1, 2018

@wafflebot wafflebot bot removed the state/in-progress label Nov 1, 2018

@nul800sebastiaan nul800sebastiaan changed the title EntityRepository is fetching all property data for media Media tree loading performs badly because EntityRepository is fetching all property data for media Jan 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment