Problem
Multiple redundant or sequential database queries in grading.py slow down the grading pipeline. Opportunities exist to use advanced SQLAlchemy loading techniques (joinedload, selectinload) for batch-fetching related entities.
Proposal
- Refactor grading workflow to prefetch assignments, IO test cases, unit tests, static rules, etc. for each submission
- Use joinedload/selectinload for one-to-many or many-to-one relationships
- Add appropriate indexes if any filter fields show up in performance analysis
Rationale
- Reduces DB roundtrips per grading task
- Lowers contention as grading task throughput increases
- Simplifies transactional logic and preloading
Acceptance Criteria
- Grading a submission involves minimal DB queries for related data
- Queries use batch/optimized loading, evidenced via logs or analysis
- No unrelated performance regressions
Labels: backend, enhancement, performance
Problem
Multiple redundant or sequential database queries in
grading.pyslow down the grading pipeline. Opportunities exist to use advanced SQLAlchemy loading techniques (joinedload, selectinload) for batch-fetching related entities.Proposal
Rationale
Acceptance Criteria
Labels: backend, enhancement, performance