You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
return'Add composite indexes for query optimization';
15
+
}
16
+
17
+
publicfunctionup(Schema$schema): void
18
+
{
19
+
// Composite index for player statistics and ranking queries
20
+
$this->addSql('CREATE INDEX idx_pst_player_puzzle_type ON puzzle_solving_time (player_id, puzzle_id, puzzling_type)');
21
+
22
+
// Index for date-based monthly queries (used after EXTRACT->date range optimization)
23
+
$this->addSql('CREATE INDEX idx_pst_tracked_at_type ON puzzle_solving_time (tracked_at, puzzling_type)');
24
+
25
+
// Partial index for fastest players/groups/pairs queries
26
+
$this->addSql('CREATE INDEX idx_pst_type_time_valid ON puzzle_solving_time (puzzling_type, seconds_to_solve) WHERE seconds_to_solve IS NOT NULL AND suspicious = false');
27
+
28
+
// GIN index for JSONB containment on team column (custom_ prefix = Doctrine won't manage it)
29
+
$this->addSql('CREATE INDEX custom_pst_team_puzzlers_gin ON puzzle_solving_time USING GIN ((team::jsonb->\'puzzlers\') jsonb_path_ops) WHERE team IS NOT NULL');
30
+
}
31
+
32
+
publicfunctiondown(Schema$schema): void
33
+
{
34
+
$this->addSql('DROP INDEX IF EXISTS idx_pst_player_puzzle_type');
35
+
$this->addSql('DROP INDEX IF EXISTS idx_pst_tracked_at_type');
36
+
$this->addSql('DROP INDEX IF EXISTS idx_pst_type_time_valid');
37
+
$this->addSql('DROP INDEX IF EXISTS custom_pst_team_puzzlers_gin');
0 commit comments