Skip to content

Database cleanup and optimizations - #9522

Merged
taylorsilva merged 4 commits into
masterfrom
db-cleanup
Apr 13, 2026
Merged

taylorsilva merged 4 commits into
masterfrom
db-cleanup

Conversation

@taylorsilva

Copy link
Copy Markdown
Member

Changes proposed by this PR

This PR cleans up a few things and makes a few optimizations as well.

  • Updated the PgxListener to log errors instead of panic
  • Preallocate slices to the length of incoming objects. Eliminates copy/growth operations
  • Updated three spots where we set the schedule_requested column for multiple jobs in a for loop, doing one query per job. Now we do a single batch query by passing in the list of job ID's to update with a WHERE id IN (...) clause
  • Updated the JobFactory to fetch all job resources in one batch query instead of once per job.

rows.Close() is not strictly required, but is a good way to ensure we
don't leak resources.

Signed-off-by: Taylor Silva <[email protected]>
Squirrel's Eq{} supports slices, so it'll convert the slice into a
`WHERE id IN (...)` clause

Signed-off-by: Taylor Silva <[email protected]>
@taylorsilva
taylorsilva requested a review from a team April 10, 2026 21:57
@taylorsilva
taylorsilva merged commit dbd87d9 into master Apr 13, 2026
12 checks passed
@taylorsilva
taylorsilva deleted the db-cleanup branch April 13, 2026 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant