Update component metrics in project metrics update procedure #544
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.
Description
Updates component metrics in the project metrics update procedure.
Instead of fetching component UUIDs first, then calling the
UPDATE_COMPONENT_METRICS
procedure for every single UUID individually, and then updating the project metrics.The previous approach resulted in:
SELECT
query to fetch all N component UUIDsUPDATE_COMPONENT_METRICS
UPDATE_PROJECT_METRICS
Which resulted in lots of wasted resources.
Refreshing metrics for all projects in a portfolio with 400 total projects completes in 5s instead of 20s on my machine. I expect the difference to be even more drastic in deployments where the database is running on a different machine, and network latency plays a bigger role.
Addressed Issue
N/A
Additional Details
N/A
Checklist
This PR fixes a defect, and I have provided tests to verify that the fix is effectiveThis PR introduces new or alters existing behavior, and I have updated the documentation accordingly