Skip to content

Commit d8ce749

Browse files
committed
chore: improve query performance for matches / organizer lineups and finished matches
1 parent 64a6287 commit d8ce749

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

  • hasura/migrations/default/1770649000000_optimize_player_query_performance
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CREATE INDEX IF NOT EXISTS idx_matches_created_winning_lineups
2+
ON matches(created_at DESC, winning_lineup_id)
3+
INCLUDE (lineup_1_id, lineup_2_id, match_options_id, status);
4+
5+
CREATE INDEX IF NOT EXISTS idx_matches_organizer_lineups
6+
ON matches(organizer_steam_id, lineup_1_id, lineup_2_id)
7+
WHERE winning_lineup_id IS NOT NULL;
8+
9+
CREATE INDEX IF NOT EXISTS idx_match_options_id_lobby_access
10+
ON match_options(id, lobby_access)
11+
INCLUDE (type);
12+
13+
CREATE INDEX IF NOT EXISTS idx_matches_finished
14+
ON matches(created_at DESC, id)
15+
INCLUDE (lineup_1_id, lineup_2_id, match_options_id, status, organizer_steam_id)
16+
WHERE winning_lineup_id IS NOT NULL;

0 commit comments

Comments
 (0)