Skip to content

Commit

Permalink
schema: Improve medic_cube refresh time
Browse files Browse the repository at this point in the history
Just before wrapping up 2245249 ("site: Add medic leaderboard") I
switched to a lateral join.  However, this has worse performance than a
regular join, so switch back.

Signed-off-by: Sean Anderson <[email protected]>
  • Loading branch information
Forty-Bot committed May 17, 2024
1 parent 79f9e4c commit 27b7cfb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions trends/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ CREATE MATERIALIZED VIEW IF NOT EXISTS medic_cube AS SELECT
sum(healing_other) AS healing_other
FROM log_nodups AS log
JOIN medic_stats USING (logid)
LEFT JOIN LATERAL (SELECT
LEFT JOIN (SELECT
logid,
healer AS playerid,
sum(healing) AS healing,
Expand All @@ -806,9 +806,7 @@ LEFT JOIN LATERAL (SELECT
FROM heal_stats
JOIN player_stats USING (logid)
LEFT JOIN class ON (classid=primary_classid)
WHERE logid = medic_stats.logid
AND healer = medic_stats.playerid
AND player_stats.playerid = healee
WHERE player_stats.playerid = healee
GROUP BY logid, healer
) AS heal_stats USING (logid, playerid)
GROUP BY playerid, CUBE (league, formatid, mapid)
Expand Down

0 comments on commit 27b7cfb

Please sign in to comment.