PennyDreadfulMTG / perf-reports

2 stars 2 forks source link

Exceeded slow_query limit (106.3 > 60.0) in mysql: ``` #59202

Open vorpal-buildbot opened 2 years ago

vorpal-buildbot commented 2 years 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, 106.3, mysql)

Reported on decksite by mysql-perf

Location Hash: 2f282e5e9bc1a4f2706b72b69155b79f3921af4d

Request Data ``` Request Method: GET Path: /matchups/?locale=fr Cookies: ImmutableMultiDict([]) Endpoint: matchups View Args: {} Person: logged_out Referrer: None Request Data: {} Host: pennydreadfulmagic.com Accept-Encoding: gzip X-Forwarded-For: 207.46.13.42, 172.68.143.239 Cf-Ray: 72711cbc0b1d844f-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: no-cache Pragma: no-cache Accept: */* From: bingbot(at)microsoft.com User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Cf-Connecting-Ip: 207.46.13.42 Cf-Ipcountry: US Cdn-Loop: cloudflare X-Forwarded-Host: pennydreadfulmagic.com X-Forwarded-Server: pennydreadfulmagic.com Connection: Keep-Alive ```
vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (68.4 > 60.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
    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, 68.4, mysql)

Reported on decksite by mysql-perf

Location Hash: 2f282e5e9bc1a4f2706b72b69155b79f3921af4d

Request Data ``` Request Method: GET Path: /matchups/?locale=fr Cookies: ImmutableMultiDict([]) Endpoint: matchups View Args: {} Person: logged_out Referrer: None Request Data: {} Host: pennydreadfulmagic.com Accept-Encoding: gzip X-Forwarded-For: 2001:4860:7:20f::fe, 172.69.22.211 Cf-Ray: 73e395daff16b7d3-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Purpose: prefetch Sec-Purpose: prefetch;anonymous-client-ip 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.9 Upgrade-Insecure-Requests: 1 Sec-Fetch-Site: none Sec-Fetch-Mode: no-cors Sec-Fetch-Dest: empty User-Agent: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Mobile Safari/537.36 Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7 Cf-Connecting-Ip: 2001:4860:7:20f::fe Cf-Ipcountry: FR Cdn-Loop: cloudflare X-Forwarded-Host: pennydreadfulmagic.com X-Forwarded-Server: pennydreadfulmagic.com Connection: Keep-Alive ```

Labels: decksite