Preload dates_source when the widget is requested
What does this MR do and why?
Whenever the/epics
page on the group level is loaded (and not only, every time we are requesting the widget WorkItemWidgetStartAndDueDate
on a query to get the WorkItem
), some n+1 queries are executed for loading the dates_source
relations, as they are loaded for each work item. In this MR, we are trying to preload the associations for all the work items to avoid the extra queries to the DB.
As you can see in the before screenshot, for each work item, we are loading the dates_source table. In the after screenshot, we are preloading the records and we are performing only one query to load them all.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
![]() |
![]() |
How to set up and validate locally
A simple way to validate it, it to go in graphiql explorer in your local environment and perform this sample query, and check your logs for WorkItems::DatesSource Load
.
graphql query
query getWorkItems($fullPath: ID!) {
group(fullPath: $fullPath) {
id
workItems(
includeDescendants: true
) {
nodes {
id
widgets {
type
...WorkItemWidgets
}
workItemType {
name
}
}
}
}
}
fragment WorkItemWidgets on WorkItemWidget {
... on WorkItemWidgetStartAndDueDate {
type
dueDate
startDate
rollUp
__typename
}
}
# Variables
# {
# "fullPath": "The ID of your group"
# }
Merge request reports
Activity
assigned to @stefanosxan
added pipelinetier-1 label
- A deleted user
added backend label
- Resolved by Marc Saleiko
1 Message CHANGELOG missing: If this merge request needs a changelog entry, add the
Changelog
trailer to the commit message you want to add to the changelog.If this merge request doesn't need a CHANGELOG entry, feel free to ignore this message.
Reviewer roulette
Category Reviewer Maintainer backend @janis
(UTC+2)
@rodrigo.tomonari
(UTC-3)
Please refer to documentation page for guidance on how you can benefit from the Reviewer Roulette, or use the GitLab Review Workload Dashboard to find other available reviewers.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
DangerEdited by Ghost User
- Resolved by 🤖 GitLab Bot 🤖
Proper labels assigned to this merge request. Please ignore me.
@stefanosxan
- please see the following guidance and update this merge request.1 Error Please add typebug typefeature, or typemaintenance label to this merge request. Edited by 🤖 GitLab Bot 🤖
added groupproject management maintenanceperformance labels
added typemaintenance label
added devopsplan sectiondev labels
mentioned in issue #494436
changed milestone to %17.5
- Resolved by Marc Saleiko
LGTM
@msaleiko you were asking for maintainer reviews, would you be available fro this one?
requested review from @msaleiko
added pipeline:mr-approved label