PennyDreadfulMTG / perf-reports

2 stars 2 forks source link

Exceeded slow_query limit (4.3 > 1.0) in mysql: ``` #63225

Open vorpal-buildbot opened 5 months ago

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

    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 deck_cache AS season ON d.id = season.deck_id
    WHERE
        (TRUE) AND (d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = 3)) 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.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
        cache.active_date DESC, d.finish ASC, cache.active_date DESC
    LIMIT 0, 20
```

[] (slow_query, 4.3, mysql)

Reported on decksite by mysql-perf

Location Hash: 9820d94d7492cf169b3ce346f3252fdf2678f843

Request Data ``` Request Method: GET Path: /api/decks/?achievementKey=&archetypeId=3&cardName=&competitionId=&competitionFlagId=&deckType=all&page=0&pageSize=20&personId=&q=&seasonId=0 Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('hide_intro', 'True'), ('page_size', '100'), ('page_size', '20'), ('views', '9622'), ('views', '10155'), ('session', '.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zj-82A.WEkxaw8Dsp7zRg1sKZfXXGpwe1Y'), ('session', '.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zkk_HA.DAp2xK589JLuTbWSGX-qF01hHIY'), ('deck_id', '242699')]) Endpoint: decks_api View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/seasons/all/archetypes/control/ Request Data: {} Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 885fc213abaffa9a-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Accept: application/json, text/plain, */* Sec-Ch-Ua-Mobile: ?0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Sec-Ch-Ua-Platform: "macOS" Sec-Fetch-Site: same-origin Sec-Fetch-Mode: cors Sec-Fetch-Dest: empty Referer: https://pennydreadfulmagic.com/seasons/all/archetypes/control/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=1, i Cookie: hide_intro=True; page_size=100; views=9622; hide_intro=True; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zj-82A.WEkxaw8Dsp7zRg1sKZfXXGpwe1Y; deck_id=242699; page_size=20; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zkk_HA.DAp2xK589JLuTbWSGX-qF01hHIY; views=10155 Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```
vorpal-buildbot commented 5 months ago

Exceeded slow_query limit (4.2 > 1.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,
    COUNT(*) OVER () AS total

    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 deck_cache AS season ON d.id = season.deck_id
    WHERE
        (TRUE) AND (d.archetype_id IN (SELECT descendant FROM archetype_closure WHERE ancestor = 3)) 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.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
        cache.active_date DESC, d.finish ASC, cache.active_date DESC
    LIMIT 0, 20
```

[] (slow_query, 4.2, mysql)

Reported on decksite by mysql-perf

Location Hash: 9820d94d7492cf169b3ce346f3252fdf2678f843

Request Data ``` Request Method: GET Path: /api/decks/?achievementKey=&archetypeId=3&cardName=&competitionId=&competitionFlagId=&deckType=all&page=0&pageSize=20&personId=&q=&seasonId=0 Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('hide_intro', 'True'), ('page_size', '100'), ('page_size', '20'), ('views', '9622'), ('views', '9996'), ('session', '.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zj-82A.WEkxaw8Dsp7zRg1sKZfXXGpwe1Y'), ('session', '.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zkk_4Q.I3FJG99rBSJ9AcmW9I6X2V6fFyg'), ('deck_id', '242699')]) Endpoint: decks_api View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/seasons/all/archetypes/control/ Request Data: {} Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 885fc6e1fb101742-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Accept: application/json, text/plain, */* Sec-Ch-Ua-Mobile: ?0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Sec-Ch-Ua-Platform: "macOS" Sec-Fetch-Site: same-origin Sec-Fetch-Mode: cors Sec-Fetch-Dest: empty Referer: https://pennydreadfulmagic.com/seasons/all/archetypes/control/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=1, i Cookie: hide_intro=True; page_size=100; views=9622; hide_intro=True; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zj-82A.WEkxaw8Dsp7zRg1sKZfXXGpwe1Y; deck_id=242699; page_size=20; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zkk_4Q.I3FJG99rBSJ9AcmW9I6X2V6fFyg; views=9996 Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite