Improve query speed for IslandoraUtils::getTermForUri() #1067
+55
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Continuation of #997
Closes Islandora/documentation#2272
What does this Pull Request do?
Improve performance for
IslandoraUtils::getTermForUri()
. Sets the new approach as the default, allowing sites to revert to the current, single query approach with a config checkbox in Islandora settings.How should this be tested?
Made a simple drush script
Then ran it and it took 17s to complete
$ time drush scr scripts/1067.php real 0m 17.46s user 0m 0.52s sys 0m 0.38s
Applied this PR and ran again and execution dropped to 1s
It's definitely the query here causing the slowdown, as if I replace the query with $results = [12]; I get similar 1s executions.
Here's the query that entityTypeManager is running:
I think due to the orGroup this is slowing down these queries. It appears be more efficient to run several queries.
Documentation Status
Additional Notes:
Any additional information that you think would be helpful when reviewing this
PR.
Interested parties
Tag (@ mention) interested parties or, if unsure, @Islandora/committers