[MDS-5450] Use selectin loader for Incident documents, and TSFs #2640
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.
Objective
MDS-5450
Attempt to improve the performance of the Incident endpoints which in some circumstances causes the core api to error with an OOM error.
EXPLAIN ANALYZEing the filter query, I found that the document and TSF joins was a big reason for the amount of rows being returned by the query.
Note:
This does not solve the overall issue around only returning the data we need - why do we need TSFs loaded when looking up an Incident? Turns out that's a bit of a bigger thing, but hopefully this PR should resolve the immediate issue.