Closed ANIALLATOR114 closed 3 days ago
This pull request optimizes realtime queries by implementing ranking instead of using MAX aggregation, and increases the batch size for processing schedules. The changes aim to improve query performance and efficiency in handling realtime data.
sequenceDiagram
participant C as Client
participant R as RealtimeRepo
participant DB as Database
C->>R: get_realtime_schedules_for_trips(trips)
R->>DB: Execute ranked subqueries (stop times & trips)
R->>DB: Execute main query with top-ranked rows
R->>R: Process results concurrently
R-->>C: Return realtime schedules
Change | Details | Files |
---|---|---|
Implement ranking for realtime queries instead of using MAX aggregation |
|
SimplyTransport/domain/realtime/realtime_schedule/repo.py |
Increase batch size for processing schedules |
|
SimplyTransport/timescale/services/delays_service.py |
Summary by Sourcery
Optimize real-time schedule queries by implementing ranking to select the most recent entries for each trip and increase the batch size for schedule processing to enhance performance.
Enhancements: