Open vorpal-buildbot opened 1 month ago
Exceeded slow_query limit (161.2 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 161.2, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (142.2 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 142.2, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (148.3 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 148.3, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (137.3 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 137.3, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (145.4 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 145.4, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (146.8 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 146.8, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (417.5 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 417.5, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (132.7 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 132.7, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (144.3 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 144.3, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (141.4 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 141.4, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (143.7 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 143.7, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (142.5 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 142.5, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (146.7 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 146.7, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (146.5 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 146.5, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (142.3 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 142.3, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (139.6 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 139.6, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (145.1 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 145.1, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (155.2 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 155.2, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (140.2 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 140.2, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (140.9 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 140.9, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (139.1 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 139.1, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (141.8 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 141.8, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (139.3 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 139.3, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (139.6 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 139.6, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (140.2 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 140.2, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (143.0 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 143.0, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (145.0 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 145.0, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (141.6 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 141.6, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (138.5 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 138.5, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (140.8 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 140.8, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (142.4 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 142.4, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (138.3 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 138.3, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (142.9 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 142.9, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (141.6 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 141.6, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (135.9 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 135.9, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (143.5 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 143.5, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (142.1 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 142.1, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (139.7 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 139.7, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (148.1 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 148.1, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (142.8 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 142.8, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (153.4 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 153.4, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (146.3 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 146.3, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (145.2 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 145.2, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (140.0 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 140.0, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (142.4 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 142.4, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (141.5 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 141.5, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (141.8 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 141.8, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (141.6 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 141.6, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (146.8 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 146.8, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
Exceeded slow_query limit (139.0 > 60.0) in mysql: ```
CREATE TABLE IF NOT EXISTS _new_card_person_stats (
name VARCHAR(190) NOT NULL,
season_id INT NOT NULL,
person_id INT NOT NULL,
wins INT NOT NULL,
losses INT NOT NULL,
draws INT NOT NULL,
perfect_runs INT NOT NULL,
tournament_wins INT NOT NULL,
tournament_top8s INT NOT NULL,
deck_type ENUM('league', 'tournament', 'other') NOT NULL,
PRIMARY KEY (season_id, person_id, name, deck_type),
FOREIGN KEY (season_id) REFERENCES season (id) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (person_id) REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
INDEX idx_person_id_name (person_id, name)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
card AS name,
season.season_id,
d.person_id,
SUM(CASE WHEN d.id IS NOT NULL THEN 1 ELSE 0 END) AS num_decks,
IFNULL(SUM(dsum.wins), 0) AS wins,
IFNULL(SUM(dsum.losses), 0) AS losses,
IFNULL(SUM(dsum.draws), 0) AS draws,
SUM(CASE WHEN dsum.wins >= 5 AND dsum.losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,
SUM(CASE WHEN dsum.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,
SUM(CASE WHEN dsum.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,
(CASE WHEN ct.name = 'League' THEN 'league' WHEN ct.name = 'Gatherling' THEN 'tournament' ELSE 'other' END) AS deck_type
FROM
deck AS d
INNER JOIN
-- Eliminate maindeck/sideboard double-counting with DISTINCT. See #5493.
(SELECT DISTINCT card, deck_id FROM deck_card) AS dc ON d.id = dc.deck_id
LEFT JOIN
competition AS c ON d.competition_id = c.id
LEFT JOIN
competition_series AS cs ON cs.id = c.competition_series_id
LEFT JOIN
competition_type AS ct ON ct.id = cs.competition_type_id
LEFT JOIN deck_cache AS season ON d.id = season.deck_id
LEFT JOIN
(
SELECT
d.id,
d.created_date,
d.finish,
SUM(CASE WHEN dm.games > IFNULL(odm.games, 0) THEN 1 ELSE 0 END) AS wins, -- IFNULL so we still count byes as wins.
SUM(CASE WHEN dm.games < odm.games THEN 1 ELSE 0 END) AS losses,
SUM(CASE WHEN dm.games = odm.games THEN 1 ELSE 0 END) AS draws
FROM
deck_match AS dm
INNER JOIN
deck_match AS odm ON dm.match_id = odm.match_id AND dm.deck_id <> odm.deck_id
INNER JOIN
deck AS d ON d.id = dm.deck_id
GROUP BY
d.id
) AS dsum ON d.id = dsum.id
GROUP BY
card,
d.person_id,
season.season_id,
ct.name
ORDER BY
NULL -- Tell the database that we don't need the results back in the GROUP BY order, any order will do.
```
[]
(slow_query, 139.0, mysql)
Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08
Labels: decksite
[]
(slow_query, 145.6, mysql)Reported on decksite by mysql-perf
Location Hash: 322255e51c9c9706e542d4a8a410688b9d357f08