Closed starcraft66 closed 1 year ago
In https://github.com/starcraft66/lanparty-seating/blob/master/lib/lanpartyseating/logic/station_logic.ex, we start by querying all of the stations in the repo on line 16, then for every station, we call get_station_status/1 on them which results in 3 SQL queries being executed per station. This is very expensive and causes the page to be noticeably slow even with postgres running on an SSD on localhost.
get_station_status/1
All of the logic in there needs to be refactored into a single SQL query that joins the Station with Reservation and TournamentReservation to find all of the stations and their status.
Station
Reservation
TournamentReservation
Completed in https://github.com/starcraft66/lanparty-seating/pull/34
In https://github.com/starcraft66/lanparty-seating/blob/master/lib/lanpartyseating/logic/station_logic.ex, we start by querying all of the stations in the repo on line 16, then for every station, we call
get_station_status/1
on them which results in 3 SQL queries being executed per station. This is very expensive and causes the page to be noticeably slow even with postgres running on an SSD on localhost.All of the logic in there needs to be refactored into a single SQL query that joins the
Station
withReservation
andTournamentReservation
to find all of the stations and their status.