PennyDreadfulMTG / perf-reports

2 stars 2 forks source link

Exceeded slow_query limit (1.2 > 1.0) in mysql: ``` #63214

Open vorpal-buildbot opened 6 months ago

vorpal-buildbot commented 6 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.2, mysql)

Reported on decksite by mysql-perf

Location Hash: 0967d037ca8a7b80f9b1b4ad6871db9bbfe638db

Request Data ``` Request Method: GET Path: /matchups/?locale=ru 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: 46.146.70.252 Cf-Ray: 885f5e72dd245a8f-VIE X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} 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 Accept: */* Sec-Fetch-Site: none Sec-Fetch-Mode: cors Sec-Fetch-Dest: empty Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7 Priority: u=1, i Cf-Connecting-Ip: 46.146.70.252 Cdn-Loop: cloudflare Cf-Ipcountry: RU ```
vorpal-buildbot commented 6 months ago

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

Reported on decksite by mysql-perf

Location Hash: 0967d037ca8a7b80f9b1b4ad6871db9bbfe638db

Request Data ``` Request Method: GET Path: /matchups/?locale=ru 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: 35.225.244.20 Cf-Ray: 886048d5ed821084-ORD X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Sentry-Trace: 9dc45df7eeed4513af5f4ce2f2d115d6-b20074d2d4bc7003 Baggage: sentry-trace_id=9dc45df7eeed4513af5f4ce2f2d115d6,sentry-environment=prd,sentry-release=d9014e31a6d1991d070d3b543d71facfdd3b3758,sentry-public_key=a6487fb1e639431a8a7d2de20cbb6e49 User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 Accept: */* Cf-Connecting-Ip: 35.225.244.20 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite