fix: add account_advisory (advisory_id) index - #2312
Merged
Conversation
to improve clean_unused_data job performance
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds an index on account_advisory.advisory_id, wires it into the schema creation script, and introduces migration scripts to create and drop the index, bumping the schema version accordingly. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- If the
account_advisorytable is large and migrations run on a live system, consider usingCREATE INDEX CONCURRENTLYin the up migration to avoid long locks and downtime during index creation. - For consistency and clarity, you may want to give the new index an explicit name in the up migration (e.g.
CREATE INDEX account_advisory_advisory_id_idx ON account_advisory (advisory_id);) rather than relying on the default generated name.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- If the `account_advisory` table is large and migrations run on a live system, consider using `CREATE INDEX CONCURRENTLY` in the up migration to avoid long locks and downtime during index creation.
- For consistency and clarity, you may want to give the new index an explicit name in the up migration (e.g. `CREATE INDEX account_advisory_advisory_id_idx ON account_advisory (advisory_id);`) rather than relying on the default generated name.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2312 +/- ##
=======================================
Coverage 58.82% 58.83%
=======================================
Files 150 150
Lines 9604 9605 +1
=======================================
+ Hits 5650 5651 +1
Misses 3360 3360
Partials 594 594
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Dugowitch
approved these changes
Aug 21, 2026
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.
to improve clean_unused_data job performance
Secure Coding Practices Checklist GitHub Link
Secure Coding Checklist
Summary by Sourcery
Improve account advisory data cleanup performance by indexing advisory IDs.
Bug Fixes:
Chores: