Skip to content

Optimize db queries (part 2) #2929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 28, 2025
Merged

Optimize db queries (part 2) #2929

merged 8 commits into from
Jul 28, 2025

Conversation

r4victor
Copy link
Collaborator

Follows #2928

Main changes:

  • Fixes ProjectModel.default_gateway being selected for every api endpoint leading to the most expensive query (if counted by sum(duration)).
  • Avoids loading unnecessary attributes in locking/preflight selects in background processing (load only .id now for locking).
  • Rewrites process_fleets to multiple process fleets in one session (as it can be done quickly), reducing total number of background transactions.
  • Adds DB indexes for status columns (should help with background select since filtering by active status would typically be beneficial).

@r4victor r4victor merged commit 8d3f9fa into master Jul 28, 2025
26 checks passed
@r4victor r4victor deleted the pr_fewer_db_sessions branch July 28, 2025 05:37
@r4victor r4victor mentioned this pull request Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant