PennyDreadfulMTG / perf-reports

2 stars 2 forks source link

Exceeded slow_query limit (0.6 > 0.5) in mysql: ``` #61403

Open vorpal-buildbot opened 1 year ago

vorpal-buildbot commented 1 year ago
    SELECT
        p.id,
        LOWER(IFNULL(IFNULL(IFNULL(p.name, p.mtgo_username), p.mtggoldfish_username), p.tappedout_username)) AS name,
        p.mtgo_username,
        p.tappedout_username,
        p.mtggoldfish_username,
        p.discord_id,
        p.elo,
        p.locale,
        p.banned,
        SUM(1) AS num_decks,
        SUM(dc.wins) AS wins,
        SUM(dc.losses) AS losses,
        SUM(dc.draws) AS draws,
        SUM(dc.wins - dc.losses) AS record,
        SUM(CASE WHEN dc.wins >= 5 AND dc.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
        SUM(CASE WHEN d.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
        SUM(CASE WHEN d.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
        IFNULL(ROUND((SUM(dc.wins) / NULLIF(SUM(dc.wins + dc.losses), 0)) * 100, 1), '') AS win_percent,
        SUM(DISTINCT CASE WHEN d.competition_id IS NOT NULL THEN 1 ELSE 0 END) AS num_competitions
    FROM
        person AS p
    LEFT JOIN
        deck AS d ON d.person_id = p.id
    LEFT JOIN
        deck_cache AS dc ON d.id = dc.deck_id

    WHERE
        (p.mtgo_username IS NOT NULL) AND (TRUE)
    GROUP BY
        p.id
    ORDER BY
        num_decks DESC, p.name

```

[] (slow_query, 0.6, mysql)

Reported on decksite by mysql-perf

Location Hash: bfe1dbe065530abd2a41b3e9f863d72081b1823c

Request Data ``` Request Method: GET Path: /matchups/?season_id=&hero_archetype_id=383&hero_person_id=&hero_card=&enemy_archetype_id=363&enemy_person_id=&enemy_card= Cookies: ImmutableMultiDict([('page_size', '20'), ('hide_intro', 'True'), ('views', '160')]) Endpoint: matchups View Args: {} Person: logged_out Referrer: https://pennydreadfulmagic.com/matchups/ Request Data: {} Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip X-Forwarded-For: 43.250.201.2 Cf-Ray: 7cc247534c3bfa5e-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 Dnt: 1 Accept-Language: zh-CN,zh;q=0.9,en-CN;q=0.8,en;q=0.7,en-US;q=0.6 X-Requested-With: mark.via Sec-Fetch-Site: none Sec-Fetch-Mode: navigate Sec-Fetch-User: ?1 Sec-Fetch-Dest: document Referer: https://pennydreadfulmagic.com/matchups/ Cookie: page_size=20; hide_intro=True; views=160 Cf-Connecting-Ip: 43.250.201.2 Cf-Ipcountry: CN Cdn-Loop: cloudflare ```
vorpal-buildbot commented 1 year ago

Exceeded slow_query limit (0.6 > 0.5) in mysql: ```

    SELECT
        p.id,
        LOWER(IFNULL(IFNULL(IFNULL(p.name, p.mtgo_username), p.mtggoldfish_username), p.tappedout_username)) AS name,
        p.mtgo_username,
        p.tappedout_username,
        p.mtggoldfish_username,
        p.discord_id,
        p.elo,
        p.locale,
        p.banned,
        SUM(1) AS num_decks,
        SUM(dc.wins) AS wins,
        SUM(dc.losses) AS losses,
        SUM(dc.draws) AS draws,
        SUM(dc.wins - dc.losses) AS record,
        SUM(CASE WHEN dc.wins >= 5 AND dc.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
        SUM(CASE WHEN d.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
        SUM(CASE WHEN d.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
        IFNULL(ROUND((SUM(dc.wins) / NULLIF(SUM(dc.wins + dc.losses), 0)) * 100, 1), '') AS win_percent,
        SUM(DISTINCT CASE WHEN d.competition_id IS NOT NULL THEN 1 ELSE 0 END) AS num_competitions
    FROM
        person AS p
    LEFT JOIN
        deck AS d ON d.person_id = p.id
    LEFT JOIN
        deck_cache AS dc ON d.id = dc.deck_id

    WHERE
        (p.mtgo_username IS NOT NULL) AND (TRUE)
    GROUP BY
        p.id
    ORDER BY
        num_decks DESC, p.name

```

[] (slow_query, 0.6, mysql)

Reported on decksite by mysql-perf

Location Hash: bfe1dbe065530abd2a41b3e9f863d72081b1823c

Request Data ``` Request Method: GET Path: /matchups/?season_id=&hero_archetype_id=383&hero_person_id=&hero_card=&enemy_archetype_id=363&enemy_person_id=&enemy_card= Cookies: ImmutableMultiDict([('views', '2355'), ('hide_intro', 'True'), ('page_size', '20'), ('session', '.eJx1UcluwjAU_BefU5TVSbhReuhCCgKVpVUVWYkTTByb2g4NIP69L0g0h6rHecvMvHlnlO6pqomgwqChUQ21EMlrJtCwIFwDymnNapn3mOlMqjxlUEKe49muH-IgjrBrx2Hson6Cy4xwClNU3L0toPH_ChNp2TCe3yxwWZY076xpKa5SkW37FqpNKdNGUyVI3TFrkilmpAIKSRqzdVNtiOk6PDuQiVluno_Gwatx9To7LtuqqLxi5D3O-3kjKwrHnhHJMqr1DaOt_d2eXtokCw_C7DbJqeHNtJrmajYl606PtnumqE4J5ObgyPeCENvhIHJiF2Pc97sose2DfwspWkBp-yuyWJukXD0tysPcqQITJGNRP3xNRhKHQf4OIhDkHq75gOjgQaw4Qu0alB7sJDDfEPq00JU0NcduAd1ToqhCFwv9ydAQVVIwLRrOLz_Id6cd.ZHyBLQ.8LIHW4xAgbSrqJ36zkGd0BAh6Lk'), ('deck_id', '215703')]) Endpoint: matchups View Args: {} Person: 313024765986209792 Referrer: https://pennydreadfulmagic.com/matchups/?season_id=&hero_archetype_id=383&hero_person_id=&hero_card=&enemy_archetype_id=&enemy_person_id=&enemy_card=Defabricate Request Data: {} Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip X-Forwarded-For: 91.196.69.103 Cf-Ray: 7d201f12792b81f4-IAD X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Priority: u=1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Dnt: 1 Referer: https://pennydreadfulmagic.com/matchups/?season_id=&hero_archetype_id=383&hero_person_id=&hero_card=&enemy_archetype_id=&enemy_person_id=&enemy_card=Defabricate Upgrade-Insecure-Requests: 1 Sec-Fetch-Dest: document Sec-Fetch-Mode: navigate Sec-Fetch-Site: same-origin Sec-Fetch-User: ?1 Sec-Gpc: 1 Cookie: views=2355; hide_intro=True; page_size=20; session=.eJx1UcluwjAU_BefU5TVSbhReuhCCgKVpVUVWYkTTByb2g4NIP69L0g0h6rHecvMvHlnlO6pqomgwqChUQ21EMlrJtCwIFwDymnNapn3mOlMqjxlUEKe49muH-IgjrBrx2Hson6Cy4xwClNU3L0toPH_ChNp2TCe3yxwWZY076xpKa5SkW37FqpNKdNGUyVI3TFrkilmpAIKSRqzdVNtiOk6PDuQiVluno_Gwatx9To7LtuqqLxi5D3O-3kjKwrHnhHJMqr1DaOt_d2eXtokCw_C7DbJqeHNtJrmajYl606PtnumqE4J5ObgyPeCENvhIHJiF2Pc97sose2DfwspWkBp-yuyWJukXD0tysPcqQITJGNRP3xNRhKHQf4OIhDkHq75gOjgQaw4Qu0alB7sJDDfEPq00JU0NcduAd1ToqhCFwv9ydAQVVIwLRrOLz_Id6cd.ZHyBLQ.8LIHW4xAgbSrqJ36zkGd0BAh6Lk; deck_id=215703 Cdn-Loop: cloudflare Cf-Connecting-Ip: 91.196.69.103 Cf-Ipcountry: US ```

Labels: decksite