Replace row-by-row DELETE with bulk DELETE in career recalculation #77
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-database#77
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
In
app/db_engine.pylines 1373-1408 and 1434-1465, career recalculation loads ALL rows then deletes them one at a time:On PostgreSQL, this means N+1 round-trips instead of a single
DELETE FROM.Fix
Replace with bulk delete:
BattingCareer.delete().execute()(same forPitchingCareerandFieldingCareer).Severity
Medium — unnecessary performance cost.
PR #92 opens the fix: #92
Replaced the three row-by-row delete loops in
BattingCareer.recalculate(),PitchingCareer.recalculate(), andFieldingCareer.recalculate()with single bulkModel.delete().execute()calls — one round-trip instead of N.