Reduce where clause fanout when updating workflow, node & task executions #5953
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.
Why are the changes needed?
In the executions path, performant updates are important since propeller sends executions events and doesn't proceed with the execution until the event is properly acked.
We've observed a performance increase (3x) for updating task executions in particular (which have 9!! primary keys) so that generated gorm adds a where clause for each primary key and this results in noticeably slower queries compared to updating on the unique BaseModel indexed Id field.
What changes were proposed in this pull request?
I'm only updating executions tables here (workflow, node and task) because they're in the hot path. Inventory like tasks and workflows can't be updated, launch plan state can but the perf requirements there are lower and the expected table size for static inventory is usually much lower than for executions
We can always assume the model has the
id
filled out because we fetch it before updatingHow was this patch tested?
Tested on sandbox. Verified executions progressed and I could interact with the console. Verified dumped SQL showed updated query.
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link