Skip to content

bug: generating diff for branch with many deletes is slow #6751

Closed
@ajtmccarty

Description

@ajtmccarty

Component

API Server / GraphQL

Infrahub version

1.13.1

Current Behavior

if a branch has many deletes (over 1,000 nodes), generating the diff takes progressively longer as each batch of nodes is processed

Expected Behavior

the performance for a branch with many deletes should be similar to a branch with many new or updated nodes

Steps to Reproduce

  1. add many nodes
  2. make a branch
  3. delete many nodes on this branch
  4. generate a diff
  5. you will see entries in the task-worker or server log that look like this
2025-06-27 09:15:30 Beginning diff node-level calculation queries for branch
2025-06-27 09:15:30 Beginning one diff calculation query limit=500, offset=0
2025-06-27 09:15:37 Diff calculation query complete limit=500, offset=0
2025-06-27 09:16:00 Beginning one diff calculation query limit=500, offset=500
2025-06-27 09:16:04 Diff calculation query complete limit=500, offset=500
2025-06-27 09:17:13 Beginning one diff calculation query limit=500, offset=1000
2025-06-27 09:17:17 Diff calculation query complete limit=500, offset=1000
2025-06-27 09:20:42 Beginning one diff calculation query limit=500, offset=1500
2025-06-27 09:20:50 Diff calculation query complete limit=500, offset=1500
2025-06-27 09:24:41 Beginning one diff calculation query limit=500, offset=2000
2025-06-27 09:24:42 Diff calculation query complete limit=500, offset=2000
2025-06-27 09:26:01 Diff node-level calculation queries for branch complete

notice the increasing time between Diff calculation query complete and the next Beginning one diff calculation query

Additional Information

No response

Metadata

Metadata

Assignees

Labels

group/backendIssue related to the backend (API Server, Git Agent)priority/1This issue must be fixed/implemented ASAP, it's a blocker for a releasetype/bugSomething isn't working as expected

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions