PennyDreadfulMTG / perf-reports

2 stars 2 forks source link

Exceeded slow_query limit (1.1 > 1.0) in mysql: ``` #63371

Open vorpal-buildbot opened 5 months ago

vorpal-buildbot commented 5 months 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,
        COUNT(*) OVER () AS total
    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, 1.1, mysql)

Reported on decksite by mysql-perf

Location Hash: b5010d5e71e980f5a441faa97b7b5c7477656f12

Request Data ``` Request Method: GET Path: /matchups/?season_id=32&hero_archetype_id=&hero_person_id=&hero_card=Shigeki%2C+Jukai+Visionary&enemy_archetype_id=&enemy_person_id=&enemy_card= Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('deck_id', ''), ('page_size', '20'), ('views', '148'), ('session', '.eJx1UV1PwjAU_S99nmTfG7yNZShqcAE1ojFL2e7GZG2XthsQwn-3xeAejG-999x7zrmnJ5S1wAmmQCWaSN6BgXBBaoomJW6EqgogNWHFUNciZ7zIatVCrmPZtmmHwdgcm6Zjhx4aJhqW4wbUFNCbl5UC_l-paVZ1dVNcLTSsqqDQ1gSjFykrsC0DEVmxrBPAKSaaGe8wwVJ0ioLhTm7tTEgsNfK4T_ar6HjYPuRvs3SJY8dr-3Q-Xke2w6bDvGQ7UMeeEM5zEOJao_tNEiSLWVwt3bSfdtBLv81f02i-76tbbRkObc1BZFhqc5bnOWEQBCPfMV3fsQZcR-mbbmiaBuJQqtb2V4SR9R1tF2X4VD2XfipWcWQ5GyzfySKeJUpEBdmqaz7QJR0x-mKKTgepvqsuj-r5A6BPA11IM3nUC2gKmANHZwP9yVBiXoEyTbumOX8DbsOkvg.ZknGiQ.QGDuBSWD7gio1kx1jI8gNCeG8s0'), ('cf_ob_info', '502:8863107abd0d56fe:IAD'), ('cf_use_ob', '0')]) Endpoint: matchups View Args: {} Person: 431220287909003285 Referrer: https://pennydreadfulmagic.com/matchups/?season_id=&hero_archetype_id=&hero_person_id=&hero_card=Growing+Ranks&enemy_archetype_id=&enemy_person_id=&enemy_card= Request Data: {} Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 2603:6010:ad03:f823:7857:d3fa:a3b6:f7f6 Cf-Ray: 886310b4493556fe-IAD X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Sec-Ch-Ua: "Chromium";v="124", "Microsoft Edge";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "Windows" Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 Sec-Fetch-Site: same-origin Sec-Fetch-Mode: navigate Sec-Fetch-User: ?1 Sec-Fetch-Dest: document Referer: https://pennydreadfulmagic.com/matchups/?season_id=&hero_archetype_id=&hero_person_id=&hero_card=Growing+Ranks&enemy_archetype_id=&enemy_person_id=&enemy_card= Accept-Language: en-US,en;q=0.9 Priority: u=0, i Cookie: hide_intro=True; deck_id=; page_size=20; views=148; session=.eJx1UV1PwjAU_S99nmTfG7yNZShqcAE1ojFL2e7GZG2XthsQwn-3xeAejG-999x7zrmnJ5S1wAmmQCWaSN6BgXBBaoomJW6EqgogNWHFUNciZ7zIatVCrmPZtmmHwdgcm6Zjhx4aJhqW4wbUFNCbl5UC_l-paVZ1dVNcLTSsqqDQ1gSjFykrsC0DEVmxrBPAKSaaGe8wwVJ0ioLhTm7tTEgsNfK4T_ar6HjYPuRvs3SJY8dr-3Q-Xke2w6bDvGQ7UMeeEM5zEOJao_tNEiSLWVwt3bSfdtBLv81f02i-76tbbRkObc1BZFhqc5bnOWEQBCPfMV3fsQZcR-mbbmiaBuJQqtb2V4SR9R1tF2X4VD2XfipWcWQ5GyzfySKeJUpEBdmqaz7QJR0x-mKKTgepvqsuj-r5A6BPA11IM3nUC2gKmANHZwP9yVBiXoEyTbumOX8DbsOkvg.ZknGiQ.QGDuBSWD7gio1kx1jI8gNCeG8s0; cf_ob_info=502:8863107abd0d56fe:IAD; cf_use_ob=0 Cf-Connecting-Ip: 2603:6010:ad03:f823:7857:d3fa:a3b6:f7f6 Cdn-Loop: cloudflare Cf-Ipcountry: US ```
vorpal-buildbot commented 5 months ago

Exceeded slow_query limit (1.1 > 1.0) 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,
        COUNT(*) OVER () AS total
    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, 1.1, mysql)

Reported on decksite by mysql-perf

Location Hash: b5010d5e71e980f5a441faa97b7b5c7477656f12

Request Data ``` Request Method: HEAD Path: /matchups/?season_id=32&hero_archetype_id=&hero_person_id=&hero_card=Shigeki%2C+Jukai+Visionary&enemy_archetype_id=&enemy_person_id=&enemy_card= Cookies: ImmutableMultiDict([]) Endpoint: matchups View Args: {} Person: logged_out Referrer: None Request Data: {} Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 51.15.164.30 Cf-Ray: 8863189faf986567-AMS X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36 Cf-Connecting-Ip: 51.15.164.30 Cdn-Loop: cloudflare Cf-Ipcountry: FR ```

Labels: decksite