PennyDreadfulMTG / perf-reports

2 stars 7 forks source link

Exceeded slow_query limit (121.3 > 60.0) in mysql: ``` #63498

Open vorpal-buildbot opened 2 months ago

vorpal-buildbot commented 2 months ago
    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 121.3, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

vorpal-buildbot commented 2 months ago

Exceeded slow_query limit (125.7 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 125.7, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 2 months ago

Exceeded slow_query limit (131.7 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 131.7, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 2 months ago

Exceeded slow_query limit (123.8 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 123.8, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (148.7 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 148.7, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (132.7 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 132.7, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (132.7 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 132.7, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (128.7 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 128.7, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (127.3 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 127.3, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (121.3 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 121.3, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (120.5 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 120.5, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (130.7 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 130.7, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (127.6 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 127.6, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (129.5 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 129.5, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (135.8 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 135.8, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (133.6 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 133.6, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (125.5 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 125.5, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (127.9 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 127.9, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (128.2 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 128.2, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (127.2 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 127.2, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (139.4 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 139.4, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (128.1 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 128.1, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (133.6 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 133.6, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (130.4 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 130.4, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (137.1 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 137.1, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (128.5 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 128.5, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (127.7 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 127.7, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (138.9 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 138.9, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (125.8 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 125.8, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (127.2 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 127.2, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (132.7 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 132.7, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (126.7 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 126.7, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (136.0 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 136.0, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 month ago

Exceeded slow_query limit (136.6 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 136.6, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 4 weeks ago

Exceeded slow_query limit (138.8 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 138.8, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 4 weeks ago

Exceeded slow_query limit (136.5 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 136.5, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 3 weeks ago

Exceeded slow_query limit (140.6 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 140.6, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 3 weeks ago

Exceeded slow_query limit (128.8 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 128.8, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 3 weeks ago

Exceeded slow_query limit (128.0 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 128.0, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 3 weeks ago

Exceeded slow_query limit (135.8 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 135.8, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 3 weeks ago

Exceeded slow_query limit (129.4 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 129.4, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 3 weeks ago

Exceeded slow_query limit (139.6 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 139.6, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 3 weeks ago

Exceeded slow_query limit (144.4 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 144.4, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 2 weeks ago

Exceeded slow_query limit (149.8 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 149.8, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 2 weeks ago

Exceeded slow_query limit (156.0 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 156.0, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 2 weeks ago

Exceeded slow_query limit (156.8 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 156.8, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 2 weeks ago

Exceeded slow_query limit (170.4 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 170.4, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 2 weeks ago

Exceeded slow_query limit (167.8 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 167.8, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 2 weeks ago

Exceeded slow_query limit (137.8 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 137.8, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 2 weeks ago

Exceeded slow_query limit (135.0 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 135.0, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite

vorpal-buildbot commented 1 week ago

Exceeded slow_query limit (130.1 > 60.0) in mysql: ```

    CREATE TABLE IF NOT EXISTS _new_matchup_ps_stats (
        archetype_id INT NOT NULL,
        opponent_archetype_id INT NOT NULL,
        person_id INT NOT NULL,
        season_id INT NOT NULL,
        wins INT NOT NULL,
        losses INT NOT NULL,
        draws INT NOT NULL,
        deck_type ENUM('league', 'tournament', 'other') NOT NULL,
        PRIMARY KEY (season_id, archetype_id, opponent_archetype_id, person_id, deck_type),
        FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (opponent_archetype_id) REFERENCES archetype (id) ON UPDATE CASCADE ON DELETE CASCADE,
        FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE
    ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
    SELECT
        a.id AS archetype_id,
        oa.id AS opponent_archetype_id,
        d.person_id,
        season.season_id,
        SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
        SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
        SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws,
        (CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
    FROM
        archetype AS a
    INNER JOIN
        deck AS d ON d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = a.id)
    INNER JOIN
        deck_match AS dm ON d.id = dm.deck_id
    INNER JOIN
        deck_match AS odm ON dm.match_id = odm.match_id AND odm.deck_id <> d.id
    INNER JOIN
        deck AS od ON od.id = odm.deck_id
    INNER JOIN
        archetype AS oa ON od.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = oa.id)

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    GROUP BY
        a.id,
        oa.id,
        d.person_id,
        season.season_id,
        ct.name
```

[] (slow_query, 130.1, mysql)

Reported on decksite by mysql-perf

Location Hash: 63cef40542e11dd6a1e063973553a9702553cc50

Labels: decksite