PennyDreadfulMTG / perf-reports

2 stars 2 forks source link

Exceeded slow_query limit (35.2 > 10.0) in mysql: ``` #52313

Closed vorpal-buildbot closed 4 years ago

vorpal-buildbot commented 4 years ago
    SELECT

    d.id,
    d.finish,
    d.decklist_hash,
    cache.active_date,
    cache.wins,
    cache.losses,
    cache.draws,
    cache.color_sort,
    ct.name AS competition_type_name

    FROM
        deck AS d

    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 cache ON d.id = cache.deck_id

    LEFT JOIN
        (
            SELECT
                `start`.id,
                `start`.code,
                `start`.start_date AS start_date,
                `end`.start_date AS end_date
            FROM
                season AS `start`
            LEFT JOIN
                season AS `end` ON `end`.id = `start`.id + 1
        ) AS season ON season.start_date <= d.created_date AND (season.end_date IS NULL OR season.end_date > d.created_date)

    WHERE
        (d.competition_id IN (3047)) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

    HAVING
        TRUE
    ORDER BY
        active_date DESC, d.finish IS NULL, d.finish

```

[] (slow_query, 35.2, mysql)

Reported on decksite by mysql-perf

Location Hash: 396e81c364fb6116712b9cee32ae3dfebbd09d1e

Request Data ``` Request Method: GET Path: /league/current/? Cookies: {} Endpoint: current_league View Args: {} Person: logged_out Referrer: https://pennydreadfulmagic.com/league/current/ Request Data: {} Host: pennydreadfulmagic.com Accept-Encoding: gzip Cf-Ipcountry: US X-Forwarded-For: 63.143.42.244, 172.68.141.234 Cf-Ray: 53b5fdc52a8d9ae8-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} User-Agent: Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,UTF-8;q=0.7,*;q=0.7 Cache-Control: no-cache Referer: https://pennydreadfulmagic.com/league/current/ Cf-Connecting-Ip: 63.143.42.244 Cdn-Loop: cloudflare X-Forwarded-Host: pennydreadfulmagic.com X-Forwarded-Server: pennydreadfulmagic.com Connection: Keep-Alive ```
vorpal-buildbot commented 4 years ago

Exceeded slow_query limit (15.9 > 10.0) in mysql: ```

    SELECT

    d.id,
    d.finish,
    d.decklist_hash,
    cache.active_date,
    cache.wins,
    cache.losses,
    cache.draws,
    cache.color_sort,
    ct.name AS competition_type_name

    FROM
        deck AS d

    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 cache ON d.id = cache.deck_id

    LEFT JOIN
        (
            SELECT
                `start`.id,
                `start`.code,
                `start`.start_date AS start_date,
                `end`.start_date AS end_date
            FROM
                season AS `start`
            LEFT JOIN
                season AS `end` ON `end`.id = `start`.id + 1
        ) AS season ON season.start_date <= d.created_date AND (season.end_date IS NULL OR season.end_date > d.created_date)

    WHERE
        (d.competition_id IN (3047)) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

    HAVING
        TRUE
    ORDER BY
        active_date DESC, d.finish IS NULL, d.finish

```

[] (slow_query, 15.9, mysql)

Reported on decksite by mysql-perf

Location Hash: 396e81c364fb6116712b9cee32ae3dfebbd09d1e

Request Data ``` Request Method: GET Path: /league/current/? Cookies: {} Endpoint: current_league View Args: {} Person: logged_out Referrer: https://pennydreadfulmagic.com/league/current/ Request Data: {} Host: pennydreadfulmagic.com Accept-Encoding: gzip Cf-Ipcountry: US X-Forwarded-For: 63.143.42.244, 172.69.22.166 Cf-Ray: 53c898c27a18d296-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} User-Agent: Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,UTF-8;q=0.7,*;q=0.7 Cache-Control: no-cache Referer: https://pennydreadfulmagic.com/league/current/ Cf-Connecting-Ip: 63.143.42.244 Cdn-Loop: cloudflare X-Forwarded-Host: pennydreadfulmagic.com X-Forwarded-Server: pennydreadfulmagic.com Connection: Keep-Alive ```

Labels: decksite