PennyDreadfulMTG / perf-reports

2 stars 2 forks source link

Exceeded slow_query limit (12.4 > 1.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name) #63111

Open vorpal-buildbot opened 6 months ago

vorpal-buildbot commented 6 months ago
    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1312
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1312
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 12.4, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.Zkj77g.awa1FGH0pbwUxGkABn1ZOjdaK7g'), ('page_size', '100'), ('deck_id', '242699'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '49', 'include': '1 Dream Trawler\r\n1 Path to Exile\r\n1 Deduce\r\n1 No More Lies\r\n', 'exclude': '1 Swamp\r\n1 Mountain\r\n1 Forest\r\n1 Battle of Wits\r\n1 Cloudpost'} Content-Type: application/x-www-form-urlencoded Content-Length: 185 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 885e216ddaac15b2-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: hide_intro=True; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zj-82A.WEkxaw8Dsp7zRg1sKZfXXGpwe1Y; page_size=100; deck_id=242699; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zkj77g.awa1FGH0pbwUxGkABn1ZOjdaK7g Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```
vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (16.2 > 1.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1313
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1313
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 16.2, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.Zkj98w.9XvYm5sxHWRfpJSImMAlIXAhVBg'), ('page_size', '100'), ('deck_id', '242699'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '512', 'include': '1 Condemn\r\n1 Path to Exile\r\n4 Damn\r\n1 Vindicate\r\n1 Kaya, Ghost Assassin\r\n', 'exclude': '1 Island\r\n1 Mountain\r\n1 Forest'} Content-Type: application/x-www-form-urlencoded Content-Length: 167 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 885e2d548f6917de-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: hide_intro=True; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zj-82A.WEkxaw8Dsp7zRg1sKZfXXGpwe1Y; page_size=100; deck_id=242699; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zkj98w.9XvYm5sxHWRfpJSImMAlIXAhVBg Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (2.8 > 1.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1314
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1314
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 2.8, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.Zkj-sQ.rnccd7y6yIDSxgE3mGoA150LNbw'), ('page_size', '100'), ('deck_id', '242699'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '98', 'include': '4 Terisian Mindbreaker', 'exclude': ''} Content-Type: application/x-www-form-urlencoded Content-Length: 55 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 885e2fb28ba522c6-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: hide_intro=True; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zj-82A.WEkxaw8Dsp7zRg1sKZfXXGpwe1Y; page_size=100; deck_id=242699; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zkj-sQ.rnccd7y6yIDSxgE3mGoA150LNbw Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (12.2 > 1.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1315
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1315
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 12.2, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.ZkmP0w.DSH1QYkbwDGQciyaBBRg1RN8qtU'), ('deck_id', '242699'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '21', 'include': '2 Phantom Interference\r\n4 Damn\r\n4 Deduce\r\n1 Ashiok, Nightmare Weaver\r\n', 'exclude': ''} Content-Type: application/x-www-form-urlencoded Content-Length: 121 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 8861bc004d18169e-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: 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; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.ZkmP0w.DSH1QYkbwDGQciyaBBRg1RN8qtU Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (14.2 > 1.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1316
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1316
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 14.2, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.ZkmQHw.Af6oS4wJL1a7cCB0-P37h36X9rQ'), ('deck_id', '242699'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '173', 'include': '1 Akoum Battlesinger\r\n1 Bojuka Brigand\r\n1 Jwari Shapeshifter\r\n1 Kazandu Blademaster', 'exclude': ''} Content-Type: application/x-www-form-urlencoded Content-Length: 129 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 8861bda4ee06174b-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: 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; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.ZkmQHw.Af6oS4wJL1a7cCB0-P37h36X9rQ Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (14.3 > 1.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1317
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1317
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 14.3, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.ZkmQ8g.Gb-NtbLrotLXiq6dyhHKDfyKnEE'), ('deck_id', '242699'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '16', 'include': '3 Stromkirk Noble\r\n2 Vexing Devil\r\n1 Goblin Chainwhirler\r\n4 Burst Lightning\r\n', 'exclude': ''} Content-Type: application/x-www-form-urlencoded Content-Length: 126 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 8861c669e93896f0-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: 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; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.ZkmQ8g.Gb-NtbLrotLXiq6dyhHKDfyKnEE Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (10.1 > 1.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1318
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1318
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 10.1, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.ZkmRzA.SM3_coOdpZACElpoPYB9DVTAXA0'), ('deck_id', '242699'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '16', 'include': '4 Reckless Waif\r\n4 Stromkirk Noble\r\n4 Burst Lightning\r\n', 'exclude': ''} Content-Type: application/x-www-form-urlencoded Content-Length: 100 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 8861c804fd95969a-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: 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; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.ZkmRzA.SM3_coOdpZACElpoPYB9DVTAXA0 Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (9.2 > 1.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1319
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1319
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 9.2, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.ZkmSCg.uglXf7f428gJzaaXKmgGaxhdQ2Q'), ('deck_id', '242699'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '64', 'include': '4 Scavenging Ooze\r\n4 Freestrider Lookout\r\n4 Siege Rhino\r\n', 'exclude': ''} Content-Type: application/x-www-form-urlencoded Content-Length: 102 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 8861ca3c1cd2fb28-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: 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; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.ZkmSCg.uglXf7f428gJzaaXKmgGaxhdQ2Q Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (11.8 > 1.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1320
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1320
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 11.8, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.ZkmUyQ.Vkjl0BEJ3CORDvQxrtJz63zDcKQ'), ('deck_id', '242699'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '395', 'include': '2 Vexing Devil\r\n3 Dark Confidant\r\n4 Scrapheap Scrounger\r\n4 Goblin Chainwhirler\r\n', 'exclude': ''} Content-Type: application/x-www-form-urlencoded Content-Length: 130 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 8861da4e29971694-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: 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; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.ZkmUyQ.Vkjl0BEJ3CORDvQxrtJz63zDcKQ Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (6.2 > 1.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1321
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1321
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 6.2, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.ZkmVwg.6awKakqgEseKxvc__48T64JxHW4'), ('deck_id', '242699'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '54', 'include': '4 Fog\r\n4 Howling Mine\r\n', 'exclude': ''} Content-Type: application/x-www-form-urlencoded Content-Length: 64 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 8861e12bdd1096dd-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: 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; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.ZkmVwg.6awKakqgEseKxvc__48T64JxHW4 Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (5.6 > 1.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1323
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1323
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 5.6, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.ZkpC2g.WPOw69i-S60O_4Egt7JMGFOIeLg'), ('deck_id', '242699'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '74', 'include': '4 Windborn Muse\r\n1 Garruk Wildspeaker', 'exclude': '1 Island\r\n1 Swamp\r\n1 Mountain'} Content-Type: application/x-www-form-urlencoded Content-Length: 111 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 88661a0c181c169c-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: 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; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.ZkpC2g.WPOw69i-S60O_4Egt7JMGFOIeLg Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (8.4 > 1.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1324
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1324
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 8.4, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.ZkpC_Q.NaaXbArcdRH08uwp5cMjFcWkUpo'), ('deck_id', '242699'), ('page_size', '20'), ('views', '10059')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '48', 'include': '4 Tithing Blade\r\n2 Thirst for Knowledge\r\n3 Languish\r\n', 'exclude': '1 Plains\r\n1 Mountain\r\n1 Forest'} Content-Type: application/x-www-form-urlencoded Content-Length: 136 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 88661c777c1c250d-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: 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; views=10059; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.ZkpC_Q.NaaXbArcdRH08uwp5cMjFcWkUpo Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (5.4 > 1.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1325
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1325
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 5.4, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.ZkpDcg.JQUu4BZ4-I_2fnORYU43z8x53no'), ('deck_id', '242699'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '416', 'include': '4 Savor the Moment\r\n4 Fires of Invention\r\n', 'exclude': ''} Content-Type: application/x-www-form-urlencoded Content-Length: 84 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 88661e0f2c957ae0-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: 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.ZkpDcg.JQUu4BZ4-I_2fnORYU43z8x53no; views=10058 Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (5.8 > 1.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1326
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1326
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 5.8, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.ZkpD0A.VkYeHiprPFw3H9rVNZ6jr6m1Z6M'), ('deck_id', '242699'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '335', 'include': '4 Savor the Moment\r\n1 Walk the Aeons', 'exclude': ''} Content-Type: application/x-www-form-urlencoded Content-Length: 74 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 88661fdbeea6fafc-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: 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; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.ZkpD0A.VkYeHiprPFw3H9rVNZ6jr6m1Z6M Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (5.6 > 1.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1327
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1327
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 5.6, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.ZkpENg.ISHAsIA5cBz37gTxjtkrtVArjkU'), ('deck_id', '242699'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '276', 'include': '4 Demigod of Revenge\r\n2 Inferno Titan\r\n', 'exclude': '1 Plains\r\n1 Island\r\n1 Swamp\r\n1 Forest'} Content-Type: application/x-www-form-urlencoded Content-Length: 130 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 8866228e5d7c67d1-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: 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; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.ZkpENg.ISHAsIA5cBz37gTxjtkrtVArjkU Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (13.3 > 1.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1328
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1328
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 13.3, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.ZkpEkA._BHVCRzwvu_5VnhQDezjnTExmSY'), ('deck_id', '242699'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '82', 'include': '1 Spirited Companion\r\n1 Circuit Mender\r\n1 Guardian of Ghirapur\r\n1 Yorion, Sky Nomad\r\n', 'exclude': '1 Parallax Wave\r\n1 Cloudpost'} Content-Type: application/x-www-form-urlencoded Content-Length: 168 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 8866250d3f8115eb-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: 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.ZkpEkA._BHVCRzwvu_5VnhQDezjnTExmSY; views=10058 Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (18.6 > 5.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1331
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1331
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 18.6, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.Zk7t7g.P_YGUaG5FXBShm8uKT6QioT2zQw'), ('deck_id', '242892'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '82', 'include': '1 Novice Inspector\r\n1 Spirited Companion\r\n1 Circuit Mender\r\n1 Guardian of Ghirapur\r\n1 Twining Twins\r\n1 Yorion, Sky Nomad\r\n', 'exclude': ''} Content-Type: application/x-www-form-urlencoded Content-Length: 181 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 8883473dccadfb28-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: hide_intro=True; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zj-82A.WEkxaw8Dsp7zRg1sKZfXXGpwe1Y; deck_id=242892; page_size=20; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zk7t7g.P_YGUaG5FXBShm8uKT6QioT2zQw Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (5.9 > 5.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1332
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1332
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 5.9, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.Zk7uGw.AmWysrW26SgMyqa9n2LY0qLpMJQ'), ('deck_id', '242892'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '547', 'include': '1 Damn\r\n4 Solitary Confinement\r\n', 'exclude': "1 Enchantress's Presence\r\n1 Mesa Enchantress"} Content-Type: application/x-www-form-urlencoded Content-Length: 124 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 888349485cb02284-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: hide_intro=True; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zj-82A.WEkxaw8Dsp7zRg1sKZfXXGpwe1Y; deck_id=242892; page_size=20; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zk7uGw.AmWysrW26SgMyqa9n2LY0qLpMJQ Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (8.4 > 5.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1334
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1334
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 8.4, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.Zk7vfw.3Trk2VvkQ0Y0Qz3cEpTE2yhsB7I'), ('deck_id', '242892'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '566', 'include': '4 Aftermath Analyst\r\n4 Splendid Reclamation\r\n2 Field of the Dead\r\n', 'exclude': ''} Content-Type: application/x-www-form-urlencoded Content-Length: 112 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 88835122ca4b9698-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: hide_intro=True; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zj-82A.WEkxaw8Dsp7zRg1sKZfXXGpwe1Y; deck_id=242892; page_size=20; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zk7vfw.3Trk2VvkQ0Y0Qz3cEpTE2yhsB7I; views=10058 Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (13.2 > 5.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1335
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1335
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 13.2, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.Zk7v0Q.Rt9l6OZYFg9cupqeAkLjK9lGCuk'), ('deck_id', '242892'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '143', 'include': '4 Deduce\r\n4 No More Lies\r\n2 Ill-Timed Explosion\r\n4 Wrath of God\r\n', 'exclude': ''} Content-Type: application/x-www-form-urlencoded Content-Length: 115 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 888353aa5f69cfed-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: hide_intro=True; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zj-82A.WEkxaw8Dsp7zRg1sKZfXXGpwe1Y; deck_id=242892; page_size=20; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zk7v0Q.Rt9l6OZYFg9cupqeAkLjK9lGCuk Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite

vorpal-buildbot commented 6 months ago

Exceeded slow_query limit (13.0 > 5.0) in mysql: ```INSERT INTO _applied_rules (deck_id, rule_id, archetype_id, archetype_name)

    WITH rule_card_count AS
    (
        SELECT
            rule.id, COUNT(card) AS card_count
        FROM
            rule
        JOIN
            rule_card
        ON
            rule.id = rule_card.rule_id
        WHERE
            rule_card.include AND rule.id = 1336
        GROUP BY
            rule.id
    ),
    candidates AS
    (
        SELECT
            deck.id AS deck_id,
            COUNT(DISTINCT REPLACE(deck_card.card, 'Snow-Covered ', '')) AS included_count,
            MAX(rule_card_count.card_count) AS required_count,-- fake MAX due to aggregate function
            rule.id AS rule_id
        FROM
            deck
        JOIN
            deck_card
        ON
            deck.id = deck_card.deck_id
        JOIN
            (
                SELECT
                    *
                FROM
                    rule_card
                WHERE
                    include
            ) AS inclusions
        ON
            REPLACE(deck_card.card, 'Snow-Covered ', '') = inclusions.card
        JOIN
            rule
        ON
            rule.id = inclusions.rule_id
        JOIN
            rule_card_count
        ON
            rule.id = rule_card_count.id
        WHERE
            NOT deck_card.sideboard AND deck_card.n >= inclusions.n AND TRUE AND rule.id = 1336
        GROUP BY
            deck.id, rule.id
        HAVING
            included_count = required_count
    )
    SELECT
        candidates.deck_id,
        rule.id AS rule_id,
        suggested_archetype.id AS archetype_id,
        suggested_archetype.name AS archetype_name
    FROM
        candidates
    INNER JOIN
        rule
    ON
        candidates.rule_id = rule.id
    JOIN
        archetype AS suggested_archetype
    ON
        rule.archetype_id = suggested_archetype.id
    LEFT JOIN
        (
            SELECT
                *
            FROM
                rule_card
            WHERE
                NOT include
        ) AS exclusions
    ON
        candidates.rule_id = exclusions.rule_id
    LEFT JOIN
        deck_card
    ON
        candidates.deck_id = deck_card.deck_id AND exclusions.card = REPLACE(deck_card.card, 'Snow-Covered ', '') AND deck_card.n >= exclusions.n
    GROUP BY
        candidates.deck_id, rule_id
    HAVING
        COUNT(REPLACE(deck_card.card, 'Snow-Covered ', '')) = 0
```

[] (slow_query, 13.0, mysql)

Reported on decksite by mysql-perf

Location Hash: b9185b1096cbce35299642f0dc30c086b73311f4

Request Data ``` Request Method: POST Path: /admin/rules/? Cookies: ImmutableMultiDict([('hide_intro', 'True'), ('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.Zk7wGw.bWTg9RLQlbeNpMVGd2XPk6lMCkY'), ('deck_id', '242892'), ('page_size', '20'), ('views', '10058')]) Endpoint: post_rules View Args: {} Person: 195644917081440265 Referrer: https://pennydreadfulmagic.com/admin/rules/ Request Data: {'archetype_id': '64', 'include': '1 Anafenza, the Foremost\r\n1 Glissa Sunslayer\r\n1 Kunoros, Hound of Athreos\r\n1 Siege Rhino\r\n', 'exclude': '1 Island\r\n1 Mountain'} Content-Type: application/x-www-form-urlencoded Content-Length: 167 Host: pennydreadfulmagic.com Connection: Keep-Alive Accept-Encoding: gzip, br X-Forwarded-For: 136.25.106.188 Cf-Ray: 88835578ad8c7ac1-SJC X-Forwarded-Proto: https Cf-Visitor: {"scheme":"https"} Cache-Control: max-age=0 Sec-Ch-Ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Upgrade-Insecure-Requests: 1 Origin: https://pennydreadfulmagic.com 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 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/admin/rules/ Accept-Language: en-US,en;q=0.9,es;q=0.8 Priority: u=0, i Cookie: hide_intro=True; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zj-82A.WEkxaw8Dsp7zRg1sKZfXXGpwe1Y; deck_id=242892; page_size=20; views=10058; session=.eJx1UVFPwjAY_C99nmQdW2G8oQkIEojgkGjMUtZvW9nWLm2HIuG_22EQY-Jb77u73tfrEcU1qIoKEAYNjGrAQZRVXFwAg4pXkqFBSkvdYq4TqVjM7QjhMCC-H-Ke28e-73okQFdFKRNaglWBuIlWlvjfwkWcNbxkl9BfVtSiLAPW7qmlOAdjv-ugymQybjQoQatWu6UFKBOG1iFpY3Iv1oaallk85pvJcD-ezordPLpbDnN4z-8avV1n3MyueiMLGzg4IpokoPUFo8ln6ia58l4iFQXP3no16m32-X1Q4nSmnqwfPmquQMfUdohJLyRhlxCvg-3Jw1e6bZW4ft91HaQgtaP8J8MldeKzqWBjVcjRVtU5Jmyxe1i60Xx5sBm21No-5hWdm9LnPu2n8bQlv2ednbQRbw46XxqbQ2tAt0AVKHRy0N8GDVUZ2JVFU5anLysCqKs.Zk7wGw.bWTg9RLQlbeNpMVGd2XPk6lMCkY Cf-Connecting-Ip: 136.25.106.188 Cdn-Loop: cloudflare Cf-Ipcountry: US ```

Labels: decksite