Repository navigation
#4469 prisma query optimization - #4582
getheobald wants to merge 15 commits into
Conversation
|
getProjectGanttQueryArgs analysis getWorkPackageQueryArgs |
| title: true, | ||
| status: true, | ||
| initialDateScheduled: true, | ||
| scheduledTimes: true, |
There was a problem hiding this comment.
Ah nope, switching to just the first bc the preview only reads the first slot's startTime
There was a problem hiding this comment.
Note about this: I'm having it always select the earliest slot, which seems like the most stable and logical choice. However, if we want to show recurring events differently, we could switch it to one marker per slot but that could get super crowded
| const projects = await prisma.project.findMany({ | ||
| where: { wbsElement: { dateDeleted: null, organizationId: organization.organizationId }, ...(carId && { carId }) }, | ||
| orderBy: [{ wbsElement: { carNumber: 'asc' } }, { wbsElement: { projectNumber: 'asc' } }], | ||
| relationLoadStrategy: 'query', |
|
Step 0: Tried relationLoadStrategy: 'query' on getAllProjectsGantt in ProjectsService, which made a big speed improvement. Before doing that, because of the confusion with the order not matching, I decided to implement ordering, so projects are now sorted by car number then project number. Work packages are sorted by orderInProject, then WP number. Tasks are sorted by dateCreated, then taskId. Changes sort by date, then changeId. Description bullets sort by dateAdded, then descriptionId. This is about 5x faster than before (1700ms to 340ms). |
|
Also fixed an early return editing error, which was blocking #4477
|
|
That last commit made it so a task now counts as edited only if its set of assignees actually changed. Previously it also depended on index but they weren't returned in any consistent order so it was unnecessarily re-saving |
f677ecd to
e28e468
Compare
wavehassman
left a comment
There was a problem hiding this comment.
We need to rethink how we think about this and focus on optimizing the query args we have and not making a ton new ones. Check if the previews can be taken down or if there are other query args that are extremely close to the ones you made
| export type GanttChartWorkPackageQueryArgs = ReturnType<typeof getGanttChartWorkPackageQueryArgs>; | ||
| export type GanttChartProjectQueryArgs = ReturnType<typeof getGanttChartProjectQueryArgs>; | ||
|
|
||
| const wbsNumberSelect = { carNumber: true, projectNumber: true, workPackageNumber: true } as const; |
|
|
||
| // same output as getTaskQueryArgs through taskTransformer for the gantt's tasks, which are non-deleted (so deletedBy is | ||
| // skipped) and project-level (a project's wbs element has no work package, so its blocking work packages are skipped) | ||
| export const getTaskGanttQueryArgs = () => |
There was a problem hiding this comment.
I don't think this is different enough from the preview or potentially this could just replace the preview
| const wbsNumberSelect = { carNumber: true, projectNumber: true, workPackageNumber: true } as const; | ||
|
|
||
| // a task bar and its tooltip; saving an edited task reads its other fields from the full project | ||
| export const getGanttChartTaskQueryArgs = () => |
There was a problem hiding this comment.
this and event preview are nearly identical
Changes
Notes
Test Cases
Screenshots
If you made UI changes you must post a screenshot of the whole page for each change in 1) a normal sized window and 2) the smallest possible window
If you did any manual testing (e.g., with Postman), put screenshots of the http request and before and after of the db
If none of this applies, you can delete this section
To Do
Any remaining things that need to get done
Checklist
It can be helpful to check the
ChecksandFiles changedtabs.Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.
yarn.lockchanges (unless dependencies have changed)Closes #4469
Closes #4477