Repository navigation
[v3-3-test] Fix N+1 query in bulk update for Variables and Pools (#71918) - #72160
Merged
Merged
Conversation
) BulkVariableService.handle_bulk_update and BulkPoolService.handle_bulk_update each ran one batched existence-check query up front, then discarded the result and re-queried every entity individually inside the loop. The sibling handle_bulk_delete methods in the same two files, and connections.py's handle_bulk_update, already reuse the batched-lookup dict correctly -- this was the one spot left over from the earlier bulk-delete N+1 fixes. update_orm_from_pydantic in both files now takes the already-fetched ORM object instead of a key/name string, matching the design connections.py already uses, so the update loop no longer needs its own per-item query. (cherry picked from commit 562e730) Co-authored-by: Jyun-An Chen <[email protected]>
1 task done
pierrejeambrun
marked this pull request as ready for review
August 27, 2026 15:39
pierrejeambrun
requested review from
bugraoz93,
choo121600,
ephraimbuddy,
henry3260,
jason810496,
pierrejeambrun,
rawwar and
shubhamraj-git
as code owners
August 27, 2026 15:39
henry3260
approved these changes
Aug 27, 2026
Member
|
Unrelated CI failure, merging. |
pierrejeambrun
approved these changes
Aug 28, 2026
Contributor
Author
|
Hi maintainer, this PR was merged without a milestone set.
|
vatsrahul1001
pushed a commit
that referenced
this pull request
Sep 7, 2026
) (#72160) BulkVariableService.handle_bulk_update and BulkPoolService.handle_bulk_update each ran one batched existence-check query up front, then discarded the result and re-queried every entity individually inside the loop. The sibling handle_bulk_delete methods in the same two files, and connections.py's handle_bulk_update, already reuse the batched-lookup dict correctly -- this was the one spot left over from the earlier bulk-delete N+1 fixes. update_orm_from_pydantic in both files now takes the already-fetched ORM object instead of a key/name string, matching the design connections.py already uses, so the update loop no longer needs its own per-item query. (cherry picked from commit 562e730) Co-authored-by: Jyun-An Chen <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
BulkVariableService.handle_bulk_update and BulkPoolService.handle_bulk_update
each ran one batched existence-check query up front, then discarded the
result and re-queried every entity individually inside the loop. The
sibling handle_bulk_delete methods in the same two files, and
connections.py's handle_bulk_update, already reuse the batched-lookup
dict correctly -- this was the one spot left over from the earlier
bulk-delete N+1 fixes.
update_orm_from_pydantic in both files now takes the already-fetched
ORM object instead of a key/name string, matching the design
connections.py already uses, so the update loop no longer needs its
own per-item query.
(cherry picked from commit 562e730)
Co-authored-by: Jyun-An Chen [email protected]