Skip to content
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

Poor performance #38

Open
clemtrib-leeroy opened this issue Apr 5, 2023 · 3 comments
Open

Poor performance #38

clemtrib-leeroy opened this issue Apr 5, 2023 · 3 comments

Comments

@clemtrib-leeroy
Copy link

Same #32

We will deactivate this plugin because we have timeouts and the asset list doesn't load when the plugin is activate.

Enabling the plugin and switching on the usage columns causes the asset index screens to load very slowly.

Craft CMS 4.4.6 | Asset Usage 3.1.0 | PHP version 8.2.2

@engram-design
Copy link

Found the same thing, massive timeouts with some folder that make this plugin unusable, sorry to say!

@MoritzLost
Copy link

Same here. As soon as the usage column is enabled, a folder with <100 files goes from a couple hundred miliseconds to multiple seconds load time.

@roelvanhintum I had a look how the count is implemented, pretty sure this is the culprit:

https://github.com/born05/craft-assetusage/blob/craft4/src/services/Asset.php#L30-L39

The additional call to Craft::$app->elements->getElementById means that every single element related to any asset in the list is queried and loaded individually.

The service uses a direct query against the relations table. Maybe instead of filtering the results after this query, the function can join the elements table to the initial query? This one has the canonicalId, draftId and revisionId fields, should be able to exclude revisions this way, right?

@ishetnogferre
Copy link

ishetnogferre commented Oct 7, 2024

Same here, on sites with a lots of content, it really makes the CMS unusable. We ran into performance issues because of running a LIKE '%__%' with no index.

On Craft 5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants