PennyDreadfulMTG / perf-reports

2 stars 2 forks source link

Exceeded slow_query limit (63.9 > 60.0) in mysql: ``` #58812

Open vorpal-buildbot opened 2 years ago

vorpal-buildbot commented 2 years ago
    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Mesmeric Fiend', 'Duress', 'Darigaaz Reincarnated', 'Grizzly Bears', 'Unburial Rites', 'Sheltered Thicket', 'Thaumatic Compass', 'Garruk Wildspeaker', 'Gitaxian Probe', 'Shrapnel Blast', 'Vivid Creek', 'Arch of Orazca', 'Blessed Respite', 'Foundry Street Denizen', 'Wasteland Strangler', 'Oust', 'Terrarion', 'Consider', 'Tezzeret the Schemer', 'Madcap Experiment', 'Repeal', 'Vindicate', 'Set Adrift', 'Reinforced Ronin', 'Dire Fleet Daredevil', 'Pentad Prism', 'Hieroglyphic Illumination', 'Bogardan Hellkite', 'Porcelain Legionnaire', 'Prairie Stream', 'Mistvault Bridge', 'Mastermind''s Acquisition', 'Zhalfirin Void', 'Lodestone Golem', 'Llanowar Elves', 'Jace, Memory Adept', 'Harmonic Prodigy', 'Moonsilver Key', 'Daring Buccaneer', 'Rustvale Bridge', 'Mask of Immolation', 'Metalwork Colossus', 'Game Trail', 'Dire Fleet Neckbreaker', 'Dire Fleet Poisoner', 'Glorybringer', 'Voldaren Epicure', 'Merchant of the Vale', 'Kor Skyfisher', 'Reflector Mage', 'Abbot of Keral Keep', 'Vapor Snag', 'Fieldmist Borderpost', 'The Antiquities War', 'Elvish Mystic', 'Tranquil Thicket', 'Powerstone Shard', 'Dimir Charm', 'Check for Traps', 'Signal Pest', 'Silverbluff Bridge', 'Captain Lannery Storm', 'Godhead of Awe', 'Thornwood Falls', 'Goblin Bushwhacker', 'Tamiyo''s Safekeeping', 'Rule of Law', 'Sarkhan the Masterless', 'Lose Focus', 'Evolving Wilds', 'Archaeomancer', 'Frantic Search', 'Esper Charm', 'Cathartic Reunion', 'Quartzwood Crasher', 'Festival Crasher', 'Erratic Portal', 'Fetid Pools', 'Tanglepool Bridge', 'Easy Prey', 'Grizzly Fate', 'Thought Scour', 'Wildfield Borderpost', 'Flowstone Sculpture', 'Bond of Agony', 'Slagwoods Bridge', 'Sudden Edict', 'Fabricate', 'Chain of Plasma', 'Starstorm', 'Essence Flux', 'Fathom Fleet Captain', 'Wastes', 'Sculpting Steel', 'Prototype Portal', 'Farseek', 'Crumbling Vestige', 'Battle Cry Goblin', 'Sylvan Library', 'Mishra''s Factory', 'Nevinyrral''s Disk', 'Ethereal Absolution', 'Ulamog''s Nullifier', 'Shambling Vent', 'Ponder', 'Dragonskull Summit', 'Goblin Chieftain', 'Wizard''s Retort', 'Ayula''s Influence', 'Shardless Agent', 'Goblin Dark-Dwellers', 'Hypergenesis', 'Temple of Enlightenment', 'Disfigure', 'Kiln Fiend', 'Owlbear', 'Tendrils of Agony', 'Dead // Gone', 'Deadeye Tracker', 'Riptide Laboratory', 'Nissa, Worldwaker', 'Docent of Perfection', 'Howling Mine', 'Spatial Contortion', 'Dockside Chef', 'Rootbound Crag', 'Temple of the Dragon Queen', 'Memory Lapse', 'Hanweir Battlements', 'Temple of Abandon', 'Cackling Counterpart', 'Elixir of Immortality', 'Steel Hellkite', 'Yidaro, Wandering Monster', 'Field of Ruin', 'Firewild Borderpost', 'Circle of the Moon Druid', 'Anguished Unmaking', 'Swarmyard', 'Dragonspark Reactor', 'Goblin King', 'Spare Supplies', 'Mizzium Mortars', 'Kefnet the Mindful', 'Step Through', 'Sunpetal Grove', 'Kari Zev, Skyship Raider', 'Lodestone Myr', 'Conqueror''s Galleon', 'Mana Leak', 'Rampaging Ferocidon', 'Approach of the Second Sun', 'Plumeveil', 'Oni-Cult Anvil', 'Treasure Cruise', 'Greater Gargadon', 'Glimmerpost', 'Forbid', 'Watcher for Tomorrow', 'Lesser Masticore', 'Fated Infatuation', 'Quicken', 'Magister Sphinx', 'Dragon Fodder', 'Scattered Groves', 'Moonsnare Prototype', 'Platinum Angel', 'Dawn of Hope', 'Nature''s Lore', 'Peer Through Depths', 'Oblivion Ring', 'Hooting Mandrills', 'Timeless Witness', 'Wayfarer''s Bauble', 'Decree of Justice', 'Oona, Queen of the Fae', 'Huatli, Warrior Poet', 'Nevermore', 'Goblin Chainwhirler', 'Twinflame', 'Barbarian Ring', 'Vines of Vastwood', 'Heartless Act', 'Ripjaw Raptor', 'Call of the Death-Dweller', 'Intervention Pact', 'Bloodtithe Harvester', 'Condemn', 'Drowned Catacomb', 'Viashino Pyromancer', 'Army of the Damned', 'Quasiduplicate', 'Chandra Nalaar', 'Korlash, Heir to Blackblade', 'Rootwater Depths', 'Raging Ravine', 'Opt', 'Crystalline Giant', 'Swans of Bryn Argoll', 'Mogg War Marshal', 'Warstorm Surge', 'Icy Manipulator', 'Pia and Kiran Nalaar', 'Declaration in Stone', 'Prohibit', 'Druid''s Familiar', 'Fold into Aether', 'Sea Gate Oracle', 'Experimental Synthesizer', 'Sign in Blood', 'Sulfur Falls', 'Cleansing Wildfire', 'Shrine of Burning Rage', 'Jokulhaups', 'Suspend', 'Chandra, Pyromaster', 'Eternal Dragon', 'Lava Dart', 'Barren Moor', 'Seraph Sanctuary', 'Gruul Spellbreaker', 'Ancestral Anger', 'Urza''s Factory', 'Mystic Monastery', 'Condescend', 'Assault Strobe', 'Delver of Secrets', 'Vivid Meadow', 'Neutralize', 'Secluded Courtyard', 'Temple of Mystery', 'Words of Wilding', 'Forerunner of the Coalition', 'Bonders'' Enclave', 'Goreclaw, Terror of Qal Sisma', 'Treasure Map', 'Fog', 'Ajani Goldmane', 'Sleight of Hand', 'Captivating Crew', 'Glint Hawk', 'Thief of Sanity', 'Masticore', 'Stolen Goods', 'Ayula, Queen Among Bears', 'Frontier Bivouac', 'Reclaim', 'Coat of Arms', 'Mutilate', 'Incinerate', 'Ruin Raider', 'Wing Shards', 'Thraben Inspector', 'Vivid Grove', 'Search for Azcanta', 'March of Wretched Sorrow', 'Wedding Invitation', 'Jolrael, Mwonvuli Recluse', 'Energy Chamber', 'Firebrand Archer', 'Izzet Charm', 'Venser, Shaper Savant', 'Goblin Matron', 'Fact or Fiction', 'Lochmere Serpent', 'Nezahal, Primal Tide', 'Dread Fugue', 'Fanatic of Xenagos', 'Gadwick, the Wizened', 'Faithful Mending', 'Veinfire Borderpost', 'Hellkite Overlord', 'Bloodchief''s Thirst', 'Agonizing Remorse', 'Briarbridge Tracker', 'Piracy Charm', 'Ajani Unyielding', 'Darksteel Colossus', 'Simian Spirit Guide', 'Play with Fire', 'Sol Talisman', 'Vivid Marsh', 'Glorious Sunrise', 'Vivid Crag', 'Sokenzan Smelter', 'Orim''s Chant', 'Death Rattle', 'World Shaper', 'Sire of Stagnation', 'Lonely Sandbar', 'Kjeldoran Outpost', 'Circu, Dimir Lobotomist', 'Isolated Chapel', 'Labyrinth of Skophos', 'Radha, Heart of Keld', 'Power Word Kill', 'Expedition Map', 'Needle Spires', 'Rowdy Crew', 'Ghost Quarter', 'Glittering Wish', 'Dire Fleet Captain', 'Colossus of Akros', 'Titanoth Rex', 'Burst Lightning', 'Blood Fountain', 'Sweltering Suns', 'Zetalpa, Primal Dawn', 'Port Town', 'Nissa, Steward of Elements', 'Pashalik Mons', 'Golem Artisan', 'Gingerbread Cabin', 'Gideon Jura', 'Dark Ritual', 'Stromkirk Noble', 'Naban, Dean of Iteration', 'Vendetta', 'Multiple Choice', 'Canyon Slough', 'Restore Balance', 'Dispel', 'Dragonsguard Elite', 'Goblin Ringleader', 'Spoils of the Vault', 'Tectonic Giant', 'Hanweir Garrison', 'Karn, Silver Golem', 'Spikefield Hazard', 'Mindcrank', 'Demonic Dread', 'Thirst for Knowledge', 'Filigree Angel', 'Cloudpost', 'Day of Judgment', 'Archfiend''s Vessel', 'Duskmantle Guildmage', 'Razortide Bridge', 'Chief of the Foundry', 'Mistvein Borderpost'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 63.9, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (68.0 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Chandra''s Phoenix', 'Malakir Rebirth', 'Nullpriest of Oblivion', 'Chancellor of the Dross', 'Vindicate', 'Fleecemane Lion', 'Metalwork Colossus', 'Bedlam Reveler', 'Herald of the Pantheon', 'Wistful Selkie', 'Secluded Courtyard', 'Jinxed Idol', 'Ancient Amphitheater', 'Legion Angel', 'Thirst for Discovery', 'Kiora, Master of the Depths', 'Ghost Quarter', 'Bloodthrone Vampire', 'Dragonskull Summit', 'Skyclave Shade', 'Pelakka Predation', 'Rampant Growth', 'Soul''s Attendant', 'Dread Wanderer', 'Manaweft Sliver', 'Vampire''s Kiss', 'Nightscape Familiar', 'Fact or Fiction', 'Expedition Map', 'Presence of Gond', 'Mystical Teachings', 'Consider', 'Angel of Vitality', 'Prophetic Titan', 'Firja, Judge of Valor', 'Pentad Prism', 'Touch the Spirit Realm', 'Blessed Respite', 'Rootwater Depths', 'Brave the Elements', 'Midnight Guard', 'Venser, Shaper Savant', 'Sphere of Safety', 'Famished Paladin', 'Rabbit Battery', 'Ramunap Excavator', 'Overgrowth', 'Jack-o''-Lantern', 'Glimmerpoint Stag', 'Tatsunari, Toad Rider', 'Disallow', 'Always Watching', 'Shambling Ghast', 'Serrated Scorpion', 'Garruk Wildspeaker', 'Ritual of Soot', 'Roadside Reliquary', 'Vivid Meadow', 'Bastion of Remembrance', 'Veteran Warleader', 'Valiant Rescuer', 'Satyr Firedancer', 'Elspeth''s Nightmare', 'Vitu-Ghazi, the City-Tree', 'Idyllic Tutor', 'Llanowar Elves', 'Stubborn Denial', 'Taurean Mauler', 'Diregraf Ghoul', 'Shadow of the Grave', 'Infernal Grasp', 'Mistwalker', 'Gift of Fangs', 'Simian Spirit Guide', 'Repeal', 'Plow Under', 'Shrapnel Blast', 'Throes of Chaos', 'Pathrazer of Ulamog', 'Vampire Nighthawk', 'Mesmeric Fiend', 'Salt Flats', 'Pili-Pala', 'Ash Zealot', 'Viscera Seer', 'Cleansing Wildfire', 'Captivating Vampire', 'Goblin Electromancer', 'Riptide Laboratory', 'Bloodbraid Marauder', 'Asceticism', 'Sigil of the Empty Throne', 'Walk the Aeons', 'Temple of the Dragon Queen', 'Kabira Takedown', 'Bump in the Night', 'Bloodvial Purveyor', 'Voldaren Epicure', 'Gadwick, the Wizened', 'Divest', 'Rootbound Crag', 'Blackmail', 'Sterling Grove', 'Stitcher''s Graft', 'Illuna, Apex of Wishes', 'Kambal, Consul of Allocation', 'Liliana Vess', 'Sudden Edict', 'Wildfield Borderpost', 'Frontier Bivouac', 'Endless Sands', 'Myth Realized', 'Shatter the Sky', 'Vapor Snag', 'Dennick, Pious Apprentice', 'Soul Warden', 'Temple of Abandon', 'Ajani Unyielding', 'Mirrorshell Crab', 'Burst Lightning', 'Bone Shards', 'Drowned Catacomb', 'Flametongue Yearling', 'Stromkirk Captain', 'Concealing Curtains', 'Multani, Yavimaya''s Avatar', 'Glorybringer', 'Slaughter Pact', 'Mindslaver', 'Sunpetal Grove', 'Elvish Harbinger', 'Olivia, Mobilized for War', 'Fireblade Charger', 'Coiling Oracle', 'Silumgar''s Scorn', 'Dimir Charm', 'Gruul Turf', 'Hypergenesis', 'Power Conduit', 'Dark Petition', 'Suture Priest', 'Swans of Bryn Argoll', 'Isolated Chapel', 'Piracy Charm', 'Duskmantle Guildmage', 'Lose Focus', 'Sylvan Advocate', 'Dawn of Hope', 'Drannith Healer', 'Condescend', 'Flourishing Fox', 'Colossal Skyturtle', 'Ethereal Absolution', 'Treasure Mage', 'Ally Encampment', 'Talisman of Unity', 'Sweltering Suns', 'Akoum Warrior', 'Furyblade Vampire', 'Blacklance Paragon', 'Narcomoeba', 'Dragonsguard Elite', 'Lhurgoyf', 'Labyrinth of Skophos', 'Niv-Mizzet, the Firemind', 'Exhaustion', 'Nissa, Steward of Elements', 'Klothys''s Design', 'Story Circle', 'Search for Tomorrow', 'Smallpox', 'Lightning Storm', 'Shalai, Voice of Plenty', 'Fblthp, the Lost', 'Grand Architect', 'Treasure Cruise', 'Terramorphic Expanse', 'Gideon''s Intervention', 'Genesis Wave', 'Dreadhorde Invasion', 'Bolas''s Citadel', 'Aetherspouts', 'Kessig Wolf Run', 'Consume the Meek', 'Spirited Companion', 'Planar Bridge', 'Deathbringer Liege', 'Grim Haruspex', 'Explore', 'Judith, the Scourge Diva', 'Ghitu Lavarunner', 'Curious Homunculus', 'Cloudthresher', 'Abiding Grace', 'Tasigur, the Golden Fang', 'Hellkite Overlord', 'Cloudpost', 'Wasteland Strangler', 'Eye of Nowhere', 'Thirst for Knowledge', 'Dream Trawler', 'Tyrant''s Choice', 'Jwari Disruption', 'Return to the Ranks', 'Forgotten Cave', 'Wandering Fumarole', 'Griffin Aerie', 'Quag Sickness', 'Trading Post', 'Goblin Bombardment', 'Soul Spike', 'Tangled Florahedron', 'Kumano Faces Kakkazan', 'Halimar Excavator', 'Languish', 'Balustrade Spy', 'Hypnotic Specter', 'Flickerwisp', 'Gitaxian Probe', 'Brain Maggot', 'Quicksilver Gargantuan', 'Sylvan Scrying', 'Prairie Stream', 'Sanctum of Stone Fangs', 'Dryad Militant', 'Karn''s Temporal Sundering', 'Rise and Shine', 'Hieroglyphic Illumination', 'Gavony Township', 'Niambi, Esteemed Speaker', 'Juggernaut', 'Vivid Crag', 'Pirate''s Pillage', 'Shambling Vent', 'Mistvein Borderpost', 'Blessed Alliance', 'Prosperous Innkeeper', 'Fertile Ground', 'Icy Manipulator', 'Chameleon Colossus', 'Lightning Strike', 'Karametra''s Acolyte', 'Sire of Insanity', 'Yosei, the Morning Star', 'Forked Bolt', 'Lantern of the Lost', 'Khalni Ambush', 'Isamaru, Hound of Konda', 'Wall of Blossoms', 'Skirk Prospector', 'Thraben Inspector', 'Blossom Prancer', 'Tezzeret the Schemer', 'Glittering Wish', 'Oblivion Ring', 'Dread Fugue', 'Lightning Axe', 'Cloudshift', 'Two-Headed Sliver', 'Loxodon Warhammer', 'Spark Spray', 'Squadron Hawk', 'Aphemia, the Cacophony', 'Kami of False Hope', 'Kazandu Blademaster', 'Temple of Silence', 'Arbor Elf', 'Gilt-Leaf Archdruid', 'Vault of the Archangel', 'Ruric Thar, the Unbowed', 'Clinging Darkness', 'Inevitable Betrayal', 'Set Adrift', 'Westvale Abbey', 'Jwari Shapeshifter', 'Jace, Memory Adept', 'Faithful Mending', 'Search for Azcanta', 'Cut // Ribbons', 'Blazing Rootwalla', 'Nested Shambler', 'Mishra''s Factory', 'Myr Battlesphere', 'Wizard''s Retort', 'Memory Lapse', 'Deputy of Acquittals', 'Kitchen Finks', 'Greater Gargadon', 'Mesa Enchantress', 'Countryside Crusher', 'Go for Blood', 'Opt', 'Delirium Skeins', 'Field of Ruin', 'Joraga Treespeaker', 'Fetid Pools', 'End-Raze Forerunners', 'Elvish Archdruid', 'Jace, the Living Guildpact', 'Gigantosaurus', 'Putrid Goblin', 'Solitary Confinement', 'Future Sight', 'Hopeful Eidolon', 'Temple of Plenty', 'Incinerate', 'Midnight Reaper', 'Fourth Bridge Prowler', 'Jolrael, Mwonvuli Recluse', 'Glimmerpost', 'Kor Skyfisher', 'Unburial Rites', 'Tithe Taker', 'Teferi, Mage of Zhalfir', 'Strike It Rich', 'Phyrexian Scriptures', 'Viashino Pyromancer', 'Terminus', 'Commence the Endgame', 'Jungle Hollow', 'Harabaz Druid', 'Ulvenwald Hydra', 'Obzedat, Ghost Council', 'Treetop Village', 'Satyr Wayfinder', 'Mastermind''s Acquisition', 'Descendants'' Path', 'Undercity Informer', 'Pristine Talisman', 'Magister Sphinx', 'Vivid Creek', 'Vicious Conquistador', 'Prophetic Prism', 'Venom Sliver', 'Lavaclaw Reaches', 'Striking Sliver', 'Ancient Stirrings', 'Hada Freeblade', 'Magister of Worth', 'Chandra, Pyromaster', 'Runed Halo', 'Calibrated Blast', 'Footfall Crater', 'Grim Backwoods', 'Llanowar Tribe', 'Spore Frog', 'Hurricane', 'Jace Beleren', 'Harmonic Sliver', 'Fiery Temper', 'Oversoul of Dusk', 'Blackbloom Rogue', 'Basking Rootwalla', 'Seaside Citadel', 'Zombify', 'Urza''s Factory', 'The Antiquities War', 'Zombie Infestation', 'Vampire Socialite', 'Expedition Envoy', 'Dauntless Bodyguard', 'Zulaport Cutthroat', 'Ajani''s Pridemate', 'Azorius Charm', 'Warstorm Surge', 'Firja''s Retribution', 'You Find a Cursed Idol', 'Sandsteppe Citadel', 'Falkenrath Noble', 'Boomerang', 'Jokulhaups', 'Vivid Grove', 'Unholy Heat', 'Declaration in Stone', 'Think Twice', 'Cloudshredder Sliver', 'Seething Song', 'Temple of Malady', 'Mwonvuli Beast Tracker', 'Ensoul Artifact', 'Bogardan Hellkite', 'Triskelion', 'Bringer of the White Dawn', 'Evolving Wilds', 'Fieldmist Borderpost', 'Abzan Charm', 'Phoenix of Ash', 'Marwyn, the Nurturer', 'Glint-Sleeve Siphoner', 'Lotleth Giant', 'Beacon of Tomorrows', 'Guttersnipe', 'Ashen Ghoul', 'Galvanic Relay', 'Panoptic Mirror', 'Condemn', 'Dragon''s Fire', 'Chain of Plasma', 'Dissolve', 'Rix Maadi Reveler', 'Tuskguard Captain', 'Teachings of the Kirin', 'Shardless Agent', 'Crested Sunmare', 'Malakir Blood-Priest', 'Zuran Orb', 'Otherworldly Gaze', 'Lightning Rift', 'Leyline of Lifeforce', 'Harmonize', 'Tamiyo, Collector of Tales', 'Day of Judgment', 'Basilica Bell-Haunt', 'Death Cloud', 'Phantasmagorian', 'Stuffed Bear', 'Price of Progress', 'Seeker of the Way', 'Eternal Dragon', 'Sylvan Library', 'Fire Prophecy', 'Tempered Sliver', 'Hooting Mandrills', 'Elemental Mastery', 'Open the Armory', 'Dakmor Salvage', 'March of Wretched Sorrow', 'Port Town', 'Blasphemous Act', 'Carnophage', 'Carrier Thrall', 'Bloodtithe Harvester', 'Kari Zev, Skyship Raider', 'Sheltered Thicket', 'Tamiyo''s Safekeeping', 'Tendrils of Agony', 'Insolent Neonate', 'Duress', 'Wight', 'Rally the Ancestors', 'Disfigure', 'Falkenrath Gorger', 'Burning Inquiry', 'Skyclave Cleric', 'Cascading Cataracts', 'Silundi Vision', 'Master of Death', 'Collective Defiance', 'Shard Volley', 'Lingering Souls', 'Traverse the Ulvenwald', 'Late to Dinner', 'Lumbering Falls', 'Tectonic Giant', 'Play with Fire', 'Elvish Mystic', 'Ghostway', 'Veinfire Borderpost', 'Fabricate', 'Bloodchief''s Thirst', 'Sanguine Statuette', 'Verduran Enchantress', 'Turn Aside', 'Knight of the White Orchid', 'Rattleclaw Mystic', 'Sidewinder Sliver', 'Tidehollow Sculler', 'Dark Ritual', 'Ponder', 'Glint Hawk', 'Sylvan Primordial', 'Rustvale Bridge', 'Temple of Mystery', 'Cyclone Summoner', 'Birds of Paradise', 'Olivia''s Bloodsworn', 'Firewild Borderpost', 'Primal Command', 'Barbarian Ring', 'Nature''s Lore', 'Trelasarra, Moon Dancer', 'Thornwood Falls', 'Scattered Groves', 'Bala Ged Recovery', 'The First Iroan Games', 'Dictate of Kruphix', 'Glen Elendra Archmage', 'Hostile Desert', 'Acidic Slime', 'Spell Burst', 'Radha, Heart of Keld', 'Setessan Petitioner', 'Forbid', 'Frantic Search', 'Arch of Orazca', 'Gideon Jura', 'Flame Rift', 'Laboratory Maniac', 'Primalcrux', 'Darksteel Colossus', 'Dead Weight', 'Dread Return', 'Hanweir Militia Captain', 'Lochmere Serpent', 'Thunderous Wrath', 'Orim''s Chant', 'Abzan Falconer', 'Warlock Class', 'Mana Leak', 'Generous Visitor', 'Jungle Shrine', 'Force of Nature', 'Costly Plunder', 'Conflagrate', 'Stirring Wildwood', 'Zof Consumption', 'Combustible Gearhulk', 'Raging Ravine', 'Mindcrank', 'Winds of Abandon', 'Firebolt', 'Experimental Synthesizer', 'Canyon Slough', 'Vampire Lacerator', 'Flame Slash', 'Craw Giant', 'Drannith Stinger', 'Ghalta, Primal Hunger', 'Restore Balance', 'Bonesplitter Sliver', 'Nevinyrral''s Disk', 'Wolfbriar Elemental', 'Pyretic Ritual', 'Woe Strider', 'Empty the Warrens', 'Pyroclasm', 'Martyr of Sands', 'Tymaret Calls the Dead', 'Stromkirk Noble', 'Ad Nauseam', 'Coalition Relic', 'Putrid Imp', 'Hateful Eidolon', 'Sleight of Hand', 'Cleric Class', 'Ravenous Trap', 'Colossus of Akros', 'Vigor Mortis', 'Dragon''s Hoard', 'Neheb, the Worthy', 'Temple of Malice', 'Supreme Will', 'Decree of Justice', 'Wall of Omens', 'Demonic Dread', 'Ranger''s Guile', 'Zenith Flare', 'Izzet Charm', 'Buried Ruin', 'Chandra, Fire Artisan', 'Lupine Prototype', 'Blowfly Infestation', 'Blade Splicer', 'Predatory Sliver', 'Shigeki, Jukai Visionary', 'Timeless Witness', 'Crumbling Vestige', 'Samut, Tyrant Smasher', 'Spikefield Hazard', 'Lurking Roper', 'Kogla, the Titan Ape', 'Sphere of the Suns', 'Sulfur Falls', 'Quarantine Field', 'Razortide Bridge', 'Guul Draz Vampire', 'Oust', 'Secluded Steppe', 'Thaumatic Compass', 'Niv-Mizzet, Dracogenius', 'Hapatra, Vizier of Poisons', 'Tyrant''s Scorn', 'Orzhov Charm', 'Genesis Ultimatum', 'Flood Plain', 'Brainstone', 'Keldon Marauders', 'Darigaaz Reincarnated', 'Dark Prophecy', 'Thryx, the Sudden Storm', 'Elixir of Immortality', 'Mirage Mirror', 'Dead // Gone', 'Silverbluff Bridge', 'Delver of Secrets', 'Quicken', 'Memnarch', 'Asylum Visitor', 'Flame Javelin', 'Oran-Rief Survivalist', 'Sunstrike Legionnaire', 'Thought Scour', 'Power Word Kill', 'Rofellos, Llanowar Emissary', 'Lathliss, Dragon Queen', 'Ayara, First of Locthwain', 'Reinforced Ronin'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 68.0, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (71.2 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Resurgent Belief', 'Alms of the Vein', 'End-Raze Forerunners', 'Soul of Innistrad', 'Just the Wind', 'Lumbering Falls', 'Sylvan Primordial', 'Nissa, Worldwaker', 'Satyr Wayfinder', 'Sire of Insanity', 'Inscription of Ruin', 'Tidehollow Sculler', 'Llanowar Elves', 'Wildfire', 'Irencrag Feat', 'Brain Freeze', 'Mesmeric Fiend', 'Priest of Ancient Lore', 'Noose Constrictor', 'Rakdos Headliner', 'Opulent Palace', 'Godhead of Awe', 'Barrier of Bones', 'Orcish Lumberjack', 'Countersquall', 'Spell Burst', 'Adventuring Gear', 'Step Through', 'Talisman of Conviction', 'Metalwork Colossus', 'Rootbound Crag', 'Honor of the Pure', 'Mana Leak', 'Malakir Rebirth', 'Sign in Blood', 'Blisterpod', 'Touch the Spirit Realm', 'Bloodvial Purveyor', 'Heir of Falkenrath', 'Intangible Virtue', 'Sejiri Shelter', 'Sword-Point Diplomacy', 'Borrowed Time', 'Squadron Hawk', 'Tamiyo, Collector of Tales', 'Rustvale Bridge', 'Shambling Vent', 'Sandsteppe Citadel', 'Hypnotic Specter', 'Drannith Stinger', 'Voldaren Epicure', 'Ultimate Price', 'Reckless Imp', 'Mantis Rider', 'Rally for the Throne', 'Reckless Wurm', 'Deploy the Gatewatch', 'Forgotten Cave', 'Spectral Procession', 'Desert of the True', 'Heartless Summoning', 'Jor Kadeen, the Prevailer', 'Sandstorm Eidolon', 'Duress', 'Blightning', 'Grapple with the Past', 'Fossil Find', 'Mage-Ring Bully', 'Bone Shards', 'Sunscorched Desert', 'Scoured Barrens', 'Chasm Skulker', 'Slagwoods Bridge', 'Drey Keeper', 'Paralyze', 'Memory Lapse', 'Nicol Bolas, Planeswalker', 'Sacred Fire', 'Unholy Heat', 'Suspend', 'Narcomoeba', 'Bogardan Hellkite', 'Simian Spirit Guide', 'Hanweir Militia Captain', 'Verdant Eidolon', 'Undercity Informer', 'Harrow', 'Harmonize', 'Vampires'' Vengeance', 'Champion of Wits', 'Greater Gargadon', 'Ramunap Excavator', 'Wildfield Borderpost', 'Fiery Temper', 'Putrid Imp', 'Expansion // Explosion', 'Recruit the Worthy', 'Honden of Infinite Rage', 'Basilica Bell-Haunt', 'Calibrated Blast', 'Ponder', 'Tamiyo''s Safekeeping', 'Huatli, Warrior Poet', 'Yahenni''s Expertise', 'Elvish Mystic', 'Earthshaker Khenra', 'Sidisi, Brood Tyrant', 'Steppe Lynx', 'Thaumatic Compass', 'Chancellor of the Dross', 'Wandering Fumarole', 'Wasteland Strangler', 'Disfigure', 'Gitaxian Probe', 'Prairie Stream', 'Incinerate', 'Skyclave Cleric', 'Renegade Tactics', 'Arcane Sanctum', 'Assault Strobe', 'Glimmerpost', 'Imposing Vantasaur', 'Terramorphic Expanse', 'Mountain Valley', 'Fieldmist Borderpost', 'Honored Hydra', 'Sleeper Agent', 'Commune with the Gods', 'Sulfur Falls', 'Mystic Retrieval', 'Gilt-Leaf Archdruid', 'Blackmail', 'Dream Trawler', 'Galvanic Relay', 'Ajani Unyielding', 'Gideon Jura', 'Harmonic Prodigy', 'Temple of Silence', 'Rhys the Redeemed', 'Crumbling Vestige', 'Joraga Treespeaker', 'Raking Claws', 'Pyretic Ritual', 'Goreclaw, Terror of Qal Sisma', 'Shredded Sails', 'Darkmoss Bridge', 'Eldrazi Displacer', 'Abrade', 'The Antiquities War', 'Bring to Light', 'Marwyn, the Nurturer', 'Magus of the Bazaar', 'Experimental Frenzy', 'Brute Force', 'Vorapede', 'Temple of Enlightenment', 'Reckless Impulse', 'Brainstone', 'Tezzeret the Schemer', 'Battle at the Bridge', 'Godo, Bandit Warlord', 'Will of the All-Hunter', 'Secluded Courtyard', 'Taborax, Hope''s Demise', 'Barbarian Ring', 'Pyromancer Ascension', 'Divination', 'Vessel of Volatility', 'Geomancer''s Gambit', 'Seething Song', 'Tanglepool Bridge', 'Shrine of Burning Rage', 'Primal Command', 'Tectonic Giant', 'Lunarch Veteran', 'Urza''s Factory', 'Stone Rain', 'Kitchen Finks', 'Vance''s Blasting Cannons', 'Acidic Slime', 'Wild Cantor', 'Blood Scrivener', 'Flood Plain', 'Glorybringer', 'Catalyst Elemental', 'Underworld Connections', 'Lose Focus', 'Decree of Justice', 'Zombie Infestation', 'Shardless Agent', 'Sol Talisman', 'Burning of Xinye', 'Raise the Alarm', 'Sarcomancy', 'Kunoros, Hound of Athreos', 'Timeless Witness', 'Glint-Sleeve Siphoner', 'Cleansing Wildfire', 'Stinkweed Imp', 'Mystic Monastery', 'Dread Return', 'Flickerwisp', 'Blessed Alliance', 'Forbid', 'Tormented Hero', 'Prismari Campus', 'Blazing Rootwalla', 'Lantern-Lit Graveyard', 'Game Trail', 'Gigantosaurus', 'Patchwork Automaton', 'Genesis Wave', 'Hostage Taker', 'Izzet Charm', 'Deep Analysis', 'Midnight Clock', 'Dash Hopes', 'Unexpected Windfall', 'Tranquil Thicket', 'Tangled Florahedron', 'Master of Etherium', 'Cleric Class', 'Rooting Moloch', 'Day of Judgment', 'Talisman of Impulse', 'Nullpriest of Oblivion', 'Vendetta', 'Tormented Soul', 'Silverbluff Bridge', 'Explorer''s Scope', 'Channel the Suns', 'Undying Flames', 'Birds of Paradise', 'Shrapnel Blast', 'Restore Balance', 'Bloodbraid Marauder', 'Mindslaver', 'Molten Rain', 'Lavaclaw Reaches', 'Light Up the Night', 'Hard Evidence', 'Stubborn Denial', 'Experimental Synthesizer', 'Bile Blight', 'Arcane Infusion', 'Baneslayer Angel', 'Cliffhaven Kitesail', 'Underworld Dreams', 'Balefire Liege', 'Talisman of Curiosity', 'Murderous Cut', 'Ravenous Squirrel', 'Zealous Persecution', 'Piranha Marsh', 'Arc-Slogger', 'Groundswell', 'Feed the Swarm', 'Mirrorshell Crab', 'Cruel Ultimatum', 'Colossal Skyturtle', 'Pieces of the Puzzle', 'Empyrial Plate', 'Valakut Predator', 'Basking Rootwalla', 'Azorius Charm', 'Leatherback Baloth', 'Brave the Elements', 'Arbor Elf', 'Pain Seer', 'Swarmyard', 'Lochmere Serpent', 'Drannith Healer', 'Fiend Hunter', 'Lava Serpent', 'Brash Taunter', 'Lyra Dawnbringer', 'Liliana''s Caress', 'Ancient Amphitheater', 'Vault of the Archangel', 'Blade Splicer', 'Wheel of Fate', 'Reverse Engineer', 'Gaea''s Will', 'Merchant of the Vale', 'Essence Flux', 'Dragonskull Summit', 'Barrin, Tolarian Archmage', 'Seize the Spoils', 'Cathartic Reunion', 'Mul Daya Channelers', 'Unbreakable Formation', 'Balustrade Spy', 'Sylvan Messenger', 'Sarkhan, the Dragonspeaker', 'Raging Ravine', 'Thoughts of Ruin', 'Entropic Eidolon', 'Drossforge Bridge', 'Llanowar Tribe', 'Mishra''s Factory', 'Myr Superion', 'Secluded Steppe', 'Jace, the Living Guildpact', 'Hanweir Battlements', 'Expedition Map', 'Unmake', 'Squirrel Sanctuary', 'Candletrap', 'Karametra''s Acolyte', 'Safehold Elite', 'Blasphemous Act', 'Commence the Endgame', 'Throes of Chaos', 'Delver of Secrets', 'Starstorm', 'Weathered Wayfarer', 'Dennick, Pious Apprentice', 'Agonizing Remorse', 'Plated Geopede', 'Thraben Inspector', 'Wolfwillow Haven', 'Easy Prey', 'Helm of the Host', 'Makindi Sliderunner', 'Consider', 'Sea Gate Oracle', 'Skarrgan Hellkite', 'Luminarch Ascension', 'Chitterspitter', 'Empty the Warrens', 'Spark Spray', 'Castigate', 'Dragonsguard Elite', 'Dermotaxi', 'Soul Spike', 'Increasing Vengeance', 'Blackbloom Rogue', 'Sunpetal Grove', 'Dark Ritual', 'Nezumi Graverobber', 'Braid of Fire', 'Evolving Wilds', 'Hanweir Garrison', 'Shape of the Wiitigo', 'Mycosynth Golem', 'Firewild Borderpost', 'Flourishing Fox', 'Boros Reckoner', 'Think Twice', 'Moonsnare Prototype', 'Dire Fleet Daredevil', 'Temple of Triumph', 'Jace Beleren', 'Fertile Ground', 'Mwonvuli Acid-Moss', 'Bump in the Night', 'Keruga, the Macrosage', 'Glint-Horn Buccaneer', 'Reckless Rage', 'Nip Gwyllion', 'Hieroglyphic Illumination', 'Cloudshift', 'Signal Pest', 'Search for Tomorrow', 'Stromkirk Noble', 'Desert of the Fervent', 'Azor, the Lawbringer', 'Elixir of Immortality', 'Gadwick, the Wizened', 'Banehound', 'Whip of Erebos', 'Scuttletide', 'Melira, Sylvok Outcast', 'Bloodtithe Harvester', 'Nomad Outpost', 'Fetid Pools', 'Merfolk Secretkeeper', 'Verdant Command', 'Strongarm Tactics', 'Obzedat, Ghost Council', 'Elvish Archdruid', 'Scryb Ranger', 'Goblin Dark-Dwellers', 'Sarkhan the Masterless', 'Faithful Mending', 'Goblin Bombardment', 'Scattered Groves', 'Sanctum of Stone Fangs', 'Archaeomancer', 'Sprite Dragon', 'Assemble the Legion', 'Soul of Theros', 'Carnophage', 'Volcanic Salvo', 'Carth the Lion', 'Teferi, Mage of Zhalfir', 'Shrine of the Forsaken Gods', 'Rakdos Cackler', 'Cascading Cataracts', 'Harsh Mentor', 'Oblivion Ring', 'Profane Prayers', 'Kari Zev, Skyship Raider', 'Battle Screech', 'Isolated Chapel', 'Rofellos, Llanowar Emissary', 'Incendiary Command', 'Pelakka Predation', 'Valiant Rescuer', 'Sweltering Suns', 'Soul of New Phyrexia', 'Frantic Search', 'Sorin Markov', 'Lorehold Command', 'Silence', 'Sephara, Sky''s Blade', 'Razortide Bridge', 'Zenith Flare', 'Cathartic Pyre', 'Vampire Nighthawk', 'Collective Defiance', 'Crumbling Necropolis', 'Watcher for Tomorrow', 'Ulamog''s Nullifier', 'Sheltered Thicket', 'Laboratory Maniac', 'Goblin Electromancer', 'Asylum Visitor', 'Footfall Crater', 'Elvish Piper', 'Combustible Gearhulk', 'Archfiend''s Vessel', 'Prowling Serpopard', 'Ammit Eternal', 'Kiln Fiend', 'Kambal, Consul of Allocation', 'Lantern of the Lost', 'Complicate', 'Languish', 'Diregraf Ghoul', 'Mistvein Borderpost', 'Klothys''s Design', 'Darksteel Brute', 'Imperious Perfect', 'Lingering Souls', 'Rush of Adrenaline', 'Terminus', 'Desecration Demon', 'Jeskai Charm', 'Magus of the Moat', 'Port Town', 'Stitch in Time', 'Treasure Cruise', 'Eiganjo Castle', 'Zurgo Bellstriker', 'Runed Halo', 'Pyroclasm', 'Kabira Takedown', 'Lavaball Trap', 'Azami, Lady of Scrolls', 'Burning Inquiry', 'Veinfire Borderpost', 'Eldrazi Mimic', 'Run Amok', 'Dire-Strain Rampage', 'Joraga Warcaller', 'Dihada''s Ploy', 'Tibalt, the Fiend-Blooded', 'Ensoul Artifact', 'Lava Dart', 'Cloudpost', 'Utopia Tree', 'Pathrazer of Ulamog', 'Out of Time', 'Oust', 'World Shaper', 'Set Adrift', 'Sovereign''s Bite', 'Jolrael, Mwonvuli Recluse', 'Setessan Petitioner', 'Frontier Bivouac', 'Lightning Angel', 'Centaur Garden', 'Dryad Militant', 'Thryx, the Sudden Storm', 'Stillmoon Cavalier', 'Pack Rat', 'Storm Herald', 'Arrogant Wurm', 'Read the Bones', 'Kitesail Freebooter', 'Etali, Primal Storm', 'Tavern Scoundrel', 'Sudden Edict', 'Genju of the Realm', 'Liliana Vess', 'Swell of Growth', 'Shatter the Sky', 'Zektar Shrine Expedition', 'Angel of Glory''s Rise', 'Fabricate', 'Umara Wizard', 'Pentad Prism', 'Bloodchief''s Thirst', 'Ghalta, Primal Hunger', 'Aetherling', 'Chandra, the Firebrand', 'Bloodchief Ascension', 'Cruel Reality', 'Nightsky Mimic', 'Festival Crasher', 'Aurora Eidolon', 'Spitemare', 'Buried Ruin', 'Krenko, Tin Street Kingpin', 'Arch of Orazca', 'Rabbit Battery', 'Zof Consumption', 'Bazaar Trademage', 'Firespout', 'Future Sight', 'Lightning Rift', 'Aethersphere Harvester', 'Temple of Mystery', 'Grand Arbiter Augustin IV', 'Jwari Disruption', 'Sidisi, Undead Vizier', 'Kher Keep', 'Temple of Deceit', 'Strike It Rich', 'Ranger''s Guile', 'Wonder', 'Reflector Mage', 'Metallic Rebuke', 'Mogis''s Marauder', 'Fact or Fiction', 'Isshin, Two Heavens as One', 'Dread Fugue', 'Celestial Gatekeeper', 'Song of Creation', 'Thornwood Falls', 'Vindicate', 'Talara''s Battalion', 'Traverse the Ulvenwald', 'Tyrant''s Scorn', 'Riftwing Cloudskate', 'Mistvault Bridge', 'Umbral Mantle', 'Brutal Hordechief', 'Spell Pierce', 'Cleric of Life''s Bond', 'Venser, Shaper Savant', 'Disallow', 'Viashino Pyromancer', 'Go for Blood', 'Winds of Abandon', 'Prophetic Prism', 'Field of Ruin', 'Ghost Quarter', 'Phyrexian Dreadnought', 'Riptide Laboratory', 'Dead // Gone', 'Power Word Kill', 'Krark''s Thumb', 'Drowned Catacomb', 'Mystical Teachings', 'Jokulhaups', 'Experimental Overload', 'Garruk Wildspeaker', 'Play with Fire', 'Mizzium Mortars', 'Ghostly Pilferer', 'Repeal', 'Ancestral Anger', 'Vampire''s Kiss', 'Temple of Malice', 'Imperious Oligarch', 'Heartless Act', 'Squirrel Sovereign', 'Leyline of the Meek', 'Sanguine Statuette', 'Hellkite Overlord', 'Flame Slash', 'Negate', 'Nissa, Steward of Elements', 'Rite of Belzenlok', 'Thought Scour', 'Burst Lightning', 'Deep Forest Hermit', 'Thief of Sanity', 'Edge of the Divinity', 'Falkenrath Gorger', 'Keldon Megaliths', 'Somber Hoverguard', 'Megrim', 'Phage the Untouchable', 'Ondu Inversion', 'Panic', 'Tyrant''s Choice', 'Beckon Apparition', 'Crash Through', 'Canyon Slough', 'Vapor Snag', 'Demonic Dread', 'Kumano Faces Kakkazan', 'Dragonstorm', 'Spikefield Hazard', 'Psychic Spiral', 'Wild Mongrel', 'Okiba Reckoner Raid', 'Tendrils of Agony', 'Lead the Stampede', 'Infernal Grasp', 'Westvale Abbey', 'Jace, Memory Adept', 'Condemn', 'Elvish Harbinger', 'Phantasmagorian', 'Circular Logic', 'Kitchen Imp', 'Yusri, Fortune''s Flame', 'Search for Azcanta', 'Thalia, Heretic Cathar', 'Naban, Dean of Iteration', 'Blood Fountain', 'Arlinn Kord', 'Rise and Shine', 'Sylvan Library', 'Wayfarer''s Bauble', 'Banefire', 'Temple of Malady'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 71.2, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (74.9 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Brokers Hideout', 'Terramorphic Expanse', 'Ojutai''s Command', 'Dragonkin Berserker', 'Nephalia Drownyard', 'Hellrider', 'Prohibit', 'Crumbling Necropolis', 'Strike It Rich', 'Champion of the Parish', 'Into the Story', 'Hypnotic Specter', 'Oran-Rief, the Vastwood', 'Ponder', 'Vedalken Shackles', 'Thirst for Discovery', 'Moonring Island', 'Midnight Clock', 'Carnophage', 'Radiant Scrollwielder', 'Mesmeric Fiend', 'Cordial Vampire', 'Dovin Baan', 'Silvergill Adept', 'Infernal Grasp', 'Icehide Golem', 'Barter in Blood', 'Barrin, Tolarian Archmage', 'Tuktuk Rubblefort', 'Index', 'Sylvan Scrying', 'Wandering Mind', 'Ancient Stirrings', 'Reinforced Ronin', 'Martyr of Sands', 'Birds of Paradise', 'Retreat to Coralhelm', 'Phyrexian Dreadnought', 'Westvale Abbey', 'Magister Sphinx', 'Snow-Covered Swamp', 'Colossal Skyturtle', 'Worldgorger Dragon', 'Olivia''s Dragoon', 'Rishadan Dockhand', 'Fire-Lit Thicket', 'Ember Swallower', 'Shred Memory', 'White Sun''s Zenith', 'Dark Salvation', 'Indulgent Aristocrat', 'Terastodon', 'Lonis, Cryptozoologist', 'Skirge Familiar', 'Graf Reaver', 'Wight', 'Thassa''s Intervention', 'Rite of Oblivion', 'Obstinate Baloth', 'Reckoner''s Bargain', 'Frantic Inventory', 'Mission Briefing', 'Foreboding Ruins', 'Loxodon Warhammer', 'Lens of Clarity', 'Radha, Heart of Keld', 'Borborygmos Enraged', 'Temple of Deceit', 'Spirited Companion', 'Stone Rain', 'Casualties of War', 'Kitchen Imp', 'Oracle of Mul Daya', 'Azorius Charm', 'Mishra''s Factory', 'Drowned Catacomb', 'Bane of Bala Ged', 'Treasure Map', 'Shard Volley', 'Ral Zarek', 'Demigod of Revenge', 'Prophetic Prism', 'Spell Pierce', 'Vault of the Archangel', 'Incubation Druid', 'Knight of the White Orchid', 'Lightmine Field', 'Wonder', 'Tangle', 'Plunge into Darkness', 'Anointed Procession', 'Vindicate', 'Drannith Healer', 'Falkenrath Gorger', 'Boros Elite', 'Wrath of God', 'Labyrinth of Skophos', 'Jace''s Phantasm', 'Diabolic Tutor', 'Abiding Grace', 'Folio of Fancies', 'Cruel Ultimatum', 'Breaking // Entering', 'Retraction Helix', 'Gilded Pinions', 'Quicken', 'Phylactery Lich', 'Fire Covenant', 'Frontier Bivouac', 'Diregraf Colossus', 'Future Sight', 'Gigadrowse', 'Double Vision', 'Pull from Tomorrow', 'Memorial to War', 'Ritual of Soot', 'Lashwrithe', 'Overrun', 'Dead Weight', 'Reality Ripple', 'Fraying Sanity', 'Experimental Synthesizer', 'Arcbound Ravager', 'Vampire''s Kiss', 'Hornet Queen', 'Walk the Aeons', 'Forbidden Alchemy', 'Circular Logic', 'Riveteers Charm', 'Lathliss, Dragon Queen', 'Thoughtpicker Witch', 'Treacherous Blessing', 'Steel Overseer', 'View from Above', 'Repeal', 'Bala Ged Recovery', 'Vampire Nighthawk', 'Acidic Slime', 'Safehold Elite', 'Behold the Multiverse', 'Expansion // Explosion', 'Brain Freeze', 'Shisato, Whispering Hunter', 'Putrefy', 'Clifftop Retreat', 'Outland Liberator', 'Kambal, Consul of Allocation', 'Sphere of Safety', 'Mana Bloom', 'The Underworld Cookbook', 'Opulent Palace', 'Arcane Sanctum', 'Cultivate', 'Augur of Bolas', 'Magma Spray', 'Nether Spirit', 'Spikefield Hazard', 'Oust', 'Voltaic Servant', 'Timely Reinforcements', 'Benalish Marshal', 'Consume the Meek', 'Vigor', 'Zabaz, the Glimmerwasp', 'Geomancer''s Gambit', 'Vilis, Broker of Blood', 'Oni-Cult Anvil', 'Loxodon Smiter', 'Weapons Trainer', 'Flame Rift', 'Smiting Helix', 'Hero''s Downfall', 'Shatter the Sky', 'Krosan Wayfarer', 'Duress', 'Lonely Sandbar', 'Cabal Stronghold', 'Grand Arbiter Augustin IV', 'Adorned Pouncer', 'Consult the Necrosages', 'Bloodchief''s Thirst', 'Trostani''s Summoner', 'Animation Module', 'Negate', 'Tajic, Legion''s Edge', 'Sultai Charm', 'Teferi''s Moat', 'Urza''s Factory', 'Jungle Shrine', 'Gideon Jura', 'Vexing Shusher', 'Tendrils of Agony', 'Sterling Grove', 'Moritte of the Frost', 'Bogardan Hellkite', 'Rootbound Crag', 'Kaya, Ghost Assassin', 'Animate Dead', 'Robe of Mirrors', 'Necrotic Ooze', 'Quicksilver Gargantuan', 'Abundant Harvest', 'Burglar Rat', 'Sky Hussar', 'Temple of Plenty', 'Consul''s Lieutenant', 'Ghost Quarter', 'Falkenrath Aristocrat', 'Fblthp, the Lost', 'Hissing Quagmire', 'Melira, Sylvok Outcast', 'Nyxathid', 'Iceberg Cancrix', 'Seshiro the Anointed', 'Victim of Night', 'Cerulean Wisps', 'Mirage Mirror', 'Stromkirk Noble', 'Cloudpost', 'Hanweir Militia Captain', 'Wooded Bastion', 'Centaur Garden', 'Go for Blood', 'Earthshaker Khenra', 'Maestros Charm', 'Wolfir Silverheart', 'Banishing Knack', 'Charge Through', 'Song of Creation', 'Memoricide', 'Realm Razer', 'Makeshift Mannequin', 'Kunoros, Hound of Athreos', 'Desecration Demon', 'Pillage', 'Blighted Agent', 'Dragonstorm', 'Talons of Wildwood', 'Fume Spitter', 'Pianna, Nomad Captain', 'Commence the Endgame', 'Sarcomancy', 'Moonsnare Prototype', 'Master of the Pearl Trident', 'Always Watching', 'Overwhelmed Apprentice', 'Temple of Malady', 'Big Score', 'Evacuation', 'Gray Merchant of Asphodel', 'Figure of Destiny', 'Grim Lavamancer', 'Hinterland Harbor', 'Sacred Fire', 'Ulvenwald Mysteries', 'Field of Ruin', 'Jungle Hollow', 'Bad River', 'Battle of Wits', 'Mistcutter Hydra', 'Arguel''s Blood Fast', 'Llanowar Wastes', 'Angel''s Herald', 'Prizefight', 'Bloodtithe Harvester', 'Bloodgift Demon', 'Rakdos Headliner', 'Tendo Ice Bridge', 'Crack Open', 'Orochi Sustainer', 'Scrap Trawler', 'Hanweir Garrison', 'Calciform Pools', 'Delver of Secrets', 'Whip of Erebos', 'Mistvault Bridge', 'Hymn to Tourach', 'Rocco, Cabaretti Caterer', 'Incandescent Aria', 'Growth-Chamber Guardian', 'Anax, Hardened in the Forge', 'Time Wipe', 'Canyon Slough', 'Fatestitcher', 'Sylvan Primordial', 'Dismal Backwater', 'Bile Blight', 'Elixir of Immortality', 'Hero of Precinct One', 'Patagia Viper', 'Silverbluff Bridge', 'Dennick, Pious Apprentice', 'Arcbound Mouser', 'Distended Mindbender', 'Contested War Zone', 'Wormfang Drake', 'Black Sun''s Zenith', 'Harmonize', 'Wayward Guide-Beast', 'Experimental Overload', 'Biomancer''s Familiar', 'Selesnya Sanctuary', 'Vessel of Nascency', 'Jeskai Ascendancy', 'Tempered Steel', 'Blightning', 'Wasteland Strangler', 'Might of Old Krosa', 'Teferi, Mage of Zhalfir', 'Falkenrath Forebear', 'Shredded Sails', 'Arch of Orazca', 'Ohran Viper', 'Outlaws'' Merriment', 'Restoration Angel', 'Zombify', 'Basri''s Lieutenant', 'Terrarion', 'Detention Sphere', 'Nightveil Specter', 'Judge''s Familiar', 'Crumbling Vestige', 'Improbable Alliance', 'Barrenton Medic', 'Etherium Sculptor', 'Florian, Voldaren Scion', 'Saw It Coming', 'Cathartic Pyre', 'Thaumatic Compass', 'Touch the Spirit Realm', 'Deep Analysis', 'Favored Hoplite', 'Temple of Mystery', 'Dread Fugue', 'Ash Zealot', 'Commune with the Gods', 'Carom', 'Kird Ape', 'Jace Beleren', 'Falkenrath Pit Fighter', 'Diabolic Edict', 'Lost Legacy', 'Anafenza, Kin-Tree Spirit', 'Nephalia Academy', 'Asmodeus the Archfiend', 'Caldera Hellion', 'Stromkirk Captain', 'Izzet Boilerworks', 'Hypnotic Grifter', 'Scryb Ranger', 'Karn''s Temporal Sundering', 'Declaration in Stone', 'Trickbind', 'It That Betrays', 'Mouth // Feed', 'Ruin Crab', 'Soulherder', 'Rotten Reunion', 'Riptide Laboratory', 'Verdurous Gearhulk', 'Abrade', 'Orim''s Chant', 'Verdant Command', 'Temple of Abandon', 'Duplicant', 'Mind Funeral', 'Abbot of Keral Keep', 'Harald Unites the Elves', 'Heartless Act', 'Oath of Jace', 'Dream Trawler', 'Hall of the Bandit Lord', 'Bronzehide Lion', 'Wild Mongrel', 'Ravenous Squirrel', 'Throne of Geth', 'Dragonskull Summit', 'Reckless Impulse', 'Death Cloud', 'Sign in Blood', 'Strategic Planning', 'Soldier of the Pantheon', 'Teysa, Orzhov Scion', 'Kumano Faces Kakkazan', 'Scab-Clan Berserker', 'Costly Plunder', 'Sigil of the Empty Throne', 'Grimdancer', 'Secluded Courtyard', 'Ghitu Lavarunner', 'Phyrexian Revoker', 'Lotleth Giant', 'The Scorpion God', 'Beacon of Tomorrows', 'Dread Return', 'Thought Erasure', 'Kefnet the Mindful', 'Condemn', 'Blessed Alliance', 'Lumbering Falls', 'Logic Knot', 'Champion of Wits', 'Diregraf Ghoul', 'Commit // Memory', 'Raging Ravine', 'Stormfist Crusader', 'Goblin Bombardment', 'Sorin Markov', 'Ornithopter', 'Ensoul Artifact', 'Elvish Mystic', 'Into the Roil', 'Dread Presence', 'Linvala, Shield of Sea Gate', 'Explore', 'Shardless Agent', 'Tempest Djinn', 'Incinerate', 'Jwari Disruption', 'Desperate Ravings', 'Oath of Teferi', 'Spark Spray', 'Exclude', 'Darigaaz Reincarnated', 'Sosuke''s Summons', 'Khalni Heart Expedition', 'Mind''s Desire', 'Join the Dance', 'Brain Maggot', 'Far // Away', 'Michiko''s Reign of Truth', 'Unburial Rites', 'Gitaxian Probe', 'Liesa, Forgotten Archangel', 'Solitary Confinement', 'Merrow Reejerey', 'Mephidross Vampire', 'Mwonvuli Acid-Moss', 'Conclave Mentor', 'Grand Architect', 'Empyrial Archangel', 'Viscera Seer', 'Grumgully, the Generous', 'Dryad Militant', 'Cathar Commando', 'Yahenni''s Expertise', 'Spawning Pool', 'Ranger of Eos', 'Snow-Covered Plains', 'Upheaval', 'Gavony Township', 'Blazing Shoal', 'Undergrowth Champion', 'Feed the Swarm', 'Thornwood Falls', 'Lorescale Coatl', 'Secluded Steppe', 'Irencrag Pyromancer', 'Death Baron', 'Weathered Wayfarer', 'Coalition Relic', 'Jokulhaups', 'Wilt', 'Temple of Silence', 'Snow-Covered Forest', 'Woodfall Primus', 'Woodland Cemetery', 'Codex Shredder', 'Illuminator Virtuoso', 'Benevolent Bodyguard', 'Authority of the Consuls', 'Doom Foretold', 'Enduring Ideal', 'Jace, Memory Adept', 'Anointer Priest', 'Undead Butler', 'Razortide Bridge', 'Esper Charm', 'Rites of Initiation', 'Tectonic Reformation', 'Fabled Hero', 'Wayward Swordtooth', 'Flametongue Yearling', 'Sphinx of Uthuun', 'Hour of Promise', 'Fog', 'Coralhelm Commander', 'Blind Obedience', 'Crux of Fate', 'Disciple of the Vault', 'Kazandu Mammoth', 'Viashino Pyromancer', 'Training Grounds', 'Grasslands', 'Destiny Spinner', 'General Ferrous Rokiric', 'Gonti, Lord of Luxury', 'Foul Play', 'Voidslime', 'Chief Engineer', 'Irencrag Feat', 'Endbringer', 'Boros Reckoner', 'Riftwing Cloudskate', 'Treasure Cruise', 'Goblin Dark-Dwellers', 'Myr Battlesphere', 'Era of Enlightenment', 'Vivid Grove', 'Fact or Fiction', 'Putrid Imp', 'Servo Exhibition', 'Vampire Socialite', 'Shinka, the Bloodsoaked Keep', 'Frantic Search', 'Cleansing Nova', 'Qasali Pridemage', 'Goldmire Bridge', 'Asylum Visitor', 'Wrench Mind', 'Watcher for Tomorrow', 'Unsubstantiate', 'Sleight of Hand', 'Izzet Charm', 'Carven Caryatid', 'Sylvan Library', 'Valiant Rescuer', 'Mana Leak', 'Dire Tactics', 'Kopala, Warden of Waves', 'Rally the Ranks', 'Blacklance Paragon', 'Vivid Marsh', 'Cartel Aristocrat', 'Caves of Koilos', 'Dawn of Hope', 'Glory-Bound Initiate', 'Barbarian Ring', 'Hapatra, Vizier of Poisons', 'Kami of False Hope', 'Bastion of Remembrance', 'Mystifying Maze', 'Day of Judgment', 'Ethersworn Canonist', 'Rustvale Bridge', 'Quiet Speculation', 'Teardrop Kami', 'Kessig Flamebreather', 'Buried Alive', 'Render Silent', 'Coiling Oracle', 'Weaver of Harmony', 'Essence Flux', 'Fauna Shaman', 'Gather the Townsfolk', 'Winged Coatl', 'Fiend Hunter', 'Stirring Wildwood', 'Arrogant Wurm', 'Tome Scour', 'Vault Skirge', 'Lavinia of the Tenth', 'Hard Evidence', 'Mind Grind', 'Patchwork Automaton', 'Just the Wind', 'Think Twice', 'Maul of the Skyclaves', 'Rune-Scarred Demon', 'Evolving Wilds', 'Hagra Mauling', 'Oketra the True', 'Cabaretti Courtyard', 'Karn, Silver Golem', 'Fiery Temper', 'Tooth and Nail', 'Tyrant of Discord', 'Forbid', 'Thornglint Bridge', 'Vampire of the Dire Moon', 'Ransack the Lab', 'Underworld Connections', 'Magus of the Candelabra', 'Cloudshift', 'Go for the Throat', 'Hamlet Captain', 'Thought Scour', 'Char', 'Forgotten Cave', 'Dual Strike', 'Riddlesmith', 'Rampant Growth', 'Court Homunculus', 'Satyr Wayfinder', 'Bone Shards', 'Cleansing Wildfire', 'Tidal Warrior', 'Daxos of Meletis', 'Myth Realized', 'Rogue''s Passage', 'Elspeth''s Nightmare', 'Lava Dart', 'Fleecemane Lion', 'Dizzy Spell', 'Alms of the Vein', 'Glimmerpost', 'Burst Lightning', 'Knight of the Reliquary', 'Dream Salvage', 'Lavaclaw Reaches', 'Nezumi Shortfang', 'Autumn''s Veil', 'Lightning Strike', 'Shrapnel Blast', 'Traxos, Scourge of Kroog', 'Honored Hydra', 'Triskelion', 'Muddle the Mixture', 'Parallel Lives', 'Sanguine Statuette', 'Izzet Signet', 'Flash of Insight', 'Elite Guardmage', 'Acolyte of Affliction', 'Talisman of Impulse', 'Seething Song', 'Captivating Vampire', 'Tanglepool Bridge', 'Exhaustion', 'Memory Lapse', 'Tymaret, Chosen from Death', 'Defiant Strike', 'Slagwoods Bridge', 'Kyodai, Soul of Kamigawa', 'Firebolt', 'Mimic Vat', 'Fireblade Artist', 'Crackling Drake', 'Vampire Opportunist', 'Tangled Florahedron', 'Soul Snare', 'Catch // Release', 'Plague Stinger', 'Arcbound Worker', 'Doom Blade', 'Signal Pest', 'Vampire Lacerator', 'Bloodbraid Elf', 'Voltage Surge', 'Jace, the Living Guildpact', 'Castigate', 'Rishkar, Peema Renegade', 'Sejiri Refuge', 'Consuming Vapors', 'Out of Time', 'Yisan, the Wanderer Bard', 'Glorybringer', 'Discovery // Dispersal', 'Lightning Rift', 'Consuming Aberration', 'Nevermore', 'Snow-Covered Mountain', 'Blasphemous Act', 'Azorius Signet', 'Buried Ruin', 'Wily Goblin', 'Bloodline Keeper', 'Tide Shaper', 'Increasing Ambition', 'Opt', 'Murderous Redcap', 'Electrolyze', 'Timeless Witness', 'Ral, Storm Conduit', 'Conflagrate', 'Vicious Conquistador', 'Witching Well', 'Overwhelming Splendor', 'Mayor of Avabruck', 'Oviya Pashiri, Sage Lifecrafter', 'Flourishing Fox', 'Scrapheap Scrounger', 'Blazing Rootwalla', 'Borrowed Time', 'Mizzium Skin', 'Ravenous Rats', 'Perplex', 'Eternal Dragon', 'Piranha Marsh', 'Pestilent Haze', 'Drossforge Bridge', 'Faithful Mending', 'Shigeki, Jukai Visionary', 'Mistveil Plains', 'Intruder Alarm', 'Brokers Charm', 'Conqueror''s Galleon', 'Primal Command', 'Warstorm Surge', 'World Shaper', 'Invoke Calamity', 'Desperate Ritual', 'Squadron Hawk', 'Morselhoarder', 'Firespout', 'Mirran Spy', 'Rise and Shine', 'Platinum Angel', 'Temple of Epiphany', 'Graveyard Marshal', 'Luminarch Ascension', 'Essence Scatter', 'Blowfly Infestation', 'Skyclave Cleric', 'Nezahal, Primal Tide', 'Mystical Teachings', 'Blood Fountain', 'Zurgo Bellstriker', 'Olivia Voldaren', 'Skyclave Shade', 'Skybridge Towers', 'Battlefield Forge', 'Sylvan Advocate', 'Zenith Flare', 'Fading Hope', 'Pyroclasm', 'Seaside Citadel', 'Dream Twist', 'Benthic Biomancer', 'Golgari Rot Farm', 'Sandsteppe Citadel', 'Edric, Spymaster of Trest', 'Snowfield Sinkhole', 'Myr Retriever', 'Thawing Glaciers', 'Slip Out the Back', 'Ripjaw Raptor', 'Chandra, Pyromaster', 'Hotshot Mechanic', 'Resurgent Belief', 'Glacial Fortress', 'Ajani, Caller of the Pride', 'Commune with Spirits', 'Wall of Omens', 'Lose Focus', 'Decree of Justice', 'Chain Lightning', 'Goro-Goro, Disciple of Ryusei', 'Mobilized District', 'Garruk Wildspeaker', 'Everflowing Chalice', 'Student of Warfare', 'Darksteel Colossus', 'Fallen Shinobi', 'Ghitu Encampment', 'Stubborn Denial', 'Scrapyard Recombiner', 'Darkmoss Bridge', 'Control Magic', 'Harbinger of the Tides', 'Lead the Stampede', 'Cosima, God of the Voyage', 'Voldaren Epicure', 'Vapor Snag', 'The Birth of Meletis', 'Duskwatch Recruiter', 'Postmortem Lunge', 'Hour of Revelation', 'Hypergenesis', 'Pieces of the Puzzle', 'Thraben Inspector', 'Flood Plain', 'Dark Ritual', 'Dauntless Bodyguard', 'Liliana Vess', 'Judith, the Scourge Diva', 'Runed Halo', 'Mystic Snake', 'Malakir Rebirth', 'Temple of Enlightenment', 'Reveillark', 'Game Trail', 'Magister of Worth', 'Aetherspouts', 'Emeria Angel', 'Obscura Charm', 'Creeping Corrosion', 'Rise of the Hobgoblins', 'Invigorate', 'Grisly Salvage', 'Noose Constrictor', 'Bedevil', 'Search for Tomorrow', 'Orzhov Basilica', 'Kazandu Tuskcaller', 'Sticky Fingers', 'Pyretic Ritual', 'Blade Splicer', 'Esper Panorama', 'Yosei, the Morning Star', 'Erebos''s Intervention', 'Raven''s Crime', 'Angel of Despair', 'Masticore', 'Vengeful Pharaoh', 'Salvage Titan', 'Drannith Stinger', 'Basking Rootwalla', 'Gatekeeper of Malakir', 'Reaper King', 'Flame Slash', 'Night of Souls'' Betrayal'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 74.9, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (69.8 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Temple of Enlightenment', 'Tempered Steel', 'Obstinate Baloth', 'Beastcaller Savant', 'Benthic Biomancer', 'Seaside Citadel', 'Timeless Witness', 'Abiding Grace', 'Wizard''s Retort', 'Dread Fugue', 'Izzet Boilerworks', 'Evolving Wilds', 'Decree of Justice', 'Mina and Denn, Wildborn', 'Incinerate', 'Ghitu Lavarunner', 'Arcbound Mouser', 'Touch the Spirit Realm', 'Temple of Triumph', 'Vindicate', 'Runed Halo', 'Power Conduit', 'Judge''s Familiar', 'Rite of Replication', 'Tectonic Giant', 'Feed the Swarm', 'Birds of Paradise', 'Forbid', 'Fevered Visions', 'Sea Gate Loremaster', 'Acolyte of Affliction', 'Sacred Fire', 'Woodland Cemetery', 'Drossforge Bridge', 'Veteran Warleader', 'Mirrorpool', 'Stirring Wildwood', 'Oran-Rief Survivalist', 'Genesis Hydra', 'Tempered in Solitude', 'Boros Reckoner', 'Cleansing Wildfire', 'Falkenrath Pit Fighter', 'Repeal', 'Ranger of Eos', 'Azorius Charm', 'Animation Module', 'Brine Elemental', 'Caves of Koilos', 'Flame Rift', 'Oracle of Mul Daya', 'Ponder', 'Muddle the Mixture', 'Heartless Act', 'Grim Lavamancer', 'Tymaret, Chosen from Death', 'Condemn', 'Proclamation of Rebirth', 'Sandsteppe Citadel', 'Littjara Mirrorlake', 'Dictate of Kruphix', 'Sprite Dragon', 'Mask of the Mimic', 'Westvale Abbey', 'Cabal Therapist', 'Commune with the Gods', 'Arcbound Worker', 'Needle Spires', 'Cryptic Caves', 'Mishra''s Factory', 'Bloodbraid Elf', 'Jwari Shapeshifter', 'Dread Return', 'Hornet Queen', 'Patchwork Automaton', 'Quasiduplicate', 'Aetherspouts', 'Thirst for Discovery', 'Biovisionary', 'Forgotten Cave', 'Improbable Alliance', 'Zabaz, the Glimmerwasp', 'Swiftwater Cliffs', 'Field of Ruin', 'Cathar Commando', 'Secluded Steppe', 'Gitaxian Probe', 'Spell Pierce', 'Izzet Charm', 'Ob Nixilis, the Fallen', 'Think Twice', 'Darkmoss Bridge', 'Wrath of God', 'Frantic Search', 'Triskaidekaphile', 'Glen Elendra Archmage', 'Treasure Cruise', 'Ghost Quarter', 'Unburial Rites', 'Snowfield Sinkhole', 'Riveteers Charm', 'Shard Volley', 'Clifftop Retreat', 'Dark Ritual', 'Signal Pest', 'Sylvan Library', 'Hard Evidence', 'Squadron Hawk', 'Martyr of Sands', 'Fire Covenant', 'Verdurous Gearhulk', 'Thraben Inspector', 'Hada Freeblade', 'Tireless Provisioner', 'Woodfall Primus', 'Detention Sphere', 'Ramunap Excavator', 'Lonely Sandbar', 'Kumano Faces Kakkazan', 'The Raven''s Warning', 'Augmenter Pugilist', 'Dawn of Hope', 'Temple of Epiphany', 'Vesuvan Shapeshifter', 'Magister of Worth', 'Vampire Nighthawk', 'Bloodchief''s Thirst', 'Burst Lightning', 'Delver of Secrets', 'Nearheath Pilgrim', 'Thought Scour', 'Lashwrithe', 'Hymn to Tourach', 'Lose Focus', 'Rite of Oblivion', 'Spikefield Hazard', 'Rally the Ancestors', 'Scab-Clan Berserker', 'Undead Butler', 'Temple of Silence', 'Gatekeeper of Malakir', 'Croaking Counterpart', 'Angel of Despair', 'Crackling Drake', 'Arcbound Javelineer', 'Chain Lightning', 'Midnight Clock', 'Snow-Covered Plains', 'Mistveil Plains', 'Bone Shards', 'Satyr Wayfinder', 'Temple of Mystery', 'Cackling Counterpart', 'Grisly Salvage', 'Ash Zealot', 'Halimar Excavator', 'Martyr of Frost', 'Justice Strike', 'Volcano Hellion', 'Memory Lapse', 'Sky Hussar', 'Llanowar Mentor', 'Sign in Blood', 'Opt', 'Hinterland Harbor', 'Animate Dead', 'Lead the Stampede', 'Skyclave Cleric', 'Harabaz Druid', 'Voidmage Prodigy', 'Ally Encampment', 'Verdant Command', 'Lightning Strike', 'Stromkirk Noble', 'Harmonize', 'Ondu Cleric', 'Arcane Sanctum', 'Dread Presence', 'Silundi Vision', 'Glacial Fortress', 'Vedalken Shackles', 'Michiko''s Reign of Truth', 'Truth or Tale', 'Arcbound Ravager', 'Kami of False Hope', 'Training Grounds', 'Wooded Bastion', 'Cathartic Pyre', 'Heartless Summoning', 'Battlefield Forge', 'Fading Hope', 'Fact or Fiction', 'Dream Trawler', 'Sylvan Primordial', 'Cursecatcher', 'Behold the Multiverse', 'Lazotep Plating', 'Mana Leak', 'Truefire Captain', 'Akroma''s Memorial'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 69.8, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (61.7 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Quicken', 'Goblin Arsonist', 'Curse of Exhaustion', 'Demonic Embrace', 'Wall of Omens', 'Rend Flesh', 'Earthshaker Khenra', 'Terramorphic Expanse', 'Izoni, Thousand-Eyed', 'Ivy Lane Denizen', 'Exhaustion', 'Prophetic Prism', 'Rise of the Hobgoblins', 'Wight', 'Sorcerer Class', 'Sylvan Library', 'Quest for Pure Flame', 'Mobilized District', 'Orim''s Chant', 'Alchemist''s Vial', 'Reality Ripple', 'Fireblade Charger', 'Warleader''s Helix', 'Abzan Charm', 'Seaside Citadel', 'Graveyard Marshal', 'Daxos of Meletis', 'Dragonskull Summit', 'Dark Ritual', 'Polymorph', 'Champion of Dusk', 'Flourishing Fox', 'Burn Bright', 'Falkenrath Pit Fighter', 'Thirst for Meaning', 'Sire of Insanity', 'Vivid Creek', 'Retreat to Hagra', 'General Ferrous Rokiric', 'Shatter the Sky', 'Angel''s Grace', 'Jace, Memory Adept', 'Elvish Visionary', 'Hymn to Tourach', 'Orgg', 'Kazandu Blademaster', 'Goblin King', 'Skybridge Towers', 'Revitalize', 'Oni-Cult Anvil', 'Proteus Staff', 'Putrid Goblin', 'Manabarbs', 'It That Betrays', 'Filigree Angel', 'Angel of Sanctions', 'Stony Strength', 'Cleansing Wildfire', 'Traxos, Scourge of Kroog', 'Vampire Opportunist', 'Shardless Agent', 'Voltage Surge', 'Desolate Lighthouse', 'Dire Tactics', 'Ancient Stirrings', 'Myojin of Life''s Web', 'Shard Volley', 'Specter''s Shroud', 'Bala Ged Recovery', 'Dead Weight', 'Rakdos Charm', 'Arcane Sanctum', 'Hushwing Gryff', 'Burst Lightning', 'Obliterate', 'Temple of Abandon', 'Valiant Rescuer', 'Kaya, Ghost Assassin', 'The Birth of Meletis', 'Crackling Drake', 'Moment of Craving', 'Hero of Precinct One', 'Hunted Nightmare', 'Diregraf Ghoul', 'Wonder', 'Darkmoss Bridge', 'Etherium Sculptor', 'Midnight Clock', 'Shriekmaw', 'Wooded Bastion', 'Debtors'' Knell', 'Thundering Raiju', 'Bloodline Keeper', 'Midnight Reaper', 'Goblin Dark-Dwellers', 'Crystallization', 'Sterling Grove', 'Ranger''s Guile', 'Brain Freeze', 'Cartel Aristocrat', 'Piranha Marsh', 'Barren Moor', 'Verdant Command', 'Tectonic Reformation', 'Rule of Law', 'Talisman of Resilience', 'Drossforge Bridge', 'Boomerang', 'Ritual of Soot', 'Nomad Outpost', 'Linvala, the Preserver', 'Mirrorshell Crab', 'Horde of Notions', 'Scrapheap Scrounger', 'Gavony Township', 'Tendrils of Agony', 'Fblthp, the Lost', 'Teferi, Mage of Zhalfir', 'Chromatic Lantern', 'Dryad''s Revival', 'Ghost Quarter', 'Possibility Storm', 'Hornet Queen', 'Erebos''s Intervention', 'Timeless Witness', 'Asceticism', 'Obstinate Baloth', 'Madcap Skills', 'Champion of the Parish', 'Rabbit Battery', 'Retraction Helix', 'Fertile Ground', 'Force of Rage', 'Magmatic Sinkhole', 'Prey''s Vengeance', 'Semblance Anvil', 'Dripping-Tongue Zubera', 'Dead // Gone', 'Lumbering Falls', 'Stromkirk Noble', 'Augur of Bolas', 'Circle of Confinement', 'Tempered Steel', 'Lashwrithe', 'Tendo Ice Bridge', 'Rebuild', 'Dramatic Finale', 'Swallow Whole', 'Foreboding Ruins', 'Stormchaser Drake', 'Cultivate', 'Tanglepool Bridge', 'Momentary Blink', 'Izzet Signet', 'Cruel Reality', 'Blasphemous Act', 'Jalira, Master Polymorphist', 'Search for Tomorrow', 'Nyxathid', 'Saw It Coming', 'Nevermore', 'Ponder', 'Cloudpost', 'Omen of the Forge', 'Security Bypass', 'Animist''s Awakening', 'Prognostic Sphinx', 'Grapeshot', 'Sandsteppe Citadel', 'Greater Gargadon', 'Fabricate', 'Zealous Persecution', 'Zenith Flare', 'Nevermaker', 'Generous Visitor', 'Kjeldoran Outpost', 'Dimir Charm', 'Lantern of the Lost', 'Mizzium Skin', 'Tyrant''s Scorn', 'Elvish Piper', 'Lead the Stampede', 'Diregraf Colossus', 'Dakmor Salvage', 'Join the Dance', 'Platinum Angel', 'Hard Evidence', 'Hada Freeblade', 'Goblin Bombardment', 'Jungle Shrine', 'Gateway Plaza', 'Blade Splicer', 'Soulflayer', 'Mogg War Marshal', 'Glimmer Bairn', 'Stasis Snare', 'Kazandu Mammoth', 'Ghitu Encampment', 'Safewright Quest', 'Nested Shambler', 'Incinerate', 'Genesis Hydra', 'Vision Skeins', 'Mistvein Borderpost', 'Dimir Signet', 'Kami''s Flare', 'Fireball', 'Genesis Wave', 'Ornithopter of Paradise', 'Prahv, Spires of Order', 'Overwhelming Splendor', 'Teachings of the Kirin', 'Metalwork Colossus', 'Paralyze', 'Cosmos Elixir', 'Decree of Justice', 'Raze the Effigy', 'Ghirapur Aether Grid', 'Tymaret, Chosen from Death', 'Spectra Ward', 'Flame Slash', 'Sleight of Hand', 'Argent Sphinx', 'Call of the Herd', 'Myr Incubator', 'Suture Priest', 'Feed the Swarm', 'Mirror Entity', 'Torment of Scarabs', 'Vindicate', 'Disciple of Bolas', 'Hydra Broodmaster', 'Touch the Spirit Realm', 'Slagwoods Bridge', 'Curse of Misfortunes', 'Homestead Courage', 'Lavinia of the Tenth', 'Retreat to Kazandu', 'That Which Was Taken', 'Mystical Teachings', 'Clattering Augur', 'Otherworldly Gaze', 'The Raven''s Warning', 'Vampire Nighthawk', 'Sylvan Primordial', 'Dawn of Hope', 'Plea for Guidance', 'Dread', 'Din of the Fireherd', 'Worst Fears', 'Flame Rift', 'Metallic Rebuke', 'Wandering Mind', 'Death Baron', 'Talisman of Unity', 'Curse of the Pierced Heart', 'Buried Ruin', 'Storm Herald', 'Shredded Sails', 'Grimdancer', 'Magister of Worth', 'Flame-Blessed Bolt', 'Iname, Death Aspect', 'Calciform Pools', 'Liliana''s Specter', 'Eldrazi Conscription', 'Slumbering Tora', 'Prowling Serpopard', 'Inevitable Betrayal', 'Pack Rat', 'Pooling Venom', 'Carnophage', 'Mire''s Grasp', 'Trostani''s Summoner', 'Chasm Skulker', 'Arc-Slogger', 'Faerie Miscreant', 'Weathered Wayfarer', 'Snow-Covered Forest', 'Forbidden Alchemy', 'Kuldotha Forgemaster', 'Sigil Blessing', 'Blood Fountain', 'Maul of the Skyclaves', 'Lost Legacy', 'Evolving Wilds', 'Jwari Disruption', 'Dusk Legion Zealot', 'Behold the Multiverse', 'Boros Reckoner', 'Invisible Stalker', 'Insolent Neonate', 'Irencrag Pyromancer', 'Into the Roil', 'Force of Nature', 'Crumbling Necropolis', 'Magister Sphinx', 'Rise and Shine', 'Bile Blight', 'Secluded Steppe', 'Grand Arbiter Augustin IV', 'Mistveil Plains', 'Eye of Nowhere', 'Jolrael, Mwonvuli Recluse', 'Fiend Hunter', 'Erdwal Illuminator', 'Mirrodin''s Core', 'Outland Liberator', 'Caravan Vigil', 'Caves of Koilos', 'Devious Cover-Up', 'Kabira Evangel', 'Duress', 'Approach of the Second Sun', 'Tamiyo''s Safekeeping', 'Lazotep Plating', 'Mesmeric Fiend', 'Gideon''s Intervention', 'Bone Shards', 'Lifespinner', 'Fact or Fiction', 'Arbor Elf', 'Ash Zealot', 'Mistvault Bridge', 'Conflagrate', 'Bloodchief''s Thirst', 'Nissa, Worldwaker', 'Dread Fugue', 'Liege of the Tangle', 'Breya''s Apprentice', 'Dreadhorde Invasion', 'Herbal Poultice', 'Darksteel Colossus', 'Season of Growth', 'Labyrinth of Skophos', 'Liliana Vess', 'Watcher for Tomorrow', 'Logic Knot', 'Gideon Jura', 'Power Sink', 'Arcbound Ravager', 'Dennick, Pious Apprentice', 'Dovescape', 'Cemetery Reaper', 'Vivid Crag', 'Slagstorm', 'Consume the Meek', 'Reckoner''s Bargain', 'Warriors'' Lesson', 'Oblivion Ring', 'Gilded Lotus', 'Cursecatcher', 'Permeating Mass', 'Glimmerpost', 'Myr Battlesphere', 'Llanowar Wastes', 'Commune with the Gods', 'Niveous Wisps', 'Queza, Augur of Agonies', 'Burning of Xinye', 'Dictate of Kruphix', 'Infinite Obliteration', 'White Sun''s Zenith', 'Whip of Erebos', 'Izzet Boilerworks', 'Iname, Life Aspect', 'Veteran Warleader', 'Thraben Inspector', 'Grisly Salvage', 'Savra, Queen of the Golgari', 'Den Protector', 'Izzet Charm', 'Wildfield Borderpost', 'Thassa''s Intervention', 'Shrapnel Blast', 'Uncharted Haven', 'Biting-Palm Ninja', 'Gigadrowse', 'Abrade', 'Foundry Street Denizen', 'Garruk Wildspeaker', 'Arrogant Bloodlord', 'Falkenrath Gorger', 'Slitherhead', 'Bogardan Hellkite', 'Captivating Vampire', 'Radiant Flames', 'Disenchant', 'Dire-Strain Rampage', 'Dovin Baan', 'Obsessive Search', 'Woodland Champion', 'Cloudblazer', 'Outnumber', 'Skyclave Cleric', 'Goblin Shrine', 'Circular Logic', 'Hurricane', 'Elemental Bond', 'Korlash, Heir to Blackblade', 'Diabolic Edict', 'Graf Mole', 'Castigate', 'Snow-Covered Plains', 'Coastal Tower', 'Unburial Rites', 'Barbarian Ring', 'Warstorm Surge', 'Kin-Tree Invocation', 'Myojin of Infinite Rage', 'Glen Elendra Archmage', 'Concerted Defense', 'Eldrazi Mimic', 'Guild Globe', 'Revoke Existence', 'Gray Merchant of Asphodel', 'Wrench Mind', 'Pyretic Ritual', 'Sunblade Samurai', 'Gruul Signet', 'Laboratory Maniac', 'Tatsunari, Toad Rider', 'Tormenting Voice', 'Meteor Golem', 'Glacial Fortress', 'Vampire Lacerator', 'Demigod of Revenge', 'Geomancer''s Gambit', 'Solitary Confinement', 'Primal Command', 'Acolyte of Affliction', 'Assault Strobe', 'Furyblade Vampire', 'Court Homunculus', 'Form of the Dragon', 'Cosima, God of the Voyage', 'Fling', 'Mana Leak', 'Martyr of Sands', 'Forbid', 'Epochrasite', 'Frontier Bivouac', 'Ground Rift', 'Colossification', 'Cabal Stronghold', 'Failure // Comply', 'Forsake the Worldly', 'Tolsimir Wolfblood', 'Temple of Enlightenment', 'Vapor Snag', 'Infuriate', 'Judith, the Scourge Diva', 'Expedition Envoy', 'Dual Strike', 'Kessig Wolf Run', 'Sanguine Sacrament', 'Shock', 'Mind''s Desire', 'Drannith Stinger', 'Sokenzan Smelter', 'Cathar Commando', 'Esper Charm', 'Drowned Catacomb', 'Aphemia, the Cacophony', 'Figure of Destiny', 'Discovery // Dispersal', 'Llanowar Elves', 'Sram''s Expertise', 'Skeletal Swarming', 'Hissing Quagmire', 'Satyr Wayfinder', 'Faerie Vandal', 'Temple of Malady', 'Nivmagus Elemental', 'Abiding Grace', 'Battle of Wits', 'The Underworld Cookbook', 'High-Speed Hoverbike', 'Gaea''s Revenge', 'Ondu Inversion', 'Fanatical Firebrand', 'Mystic Monastery', 'Rishkar, Peema Renegade', 'Lonis, Cryptozoologist', 'Relentless Rats', 'Trespasser''s Curse', 'Skylasher', 'Blackmail', 'Valorous Stance', 'Champion of Wits', 'First-Sphere Gargantua', 'Scurry Oak', 'Kami of False Hope', 'Canyon Slough', 'Raven''s Crime', 'Desecration Demon', 'Lay of the Land', 'Barrenton Medic', 'Raging Ravine', 'Pirate''s Pillage', 'Seething Song', 'Memnarch', 'Make Disappear', 'Skirge Familiar', 'Astral Drift', 'Trace of Abundance', 'Dragon Mantle', 'Michiko''s Reign of Truth', 'Fae Offering', 'Sejiri Shelter', 'Regrowth', 'Ensoul Artifact', 'Experimental Overload', 'Condemn', 'Dragonstorm', 'Piper of the Swarm', 'Blossoming Calm', 'Vivien''s Arkbow', 'Lightning Rift', 'Ransack the Lab', 'Hypergenesis', 'Improbable Alliance', 'Dryad Militant', 'Day of Judgment', 'Blazing Specter', 'Raise the Alarm', 'Dragonspark Reactor', 'Negate', 'Signal Pest', 'Clifftop Retreat', 'Chandra Ablaze', 'Woodfall Primus', 'Porphyry Nodes', 'Heartless Act', 'Nature''s Lore', 'Woodland Cemetery', 'Servo Exhibition', 'Boonweaver Giant', 'Ancestral Anger', 'Desperate Ritual', 'Solfatara', 'Mouth // Feed', 'Deep Analysis', 'Curse of Death''s Hold', 'Birds of Paradise', 'Dread Return', 'Kirtar''s Desire', 'Lose Focus', 'Silundi Vision', 'Ally Encampment', 'Spellweaver Helix', 'Temple of Epiphany', 'Tocatli Honor Guard', 'Double Vision', 'Chain Lightning', 'Reinforced Ronin', 'Pelakka Predation', 'Experimental Frenzy', 'Irencrag Feat', 'Vivid Marsh', 'Ethersworn Sphinx', 'Endless Horizons', 'Zur''s Weirding', 'Cabal Therapist', 'Bedevil', 'Oust', 'Declaration in Stone', 'Seeker of the Way', 'Mogg Flunkies', 'Quicksilver Gargantuan', 'Jhoira, Weatherlight Captain', 'Spawning Pool', 'Ral Zarek', 'Viscera Seer', 'Demonic Dread', 'Weaselback Redcap', 'Goblin Chieftain', 'Oversoul of Dusk', 'Vampiric Fury', 'Barrin, Tolarian Archmage', 'Oath of Gideon', 'Talisman of Conviction', 'Kitchen Imp', 'Torrent Sculptor', 'Palace Siege', 'Gather the Townsfolk', 'Nezahal, Primal Tide', 'Morselhoarder', 'Ornithopter', 'Sphere of Safety', 'Hypnotic Specter', 'Infernal Grasp', 'Vault of the Archangel', 'Searing Spear', 'Big Score', 'Goblin War Paint', 'Primal Amulet', 'Azor''s Gateway', 'Orzhov Signet', 'Blazing Rootwalla', 'Salvage Titan', 'Temple of Mystery', 'Blessed Alliance', 'Dreg Mangler', 'Early Frost', 'Gargoyle Castle', 'Azorius Charm', 'Universal Automaton', 'Harmonize', 'Blue Sun''s Zenith', 'Odds // Ends', 'Bad River', 'Asylum Visitor', 'Detention Sphere', 'Harabaz Druid', 'Barbed Sextant', 'Yarok''s Fenlurker', 'Hinterland Harbor', 'Temple of Silence', 'Tomb of Urami', 'Costly Plunder', 'Overwhelming Denial', 'Yahenni''s Expertise', 'Buried Alive', 'Reassembling Skeleton', 'Lathliss, Dragon Queen', 'Worldgorger Dragon', 'Drift of Phantasms', 'Think Twice', 'Ral, Storm Conduit', 'Faithful Mending', 'Conclave Tribunal', 'Muddle the Mixture', 'Needle Spires', 'Vivid Grove', 'Counterflux', 'Electrolyze', 'Evangel of Heliod', 'Sylvan Anthem', 'Quarantine Field', 'Reap the Past', 'Undead Butler', 'Hateful Eidolon', 'Ignite Memories', 'Field of Ruin', 'Go for Blood', 'Mystic Snake', 'Sylvan Advocate', 'Thirst for Discovery', 'Chandra, Fire Artisan', 'Firespout', 'Invoke Calamity', 'Varragoth, Bloodsky Sire', 'Temple of Malice', 'Swiftwater Cliffs', 'Tectonic Giant', 'Elvish Mystic', 'Mist-Syndicate Naga', 'Howltooth Hollow', 'Phyrexian Revoker', 'Mentor of the Meek', 'Fatestitcher', 'Vivid Meadow', 'Thought Scour', 'Altar''s Reap', 'Spark Spray', 'Akroma, Angel of Fury', 'Lich''s Mastery', 'Falkenrath Forebear', 'Veinfire Borderpost', 'Scab-Clan Berserker', 'Secluded Glen', 'Master of Death', 'Reverent Hoplite', 'Irregular Cohort', 'Purphoros''s Intervention', 'Gatekeeper of Malakir', 'Prophetic Bolt', 'Essence Flux', 'Jace Beleren', 'Lochmere Serpent', 'Maestros Charm', 'Ajani, Caller of the Pride', 'Rotten Reunion', 'Dimir Aqueduct', 'Elvish Clancaller', 'Expansion // Explosion', 'Gitaxian Probe', 'Sacred Fire', 'Cleansing Nova', 'Goblin Wardriver', 'Brokers Hideout', 'Thaumatic Compass', 'Mikokoro, Center of the Sea', 'Fauna Shaman', 'Phyrexian Dreadnought', 'Incubation Druid', 'Out of Time', 'Summer Bloom', 'Cursed Totem', 'Impostor of the Sixth Pride', 'Necrotic Ooze', 'Grim Lavamancer', 'Tombstalker', 'Cruel Ultimatum', 'Commit // Memory', 'Eternal Dragon', 'Judge''s Familiar', 'Sorin Markov', 'Spikefield Hazard', 'Fire Covenant', 'Oyobi, Who Split the Heavens', 'Staggering Insight', 'Mind Rake', 'Tempest Djinn', 'Gone Missing', 'Frantic Search', 'Jeskai Ascendancy', 'Colossal Skyturtle', 'Spear of Heliod', 'Inscription of Ruin', 'Ghitu Lavarunner', 'Vedalken Shackles', 'Living Lore', 'Radiant Fountain', 'Wilt-Leaf Liege', 'Strike It Rich', 'Karn''s Temporal Sundering', 'Molten Slagheap', 'Viashino Pyromancer', 'Jwari Shapeshifter', 'Ram Through', 'Ranger of Eos', 'See the Truth', 'Fading Hope', 'Sign in Blood', 'Patchwork Automaton', 'Axgard Armory', 'Powerstone Shard', 'Kambal, Consul of Allocation', 'Walk the Aeons', 'Psychatog', 'Resurgent Belief', 'Boros Signet', 'Ingenious Infiltrator', 'Hotshot Mechanic', 'Intangible Virtue', 'Temple of Triumph', 'Arch of Orazca', 'Bygone Bishop', 'Fusion Elemental', 'Moss-Pit Skeleton', 'Rustvale Bridge', 'Icehide Golem', 'Steel Overseer', 'Ondu Cleric', 'Explore', 'Contaminated Ground', 'Soulherder', 'Beastcaller Savant', 'Sanguine Statuette', 'Razortide Bridge', 'Dream Trawler', 'Kabira Takedown', 'Repeal', 'Lodestone Golem', 'Altar of the Brood', 'Unsubstantiate', 'Nullpriest of Oblivion', 'Sandwurm Convergence', 'Snowfield Sinkhole', 'Fieldmist Borderpost', 'Ghostly Flicker', 'Hive Mind', 'Coalition Relic', 'Halimar Excavator', 'Secluded Courtyard', 'Ulvenwald Mysteries', 'Vampire''s Kiss', 'Vigor', 'Drannith Healer', 'Riptide Laboratory', 'Coiling Oracle', 'Forgotten Cave', 'Sarcomancy', 'Lupine Prototype', 'Game Trail', 'Thrumming Stone', 'Delver of Secrets', 'Incandescent Aria', 'Lena, Selfless Champion', 'Cathartic Pyre', 'Sprite Dragon', 'Timely Reinforcements', 'Quirion Dryad', 'Gaea''s Will', 'Hythonia the Cruel', 'Tidespout Tyrant', 'Flame-Kin Zealot', 'Temple of Plenty', 'Egon, God of Death', 'Squadron Hawk', 'Moon-Circuit Hacker', 'Goblin Electromancer', 'Consuming Vapors', 'Smallpox', 'Saproling Migration', 'Growth-Chamber Guardian', 'Underworld Dreams', 'Howling Mine', 'Myth Realized', 'Ilysian Caryatid', 'Pyromancer''s Swath', 'Firewild Borderpost', 'Krenko''s Command', 'Ravenous Chupacabra', 'Mistmeadow Witch', 'Intervention Pact', 'Treasure Cruise', 'Arguel''s Blood Fast', 'Warped Landscape', 'Goldmire Bridge', 'Stubborn Denial', 'Murmuring Mystic', 'Runed Halo', 'Dragonsguard Elite', 'Maestros Theater', 'Silverbluff Bridge', 'Rally the Ancestors', 'Experimental Synthesizer', 'Urza''s Ruinous Blast', 'Illuminator Virtuoso', 'Deliberate', 'Chandra, Pyromaster', 'Briarbridge Patrol', 'Animate Dead', 'Shivan Dragon', 'Arcanis the Omnipotent', 'Blackbloom Rogue', 'Moonhold', 'Cathartic Reunion', 'Expedite', 'Jhoira''s Familiar', 'Artful Dodge', 'Opt', 'Lord of the Undead', 'Mishra''s Factory', 'Spinerock Knoll', 'He Who Hungers', 'Tymaret Calls the Dead', 'Proclamation of Rebirth', 'Primal Surge', 'Mizzium Mortars', 'Conclave Mentor', 'Spell Pierce', 'Angel of Despair', 'Vault Skirge', 'Obscura Storefront', 'Curse of Thirst', 'Rift Sower', 'Auratouched Mage', 'Prophet of Kruphix', 'Terrarion', 'Niambi, Esteemed Speaker', 'Enduring Ideal', 'Zhalfirin Void', 'Hagra Mauling', 'Crystal Shard', 'Asmodeus the Archfiend', 'Ethersworn Canonist', 'Falkenrath Aristocrat', 'Kumano Faces Kakkazan', 'Angel of Glory''s Rise', 'Tolsimir, Friend to Wolves', 'Sol Talisman', 'Restoration Angel', 'Skyclave Shade', 'Loxodon Smiter', 'Rootbound Crag', 'Wavesifter', 'Memory Lapse', 'Satyr Hoplite', 'Keruga, the Macrosage', 'Wingcrafter', 'Akroma''s Memorial', 'Sejiri Refuge', 'Slip Out the Back', 'Nylea''s Presence', 'Atris, Oracle of Half-Truths', 'Sylvan Awakening', 'Galvanic Relay', 'Elixir of Immortality', 'Terminus', 'Gloomshrieker', 'Rite of Oblivion', 'Blacklance Paragon', 'Slaughter Pact', 'Tidehollow Strix', 'Selesnya Sanctuary', 'Archway Commons', 'Genesis', 'Stirring Wildwood', 'Yosei, the Morning Star', 'Golgari Rot Farm', 'Fiery Temper', 'Skymarcher Aspirant', 'Glass Casket', 'Gossamer Chains', 'Abundant Harvest', 'Eiganjo Uprising', 'Voldaren Epicure', 'Jokulhaups', 'Wrath of God', 'Thawing Glaciers', 'Mire Triton', 'Temple of Deceit', 'Bloodbraid Elf', 'Knight of the White Orchid', 'Urza''s Factory', 'Regal Force', 'Lightning Strike', 'Oracle of Mul Daya', 'Disciple of the Vault', 'Steel Sabotage', 'Into the Story', 'Kaleidoscorch', 'Spirited Companion', 'Elderfang Ritualist', 'Josu Vess, Lich Knight', 'Lavaclaw Reaches', 'Mangara of Corondor', 'Lava Dart', 'Mana Flare', 'Persistent Specimen', 'Jace, the Living Guildpact', 'Mirrorpool', 'Wirewood Herald', 'Battlefield Forge', 'Riftwing Cloudskate', 'Future Sight', 'Earthquake', 'Eidolon of Countless Battles', 'Fire-Lit Thicket', 'Mistcutter Hydra', 'Restore Balance', 'Sky Hussar', 'Shrine of Burning Rage', 'Maelstrom Nexus', 'Weaver of Harmony', 'Demon Bolt'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 61.7, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (71.4 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Slumbering Tora', 'Flame-Kin Zealot', 'Double Vision', 'Runed Halo', 'Merfolk Looter', 'Tombstalker', 'Infernal Grasp', 'Cultivate', 'Ugin''s Conjurant', 'Abrade', 'Flame Rift', 'Homestead Courage', 'Selesnya Sanctuary', 'Bile Blight', 'Cathar Commando', 'Hive Mind', 'Skylasher', 'Akoum Battlesinger', 'Commune with the Gods', 'Alchemist''s Refuge', 'Gigadrowse', 'Novice Occultist', 'Ajani''s Presence', 'Stern Dismissal', 'Thirst for Discovery', 'Goblin Dark-Dwellers', 'Drossforge Bridge', 'Cloud Key', 'Skyclave Cleric', 'Calciform Pools', 'Batterbone', 'Pyromancer''s Swath', 'Dead Weight', 'Dreg Mangler', 'Chandra Ablaze', 'Artful Dodge', 'Ornithopter', 'Vivid Marsh', 'Kor Duelist', 'Golgari Rot Farm', 'Behold the Multiverse', 'The Raven''s Warning', 'Arrogant Bloodlord', 'Asceticism', 'Mistvein Borderpost', 'Wild Mongrel', 'Damping Engine', 'Battlefield Forge', 'Bloodline Keeper', 'Tyrant of Discord', 'Warleader''s Helix', 'Overwhelming Denial', 'Devouring Light', 'Mirrodin''s Core', 'Jwari Shapeshifter', 'Viscera Seer', 'Vampire Socialite', 'Field of Ruin', 'Azorius Guildgate', 'Greater Gargadon', 'Din of the Fireherd', 'Powerstone Shard', 'Memorial to War', 'Barbed Sextant', 'Vampire''s Kiss', 'Dragonlord''s Servant', 'Liliana''s Specter', 'Momentary Blink', 'Lux Cannon', 'Wayward Swordtooth', 'Shrapnel Blast', 'Power Conduit', 'Skyclave Shade', 'Maul of the Skyclaves', 'Shaman en-Kor', 'Condemn', 'Teachings of the Kirin', 'Repeal', 'Hinterland Harbor', 'Kambal, Consul of Allocation', 'Firewild Borderpost', 'Axgard Armory', 'Ichorclaw Myr', 'Keruga, the Macrosage', 'Thraben Inspector', 'Den Protector', 'Distended Mindbender', 'Queza, Augur of Agonies', 'Mirror Entity', 'That Which Was Taken', 'Bala Ged Recovery', 'Arcbound Ravager', 'Cursecatcher', 'Obscura Storefront', 'Massive Might', 'Thunderbreak Regent', 'Darksteel Colossus', 'Kirtar''s Desire', 'Barren Moor', 'Bloodtithe Harvester', 'Blacklance Paragon', 'Demigod of Revenge', 'Lightning Strike', 'Orgg', 'Raze the Effigy', 'Aphemia, the Cacophony', 'Diabolic Revelation', 'Electrolyze', 'Figure of Destiny', 'Abiding Grace', 'Chamber of Manipulation', 'Vivid Meadow', 'Fiery Temper', 'Triskelion', 'Tolsimir Wolfblood', 'Silverbluff Bridge', 'Izzet Signet', 'Eldrazi Mimic', 'Altar of the Brood', 'Rootbound Crag', 'Secluded Glen', 'Mindlink Mech', 'Nullpriest of Oblivion', 'Sorcerer Class', 'Auratouched Mage', 'Sanguine Sacrament', 'Maelstrom Nexus', 'Tidespout Tyrant', 'Summer Bloom', 'Lantern of the Lost', 'Battlefield Thaumaturge', 'Armament Master', 'Metalwork Colossus', 'Revoke Existence', 'Wavesifter', 'Mindslaver', 'Dimir Aqueduct', 'Warstorm Surge', 'Endless One', 'Seize the Storm', 'Obsessive Search', 'Pollywog Symbiote', 'Buried Alive', 'Kami''s Flare', 'Woodfall Primus', 'Vision Skeins', 'Butcher Ghoul', 'Chasm Skulker', 'Terastodon', 'Acidic Slime', 'Boon of Safety', 'Migratory Greathorn', 'Orim''s Chant', 'Noose Constrictor', 'Bogardan Hellkite', 'Stirring Wildwood', 'Experimental Synthesizer', 'Wonder', 'Slagwoods Bridge', 'Manabarbs', 'Clifftop Retreat', 'Soulflayer', 'Fae Offering', 'Umara Raptor', 'Rakdos Signet', 'Renegade Map', 'Claws of Gix', 'Reckless Fireweaver', 'Shrieking Affliction', 'Myth Realized', 'Bad River', 'Reckoner''s Bargain', 'Invoke Calamity', 'Riddlesmith', 'Tooth and Nail', 'Adventuring Gear', 'Blazing Specter', 'Blighted Agent', 'Cathartic Pyre', 'Faerie Vandal', 'Orcish Lumberjack', 'Endbringer', 'Rishadan Dockhand', 'Orb of Dragonkind', 'Lupine Prototype', 'The Modern Age', 'Desecration Demon', 'Persistent Specimen', 'Sylvan Ranger', 'Myr Battlesphere', 'Shard Volley', 'Prophetic Bolt', 'Sandwurm Convergence', 'Lost Legacy', 'Firemantle Mage', 'Torrent Sculptor', 'Worst Fears', 'Sunblade Samurai', 'Shriekmaw', 'Vault Skirge', 'Vampire Envoy', 'Vapor Snag', 'Planar Bridge', 'Karn''s Bastion', 'Flame Slash', 'Defy Gravity', 'Sungold Sentinel', 'Sylvan Anthem', 'Fading Hope', 'Ancient Grudge', 'Vedalken Shackles', 'Ally Encampment', 'Dread', 'Oversoul of Dusk', 'Nightveil Specter', 'Devious Cover-Up', 'Flame-Blessed Bolt', 'Skyship Stalker', 'Honored Hydra', 'Slip Out the Back', 'Urza''s Ruinous Blast', 'Silvergill Adept', 'Mind''s Desire', 'Scab-Clan Berserker', 'Rise of the Hobgoblins', 'Footfall Crater', 'Sejiri Shelter', 'Curse of Exhaustion', 'Tanglepool Bridge', 'Contagion Clasp', 'Obstinate Baloth', 'Kessig Flamebreather', 'Mizzium Skin', 'Stromkirk Noble', 'Hissing Quagmire', 'Glimmer Bairn', 'Plea for Guidance', 'Endless Horizons', 'Think Twice', 'Patch Up', 'Shriekhorn', 'Bloodbraid Elf', 'Archfiend''s Vessel', 'Mobilized District', 'Ransack the Lab', 'Incubation Druid', 'Essence Capture', 'Ondu Inversion', 'Galvanic Relay', 'Arcbound Mouser', 'Mystical Teachings', 'Essence Flux', 'Sun Droplet', 'Wedding Invitation', 'Vampire Opportunist', 'Sram''s Expertise', 'Ivy Lane Denizen', 'Edric, Spymaster of Trest', 'Diregraf Colossus', 'First-Sphere Gargantua', 'Hieroglyphic Illumination', 'Regrowth', 'Grim Lavamancer', 'Hagra Diabolist', 'Trostani''s Summoner', 'Malakir Rebirth', 'Raven''s Crime', 'Dovin Baan', 'Hypergenesis', 'Waterfront District', 'Bond of Revival', 'Curse of Death''s Hold', 'Out of Time', 'Nivmagus Elemental', 'Faerie Miscreant', 'Tocatli Honor Guard', 'Slaughter Pact', 'Fusion Elemental', 'Canyon Slough', 'Growth-Chamber Guardian', 'Blood Operative', 'Dead // Gone', 'Wingcrafter', 'Bump in the Night', 'Radiant Fountain', 'Storm Herald', 'Ash Zealot', 'Lena, Selfless Champion', 'Curse of the Pierced Heart', 'Caves of Koilos', 'Chief Engineer', 'Cabal Therapist', 'Insatiable Hemophage', 'Prahv, Spires of Order', 'Nyxathid', 'Cliffhaven Kitesail', 'Chief of the Foundry', 'Titanic Brawl', 'Dread Fugue', 'Angel of Glory''s Rise', 'Artisan of Forms', 'Kami of False Hope', 'Specter''s Shroud', 'Coalition Relic', 'Genesis', 'Reality Ripple', 'Sokenzan Smelter', 'Call of the Herd', 'Season of Growth', 'Become Immense', 'Necrotic Ooze', 'Breya''s Apprentice', 'Elvish Mystic', 'Eye of Nowhere', 'Gladecover Scout', 'Mycosynth Wellspring', 'Goldmire Bridge', 'Glacial Fortress', 'Permeating Mass', 'Gone Missing', 'Consuming Vapors', 'Runechanter''s Pike', 'Gaea''s Will', 'Sigrid, God-Favored', 'Oath of Liliana', 'Lifespinner', 'Carth the Lion', 'Talisman of Conviction', 'Nylea''s Presence', 'Angel''s Grace', 'Meteor Golem', 'Lodestone Golem', 'Coastal Tower', 'It That Betrays', 'Deploy the Gatewatch', 'Gather the Townsfolk', 'Yarok''s Fenlurker', 'Blackmail', 'Prognostic Sphinx', 'Demonic Embrace', 'Tatsunari, Toad Rider', 'Elves of Deep Shadow', 'Mistcutter Hydra', 'Vivid Creek', 'Eidolon of Countless Battles', 'Skybridge Towers', 'You Are Already Dead', 'Immortal Servitude', 'Dirge Bat', 'Hurricane', 'Tangled Florahedron', 'Mire''s Grasp', 'Fodder Tosser', 'The Underworld Cookbook', 'Llanowar Wastes', 'Banisher Priest', 'Forsake the Worldly', 'Karn, Silver Golem', 'Join the Dance', 'Pyrite Spellbomb', 'Dire Tactics', 'Woodland Champion', 'Kabira Evangel', 'Frost Marsh', 'Blood for Bones', 'Realm Razer', 'Approach of the Second Sun', 'Exclude', 'Howling Mine', 'Phantasmal Form', 'Illuminator Virtuoso', 'Kefnet the Mindful', 'Cragplate Baloth', 'Kaya, Ghost Assassin', 'Piper of the Swarm', 'Counterflux', 'Boros Signet', 'Cosima, God of the Voyage', 'Claim the Firstborn', 'Wall of Omens', 'Mina and Denn, Wildborn', 'Fact or Fiction', 'Merfolk Mistbinder', 'Oust', 'Barrenton Medic', 'Frontier Bivouac', 'Kuldotha Forgemaster', 'Hushwing Gryff', 'Raging Ravine', 'Far // Away', 'Oath of Gideon', 'Slitherhead', 'The Birth of Meletis', 'Terramorphic Expanse', 'Sylvan Scrying', 'Thundering Raiju', 'Dissolve', 'Gossamer Chains', 'Tormenting Voice', 'Ensoul Artifact', 'Mortarpod', 'Delirium Skeins', 'Frostwalk Bastion', 'Dihada''s Ploy', 'Rift Sower', 'Demonic Dread', 'Altered Ego', 'Quest for Pure Flame', 'Burst Lightning', 'Stubborn Denial', 'Shuko', 'Cosmos Elixir', 'Ghost Quarter', 'Turn Aside', 'Magister Sphinx', 'Divert', 'Rustvale Bridge', 'Thief of Sanity', 'Pyroclasm', 'Traxos, Scourge of Kroog', 'Earthquake', 'Liquimetal Torque', 'Falkenrath Aristocrat', 'Arcane Sanctum', 'Molten Slagheap', 'Brokkos, Apex of Forever', 'Dragonskull Summit', 'Searing Spear', 'Duress', 'Blightning', 'Distortion Strike', 'Cartographer''s Survey', 'Jack-o''-Lantern', 'Expedite', 'Everflowing Chalice', 'Witching Well', 'Sphere of Safety', 'Sanguine Statuette', 'Silundi Vision', 'Omen of the Forge', 'Ornithopter of Paradise', 'Harabaz Druid', 'Radiant Flames', 'Fireball', 'Incandescent Aria', 'Sol Talisman', 'Tyrant''s Scorn', 'Assault Strobe', 'March from the Tomb', 'Nether Spirit', 'Phylath, World Sculptor', 'War''s Toll', 'Loxodon Smiter', 'Mirrodin Besieged', 'Mishra''s Factory', 'Fireblade Charger', 'Lead the Stampede', 'Dire-Strain Rampage', 'Furyblade Vampire', 'Signal Pest', 'Grisly Salvage', 'Ranger''s Guile', 'Graf Mole', 'Myojin of Infinite Rage', 'Court Homunculus', 'Tidehollow Strix', 'Aeve, Progenitor Ooze', 'Wild Pair', 'Blackbloom Rogue', 'Deep Forest Hermit', 'Fiery Justice', 'Emmara, Soul of the Accord', 'Angel of Sanctions', 'Jaya Ballard', 'Blue Sun''s Zenith', 'Fatestitcher', 'Dream Trawler', 'Vigor', 'Servo Exhibition', 'Porphyry Nodes', 'Incinerate', 'Cruel Reality', 'The Mirari Conjecture', 'Early Frost', 'Generous Visitor', 'Erdwal Illuminator', 'Quicken', 'Phyrexian Revoker', 'Faithless Salvaging', 'Curse of Echoes', 'Champion of Wits', 'Nevermaker', 'Conqueror''s Pledge', 'Animate Dead', 'Mistvault Bridge', 'Rabbit Battery', 'Archaeomancer', 'Curse of Misfortunes', 'Broodmate Dragon', 'Morselhoarder', 'Snow-Covered Forest', 'Daru Spiritualist', 'Mentor of the Meek', 'Linvala, the Preserver', 'Tezzeret''s Gambit', 'Deliberate', 'Shenanigans', 'Psychatog', 'Weaver of Harmony', 'Walk the Aeons', 'Thermo-Alchemist', 'Nezahal, Primal Tide', 'Champion of the Parish', 'Voltage Surge', 'Paralyze', 'Into the Story', 'Dive Down', 'Niveous Wisps', 'Meandering River', 'Improbable Alliance', 'Archway Commons', 'Temple of Abandon', 'Ajani Unyielding', 'Blossoming Calm', 'Mystic Snake', 'Horrifying Revelation', 'Skirge Familiar', 'Zombie Infestation', 'Jolrael, Mwonvuli Recluse', 'Gruul Turf', 'Rakdos Charm', 'Flood of Recollection', 'Vampire Lacerator', 'Foreboding Ruins', 'Ancient Stirrings', 'Trace of Abundance', 'Shalai, Voice of Plenty', 'Heartless Act', 'Sarcomancy', 'Zur''s Weirding', 'Lost Auramancers', 'Kessig Wolf Run', 'Asmodeus the Archfiend', 'Kopala, Warden of Waves', 'Bedevil', 'Hostage Taker', 'Mesmeric Fiend', 'Purphoros''s Intervention', 'Power Depot', 'Sleight of Hand', 'Pelakka Predation', 'Reap the Past', 'Anchor to Reality', 'Boomerang', 'Suture Priest', 'Rule of Law', 'Darkmoss Bridge', 'Boonweaver Giant', 'Biting-Palm Ninja', 'Hydra Broodmaster', 'Noxious Vapors', 'Talisman of Unity', 'Mangara of Corondor', 'Watcher for Tomorrow', 'Primal Surge', 'Shatter the Sky', 'Nicol Bolas', 'Act of Aggression', 'Atris, Oracle of Half-Truths', 'Sylvan Awakening', 'Vault of the Archangel', 'Kabira Takedown', 'Kher Keep', 'Gadwick, the Wizened', 'Birds of Paradise', 'Thassa''s Intervention', 'Lantern Scout', 'Voldaren Epicure', 'Hornet Queen', 'Mystic Monastery', 'Solfatara', 'Crumbling Necropolis', 'Zealous Persecution', 'Jace, Cunning Castaway', 'Jokulhaups', 'Champion of Dusk', 'Viashino Pyromancer', 'Seaside Citadel', 'Azorius Charm', 'Judith, the Scourge Diva', 'Pieces of the Puzzle', 'Goblin Anarchomancer', 'Captain''s Claws', 'Dread Return', 'Wildfield Borderpost', 'Dragonsguard Elite', 'Make Disappear', 'Oracle of Mul Daya', 'Fatal Grudge', 'Riftwing Cloudskate', 'Ironroot Warlord', 'Dreadhorde Invasion', 'Pirate''s Pillage', 'Forbidden Alchemy', 'Cloudblazer', 'Scrabbling Claws', 'Mikokoro, Center of the Sea', 'Liquimetal Coating', 'Whispers of the Muse', 'Victim of Night', 'Verdant Command', 'Nevermore', 'Hindering Light', 'Opt', 'Moment of Craving', 'Base Camp', 'Brushfire Elemental', 'Talisman of Resilience', 'Coralhelm Commander', 'Swans of Bryn Argoll', 'Azami, Lady of Scrolls', 'Arrogant Wurm', 'Sylvan Primordial', 'Quest for the Nihil Stone', 'Rally the Ancestors', 'Grand Arbiter Augustin IV', 'Desperate Ritual', 'Ethersworn Sphinx', 'Stony Strength', 'Collected Conjuring', 'Castigate', 'Detention Sphere', 'Lonis, Cryptozoologist', 'Falkenrath Gorger', 'Astral Cornucopia', 'Mystifying Maze', 'Rampant Growth', 'Warriors'' Lesson', 'Hidden Strings', 'Dennick, Pious Apprentice', 'Never // Return', 'Judge''s Familiar', 'Day of Judgment', 'Vampire Nighthawk', 'Resurgent Belief', 'Tectonic Giant', 'Fertile Ground', 'Stream of Thought', 'Conclave Tribunal', 'Asylum Visitor', 'Oyobi, Who Split the Heavens', 'Chain of Plasma', 'Kaleidoscorch', 'Disrupting Scepter', 'Kazuul''s Fury', 'Howltooth Hollow', 'Zulaport Cutthroat', 'Gilded Lotus', 'Secluded Steppe', 'Call of the Conclave', 'Thought Scour', 'Larger Than Life', 'Tempered Steel', 'Stromkirk Captain', 'Ixalan''s Binding', 'Veteran Warleader', 'Cultivator of Blades', 'Sinister Sabotage', 'Voltaic Key', 'Enter the God-Eternals', 'Elvish Visionary', 'Sky Hussar', 'Dual Strike', 'Lord of the Undead', 'Secluded Courtyard', 'Tide Shaper', 'Sea Gate Wreckage', 'Falkenrath Forebear', 'Karn''s Temporal Sundering', 'Negate', 'Primal Amulet', 'Talisman of Impulse', 'Flame Jab', 'Delver of Secrets', 'Dovescape', 'Esper Charm', 'Desolation Twin', 'Infinite Obliteration', 'Wrench Mind', 'Hotshot Mechanic', 'He Who Hungers', 'Curse of Thirst', 'Skeletal Swarming', 'Genesis Hydra', 'Blight Mamba', 'Expansion // Explosion', 'Tymaret, Chosen from Death', 'Necroplasm', 'Hypnotic Sprite', 'Snow-Covered Swamp', 'Vedalken Archmage', 'Ramunap Excavator', 'Glass Casket', 'Jace, the Living Guildpact', 'Torment of Scarabs', 'Spikefield Hazard', 'Primal Command', 'Lashwrithe', 'Liliana Vess', 'Patchwork Automaton', 'Mwonvuli Acid-Moss', 'Planar Outburst', 'Consign // Oblivion', 'Gods Willing', 'Crystal Shard', 'Proclamation of Rebirth', 'Memory Lapse', 'Riot Control', 'Cursed Totem', 'Mogg War Marshal', 'Grimdancer', 'Starlit Sanctum', 'Rite of Oblivion', 'Eternal Dragon', 'Endless Sands', 'Coiling Oracle', 'Merrow Reejerey', 'Phylactery Lich', 'Chamber Sentry', 'Muddle the Mixture', 'Stonework Packbeast', 'Undead Butler', 'Dark Salvation', 'Gideon''s Intervention', 'Temple of Silence', 'Geist-Honored Monk', 'Bone Shards', 'Sejiri Refuge', 'Tomb of Urami', 'Gargoyle Castle', 'Quarantine Field', 'Epic Experiment', 'Boros Reckoner', 'Captivating Vampire', 'Experimental Overload', 'Braingeyser', 'Squadron Hawk', 'Voldaren Stinger', 'Bone Splinters', 'Stone Rain', 'Swiftwater Cliffs', 'Dakmor Salvage', 'Angel of Despair', 'Diregraf Ghoul', 'Moonhold', 'Gruul Signet', 'Contagion Engine', 'Pyretic Ritual', 'Safewright Quest', 'Reassembling Skeleton', 'Curse of the Cabal', 'Rune Snag', 'Crystallization', 'Postmortem Lunge', 'Jungle Shrine', 'Pouncing Shoreshark', 'Lavaclaw Reaches', 'Electrostatic Field', 'Brokers Hideout', 'Commence the Endgame', 'Needle Spires', 'Sterling Grove', 'Oni-Cult Anvil', 'Urza''s Factory', 'Kjeldoran Outpost', 'Expedition Envoy', 'Fire Covenant', 'Lava Dart', 'Circular Logic', 'Barrin, Tolarian Archmage', 'See the Truth', 'Gloomshrieker', 'Relentless Rats', 'Niambi, Esteemed Speaker', 'Epochrasite', 'Nissa, Worldwaker', 'Animist''s Awakening', 'Impostor of the Sixth Pride', 'Costly Plunder', 'Weathered Wayfarer', 'Retreat to Hagra', 'Sacred Fire', 'Transmogrify', 'Hero of Precinct One', 'Ulvenwald Mysteries', 'Cleansing Nova', 'Palace Siege', 'Tempest Djinn', 'Frantic Search', 'Ravager''s Mace', 'Shivan Dragon', 'Midnight Clock', 'Fieldmist Borderpost', 'Ritual of Soot', 'Haven of the Spirit Dragon', 'Masked Bandits', 'Rise and Shine', 'Temple of Triumph', 'Dryad Militant', 'End Hostilities', 'Outland Liberator', 'Seething Song', 'Rishkar, Peema Renegade', 'Deep Analysis', 'Acolyte of Affliction', 'Orzhov Signet', 'Retraction Helix', 'Hanweir Garrison', 'Dragon Tempest', 'Tyrant''s Choice', 'Spawning Pool', 'Metallic Rebuke', 'Shigeki, Jukai Visionary', 'Wight', 'Bag of Holding', 'Diabolic Edict', 'Altar''s Reap', 'Cartel Aristocrat', 'Grotag Bug-Catcher', 'Jace, Memory Adept', 'Curiosity', 'Halimar Excavator', 'Kin-Tree Invocation', 'Shelter', 'Oblivion Ring', 'Groundswell', 'Clan Defiance', 'Embodiment of Agonies', 'Drift of Phantasms', 'Vilis, Broker of Blood', 'Sickening Shoal', 'Kalastria Healer', 'Uncharted Haven', 'Tradewind Rider', 'Faithful Mending', 'Hada Freeblade', 'Temple of Epiphany', 'Iname, Death Aspect', 'Reinforced Ronin', 'Ghostly Flicker', 'Thawing Glaciers', 'Savra, Queen of the Golgari', 'Fumigate', 'Surge Node', 'Steel Sabotage', 'Snowfield Sinkhole', 'Zhur-Taa Goblin', 'Feed the Swarm', 'Circle of Confinement', 'Connive // Concoct', 'Concerted Defense', 'Kolaghan, the Storm''s Fury', 'Frantic Inventory', 'Lochmere Serpent', 'Explore', 'Jhoira''s Familiar', 'Clattering Augur', 'Hateful Eidolon', 'Haunted Fengraf', 'Azor''s Gateway', 'Mirrorpool', 'Coralhelm Guide', 'Llanowar Elves', 'Neutralize', 'Phyrexian Dreadnought', 'Izzet Charm', 'Azorius Signet', 'Argent Sphinx', 'Wilt-Leaf Liege', 'Spellweaver Helix', 'Abundant Harvest', 'Gift of Estates', 'Ondu Cleric', 'Briarbridge Patrol', 'Jeskai Ascendancy', 'Pack Rat', 'Kazandu Blademaster', 'Might of Old Krosa', 'Bloodchief''s Thirst', 'Valorous Stance', 'Intervention Pact', 'Dramatic Finale', 'Blade Splicer', 'Timely Reinforcements', 'Irregular Cohort', 'Fossil Find', 'Deadly Alliance', 'Liege of the Tangle', 'Tymaret Calls the Dead', 'Earthshaker Khenra', 'Tamiyo''s Safekeeping', 'Prohibit', 'Ranger of Eos', 'Ponder', 'Grixis Panorama', 'Stormchaser Drake', 'Favored Hoplite', 'Thought Erasure', 'Kitchen Imp', 'Blasphemous Act', 'Sarkhan the Mad', 'Experimental Frenzy', 'Wandering Mind', 'Martyr of Sands', 'Thrumming Stone', 'Magister of Worth', 'Nomad Outpost', 'Death Baron', 'Satyr Hoplite', 'Elvish Piper', 'Prey''s Vengeance', 'Underworld Dreams', 'Ral Zarek', 'Fiend Hunter', 'Kor Bladewhirl', 'Tendo Ice Bridge', 'Arch of Orazca', 'Mission Briefing', 'Odds // Ends', 'Eerie Interlude', 'Ground Rift', 'Fire-Lit Thicket', 'Gods'' Eye, Gate to the Reikai', 'Gavony Township', 'Mana Leak', 'Blazing Rootwalla', 'Timeless Witness', 'Dimir Signet', 'Quiet Speculation', 'Laboratory Maniac', 'Brainstone', 'Murmuring Mystic', 'Vivid Grove', 'Scoured Barrens', 'Snow-Covered Plains', 'Treacherous Blessing', 'Westvale Abbey', 'Kira, Great Glass-Spinner', 'Desperate Ravings', 'Malakir Blood-Priest', 'Iname, Life Aspect', 'Disciple of Bolas', 'Izzet Boilerworks', 'Putrid Imp', 'Spectra Ward', 'Quirion Dryad', 'Radha, Heart of Keld', 'Temple of Malice', 'Jhoira, Weatherlight Captain', 'Sea Gate Colossus', 'Master of Death', 'Braids, Cabal Minion', 'Slagstorm', 'Basking Rootwalla', 'Veinfire Borderpost', 'Beastcaller Savant', 'Soulherder', 'Midnight Reaper', 'Ignite Memories', 'Filigree Angel', 'Master of the Pearl Trident', 'Elvish Clancaller', 'Glen Elendra Archmage', 'Colossification', 'Conclave Mentor', 'Rotten Reunion', 'Spirited Companion', 'Temple of Mystery', 'Garruk Wildspeaker', 'Regal Force', 'Sylvan Library', 'Glorybringer', 'Kazandu Mammoth', 'Arc-Slogger', 'Balustrade Spy', 'Etherium Sculptor', 'Nimble Larcenist', 'Mirrorshell Crab', 'Yahenni''s Expertise', 'Dripping-Tongue Zubera', 'Shardless Agent', 'Horde of Notions', 'Myojin of Life''s Web', 'Pooling Venom', 'Scrapheap Scrounger', 'Egon, God of Death', 'Terrarion', 'Elixir of Immortality', 'Staggering Insight', 'Temple of Malady', 'Satyr Wayfinder', 'Ajani, Caller of the Pride', 'Perilous Research', 'Take Inventory', 'Grapeshot', 'Woodland Cemetery', 'Gigantomancer', 'Nicol Bolas, Planeswalker', 'Anoint', 'Riptide Laboratory', 'Eiganjo Uprising', 'Hatching Plans', 'Cleansing Wildfire', 'Vivien''s Arkbow', 'Riveteers Charm', 'Ancestral Anger', 'Firespout', 'Grim Haruspex', 'Graveyard Marshal', 'Retreat to Kazandu', 'Savage Lands', 'Strength of Solidarity', 'Temple of Deceit', 'Kumano Faces Kakkazan', 'Logic Knot', 'Grixis Charm', 'Thirst for Meaning', 'Living Lore', 'Fblthp, the Lost', 'Read the Bones', 'Magmatic Sinkhole', 'Zhalfirin Void', 'Overwhelming Splendor', 'Buried Ruin', 'Cloudstone Curio', 'Skymarcher Aspirant', 'Polymorph', 'High-Speed Hoverbike', 'Elspeth''s Nightmare', 'Strategic Planning', 'Mire Triton', 'Crack the Earth', 'Flood Plain', 'Hard Evidence', 'Battle of Wits', 'Dawn of Hope', 'Contaminated Ground', 'Cloudpost', 'Veteran Adventurer', 'Necrogoyf', 'Burning of Xinye', 'Fabricate', 'Vengeful Strangler', 'Wooded Bastion', 'Edge of Autumn', 'Grindclock', 'Spell Pierce', 'Memory''s Journey', 'Sprite Dragon', 'Debtors'' Knell', 'Shrine of Burning Rage', 'Herbal Poultice', 'Riveteers Overlook', 'Unburial Rites', 'Fauna Shaman', 'Daxos of Meletis', 'Teferi, Mage of Zhalfir', 'Maestros Charm', 'Seal of Cleansing', 'Goblin Electromancer', 'Enduring Ideal', 'Search for Tomorrow', 'Wrath of God', 'Chandra, Pyromaster', 'Dryad''s Revival', 'Lay of the Land', 'Marauding Raptor', 'Alms of the Vein', 'Dragonspark Reactor', 'Knowledge Pool', 'Cryptic Caves', 'Sigil Blessing', 'Saw It Coming', 'Glimmerpost', 'Prophet of Kruphix', 'Evolving Wilds', 'Force of Nature', 'Synchronized Spellcraft', 'Drownyard Temple', 'Nether Traitor', 'Exhaustion', 'Otherworldly Gaze', 'Universal Automaton', 'Security Bypass', 'Future Sight', 'Hour of Promise', 'Guild Globe', 'Sprouting Thrinax', 'Strike It Rich', 'Dominating Vampire', 'Elemental Bond', 'Trickbind', 'Myr Servitor', 'Acquisitions Expert', 'Dictate of Kruphix', 'Obscura Charm', 'Wild Cantor', 'Vivid Crag', 'Consume the Meek', 'Maestros Theater', 'Sign in Blood', 'Commit // Memory', 'Dragon Mantle', 'Hagra Mauling', 'Aqueous Form', 'Disenchant', 'Saproling Migration', 'Blessed Alliance', 'Failure // Comply', 'Thornglint Bridge', 'Wing Shards', 'Carnophage', 'Swallow Whole', 'Akroma, Angel of Fury', 'Mind Rake', 'Ecstatic Awakener', 'Energy Arc', 'Sorin Markov', 'Thaumatic Compass', 'Myr Incubator', 'Prowling Serpopard', 'Ethersworn Canonist', 'Discovery // Dispersal', 'Nissa''s Pilgrimage', 'Possibility Storm', 'Michiko''s Reign of Truth', 'Form of the Dragon', 'Nightveil Predator', 'Evermind', 'Jalira, Master Polymorphist', 'Insolent Neonate', 'Labyrinth of Skophos', 'Forbid', 'Fling', 'Vindicate', 'Vizier of the Menagerie', 'Farseek', 'Terminus', 'Platinum Angel', 'Cordial Vampire', 'Surgespanner', 'Blood Fountain', 'Mephidross Vampire', 'Scurry Oak', 'Mist-Syndicate Naga', 'Temple of Plenty', 'Evangel of Heliod', 'Arcanis the Omnipotent', 'Reverent Hoplite', 'Ghitu Encampment', 'Gideon Jura', 'Sylvan Advocate', 'Arbor Elf', 'Inevitable Betrayal', 'Bontu''s Last Reckoning', 'Barbarian Ring', 'Murderous Cut', 'Gatekeeper of Malakir', 'Dimir Charm', 'Mana Flare', 'Hypnotic Specter', 'Ophidian Eye', 'Dark Ritual', 'Semblance Anvil', 'Goblin Bombardment', 'Moss-Pit Skeleton', 'Dusk Legion Zealot', 'Chromatic Lantern', 'Harbinger of the Tides', 'Pulse of the Grid', 'Colossal Skyturtle', 'Dismal Backwater', 'Invisible Stalker', 'Restoration Angel', 'Invert // Invent', 'Prophetic Prism', 'Drowned Catacomb', 'Moon-Circuit Hacker', 'Ghirapur Aether Grid', 'Jace Beleren', 'Whip of Erebos', 'Nirkana Assassin', 'Ral, Storm Conduit', 'Pillage', 'Spear of Heliod', 'Disciple of the Vault', 'Mouth of Ronom', 'Auspicious Starrix', 'Kuldotha Rebirth', 'Game Trail', 'Dragon''s Hoard', 'Shatterskull Minotaur', 'Rend Flesh', 'Gitaxian Probe', 'Geomancer''s Gambit', 'Ilysian Caryatid', 'Mouth // Feed', 'Alchemist''s Vial', 'Declaration in Stone', 'Gaea''s Revenge', 'Nested Shambler', 'Drakuseth, Maw of Flames', 'General Ferrous Rokiric', 'Memnarch', 'Stasis Snare', 'Izoni, Thousand-Eyed', 'Harmonize', 'Orzhov Basilica', 'Mistveil Plains', 'Umara Entangler', 'Wirewood Herald', 'Tolsimir, Friend to Wolves', 'Solitary Confinement', 'Tidal Warrior', 'Inscription of Ruin', 'Jwari Disruption', 'Intangible Virtue', 'Abzan Charm', 'Black Sun''s Zenith', 'Bloodvial Purveyor', 'Unsubstantiate', 'Mystic Retrieval', 'Akroma''s Memorial', 'Vampiric Fury', 'Sire of Insanity', 'Bygone Bishop', 'Caravan Vigil', 'Touch the Spirit Realm', 'Eldrazi Conscription', 'Spare Supplies', 'Slag Strider', 'Spinerock Knoll', 'Smokestack', 'Pull from Tomorrow', 'Raise the Alarm', 'Razortide Bridge', 'Hunted Nightmare', 'Selesnya Charm', 'Demon Bolt', 'Augur of Bolas', 'Lumbering Falls', 'Chain Lightning', 'Knight of the White Orchid', 'Bojuka Brigand', 'Tranquil Cove', 'Bond of Insight', 'Meishin, the Mind Cage', 'Conflagrate', 'Genesis Wave', 'Lich''s Mastery', 'Undercity Informer', 'Falkenrath Pit Fighter', 'Chandra, Fire Artisan', 'Ingenious Infiltrator', 'Temple of Enlightenment', 'Tendrils of Agony', 'Lonely Sandbar', 'Lose Focus', 'End-Raze Forerunners', 'Putrid Goblin', 'Demanding Dragon', 'Phantasmagorian', 'Kunoros, Hound of Athreos', 'Smallpox', 'Everdream', 'Cruel Ultimatum', 'Nature''s Lore', 'Lavinia of the Tenth', 'Desolate Lighthouse', 'Winterthorn Blessing', 'Ravenous Chupacabra', 'Salvage Titan', 'Hymn to Tourach', 'Revitalize', 'Elderfang Ritualist', 'Rebuild', 'Icehide Golem', 'Restore Balance', 'Erebos''s Intervention', 'Sandsteppe Citadel', 'Magistrate''s Scepter', 'Treasure Cruise', 'Brain Freeze', 'Not of This World', 'Gateway Plaza', 'Invigorate', 'Ram Through', 'Decree of Justice', 'Glint-Horn Buccaneer', 'White Sun''s Zenith', 'Force of Rage'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 71.4, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (64.2 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Tradewind Rider', 'Edric, Spymaster of Trest', 'Purphoros''s Intervention', 'Dauntless Bodyguard', 'Scrap Trawler', 'Sharuum the Hegemon', 'Gavony Township', 'Frantic Search', 'Drogskol Captain', 'Tendrils of Agony', 'Halimar Excavator', 'Sylvan Scrying', 'Tymaret, Chosen from Death', 'Psychatog', 'Knight of Glory', 'Shatterskull Charger', 'Tower of Calamities', 'Verdant Command', 'Kodama''s Reach', 'Hive Stirrings', 'Teachings of the Kirin', 'Grisly Salvage', 'Smallpox', 'Abbot of Keral Keep', 'Hateful Eidolon', 'Niv-Mizzet, the Firemind', 'Midnight Clock', 'Bloodbraid Elf', 'Firebrand Archer', 'Cloudcrest Lake', 'Ball Lightning', 'Alchemist''s Gambit', 'Just the Wind', 'Grim Haruspex', 'Kefnet the Mindful', 'Porcelain Legionnaire', 'Vivid Crag', 'Ashenmoor Gouger', 'Fanatical Firebrand', 'Giant Ox', 'Falkenrath Pit Fighter', 'Tooth of Chiss-Goria', 'Asylum Visitor', 'Earthshaker Khenra', 'Warleader''s Helix', 'Knight of Infamy', 'Soul Spike', 'Game Trail', 'Monstrous Carabid', 'Rix Maadi Reveler', 'Silverbluff Bridge', 'Gloomshrieker', 'Oust', 'Steppe Lynx', 'Vivid Meadow', 'Faithful Mending', 'Reckless Charge', 'Mul Daya Channelers', 'Jace, Memory Adept', 'Hissing Quagmire', 'Perilous Research', 'Hour of Reckoning', 'Heartless Summoning', 'Vessel of Nascency', 'Graf Reaver', 'Llanowar Tribe', 'Mikaeus, the Lunarch', 'Harrow', 'Ajani, the Greathearted', 'Commune with the Gods', 'Slagstorm', 'Multiple Choice', 'Defiant Strike', 'Tempered Sliver', 'Moorland Haunt', 'Acidic Slime', 'Abrade', 'Chandra, Pyromaster', 'Auramancer', 'Goblin Dark-Dwellers', 'Joraga Warcaller', 'Scab-Clan Berserker', 'Delver of Secrets', 'Jokulhaups', 'Hymn to Tourach', 'Kiln Fiend', 'Llanowar Wastes', 'White Sun''s Zenith', 'Windbrisk Heights', 'Conduit of Ruin', 'Sylvan Primordial', 'Unsubstantiate', 'Plow Under', 'All Suns'' Dawn', 'Gilded Lotus', 'Nezahal, Primal Tide', 'Demonic Dread', 'Vivid Creek', 'Mistvault Bridge', 'Bedlam Reveler', 'Skull Prophet', 'Torrent Sculptor', 'Ethersworn Canonist', 'Knight of the White Orchid', 'Hagra Mauling', 'Slitherhead', 'Disciple of Bolas', 'Tempered in Solitude', 'Staggering Insight', 'Nivmagus Elemental', 'Tomb of Urami', 'Familiar''s Ruse', 'Hypergenesis', 'Treacherous Blessing', 'Tandem Lookout', 'Endbringer', 'Naban, Dean of Iteration', 'The Birth of Meletis', 'Flayer of the Hatebound', 'Esper Charm', 'Justice Strike', 'Brave the Elements', 'Imperious Perfect', 'Dreg Mangler', 'Glowspore Shaman', 'Possibility Storm', 'Anguished Unmaking', 'Animate Dead', 'Sire of Insanity', 'Blackmail', 'Bituminous Blast', 'Resurgent Belief', 'Cosima, God of the Voyage', 'Witch''s Cottage', 'Retributive Wand', 'Shrapnel Blast', 'Path to the World Tree', 'Ash Zealot', 'Sign in Blood', 'Remorseful Cleric', 'Izzet Charm', 'Cloudshift', 'Sky Hussar', 'Tanglepool Bridge', 'Lord of the Undead', 'Discovery // Dispersal', 'Angel of Despair', 'Urza''s Factory', 'Brine Comber', 'Skemfar Avenger', 'Kami of False Hope', 'Thermo-Alchemist', 'Commit // Memory', 'Barren Moor', 'Zombie Infestation', 'Rage Forger', 'Firewild Borderpost', 'Fireblade Charger', 'Thawing Glaciers', 'Coiling Oracle', 'Sandsteppe Citadel', 'Tidal Warrior', 'Tallowisp', 'Mogg War Marshal', 'Claws of Gix', 'Kitchen Imp', 'Kazuul''s Fury', 'Judge''s Familiar', 'Sarkhan the Mad', 'Fury of the Horde', 'Disenchant', 'Containment Construct', 'Tooth and Nail', 'Keruga, the Macrosage', 'Fieldmist Borderpost', 'Benevolent Bodyguard', 'Bazaar Trademage', 'The Scorpion God', 'Spark Elemental', 'The Underworld Cookbook', 'Mobilized District', 'Dryad Militant', 'Hinterland Harbor', 'Buried Alive', 'Captured Sunlight', 'Hypnotic Specter', 'Tyrant''s Choice', 'First-Sphere Gargantua', 'Frantic Inventory', 'Kessig Flamebreather', 'Elixir of Immortality', 'Obsessive Search', 'Pyretic Ritual', 'Transmogrify', 'Ornithopter', 'Nevermore', 'Woodfall Primus', 'Zulaport Cutthroat', 'Eternal Dragon', 'Crash Through', 'Growth-Chamber Guardian', 'Trinket Mage', 'Leechridden Swamp', 'Dimir Infiltrator', 'See the Truth', 'Deep Analysis', 'Fatal Grudge', 'Martyr of Sands', 'Brushfire Elemental', 'Assert Authority', 'Temple of Epiphany', 'Repeal', 'Snow-Covered Swamp', 'Fauna Shaman', 'Thirst for Knowledge', 'Pieces of the Puzzle', 'Sovereigns of Lost Alara', 'Drossforge Bridge', 'Vivid Grove', 'Ojutai''s Command', 'Howling Mine', 'Goblin Bombardment', 'Shaman of the Great Hunt', 'Origin Spellbomb', 'Seismic Assault', 'Search for Tomorrow', 'Call of the Conclave', 'Veinfire Borderpost', 'Intangible Virtue', 'Master of Death', 'Sleight of Hand', 'Hell Mongrel', 'Jace Beleren', 'Skophos Reaver', 'Nissa Revane', 'Sojourner''s Companion', 'Hollowhead Sliver', 'Arrogant Wurm', 'Shardless Agent', 'Spikefield Hazard', 'Benalish Marshal', 'Kazandu Mammoth', 'Springbloom Druid', 'Advent of the Wurm', 'Solitary Confinement', 'Village Messenger', 'Magister of Worth', 'Oona, Queen of the Fae', 'Phantasmagorian', 'Treasure Hunt', 'Tectonic Giant', 'Cabaretti Courtyard', 'Opt', 'Oblivion Ring', 'Kuro, Pitlord', 'Sarkhan the Masterless', 'Rashmi, Eternities Crafter', 'Sphinx of Foresight', 'Intruder Alarm', 'Broodstar', 'Merchant of the Vale', 'Leaf-Crowned Elder', 'Unlucky Witness', 'Rakdos Charm', 'Chromatic Lantern', 'Brute Suit', 'Temple of Deceit', 'Colossal Skyturtle', 'Brainstone', 'Sphinx of the Steel Wind', 'Primal Surge', 'Reveillark', 'Field of Ruin', 'Rune-Scarred Demon', 'Memorial to Glory', 'Basking Rootwalla', 'Invoke Calamity', 'Renewed Faith', 'Sovereign''s Bite', 'Flame Slash', 'Homing Sliver', 'Agonizing Remorse', 'Lonis, Cryptozoologist', 'Mystic Snake', 'Mask of the Mimic', 'Stitcher''s Graft', 'Blade Splicer', 'Bruna, Light of Alabaster', 'Raze the Effigy', 'Master Splicer', 'Judith, the Scourge Diva', 'Thought Scour', 'Dark-Dweller Oracle', 'Darksteel Colossus', 'Throes of Chaos', 'Tithe Taker', 'Dragonskull Summit', 'Ground Rift', 'Voidslime', 'Counterflux', 'Mishra''s Factory', 'Mesa Enchantress', 'Pathrazer of Ulamog', 'Dragonkin Berserker', 'Giant Killer', 'Lochmere Serpent', 'Nature''s Lore', 'Canyon Slough', 'Tatsunari, Toad Rider', 'Oni-Cult Anvil', 'Seaside Citadel', 'Thraben Inspector', 'Parcel Myr', 'Curious Pair', 'Pyrrhic Revival', 'Mirran Crusader', 'Curiosity', 'Snow-Covered Mountain', 'Beast Whisperer', 'Secluded Courtyard', 'Skyclave Cleric', 'Buried Ruin', 'Evolving Wilds', 'Gaea''s Will', 'Darkheart Sliver', 'Hotshot Mechanic', 'Sinister Concoction', 'Jace, the Living Guildpact', 'Shrieking Affliction', 'Greater Gargadon', 'Glacial Fortress', 'Biting Rain', 'Nylea''s Presence', 'Kird Ape', 'Orcish Lumberjack', 'Lightning Strike', 'Aphemia, the Cacophony', 'Zurgo Bellstriker', 'Arbor Elf', 'Fire Prophecy', 'Horror of the Broken Lands', 'Nemesis of Mortals', 'Avacyn''s Pilgrim', 'Profane Procession', 'Scrapheap Scrounger', 'Thornglint Bridge', 'Blazing Rootwalla', 'Stromkirk Noble', 'Obstinate Baloth', 'Rootbound Crag', 'Memnarch', 'Undead Butler', 'Crackleburr', 'Mirrorshell Crab', 'Thunderous Wrath', 'Slip Out the Back', 'Watcher for Tomorrow', 'Wall of Omens', 'Grave Scrabbler', 'Sigarda''s Splendor', 'Scale of Chiss-Goria', 'Midnight Reaper', 'Wight', 'Dream Trawler', 'Mistveil Plains', 'Mirage Mirror', 'Disciple of the Vault', 'Dovin Baan', 'Tidespout Tyrant', 'Unesh, Criosphinx Sovereign', 'Falkenrath Aristocrat', 'Everflowing Chalice', 'Sleeper Agent', 'Inga Rune-Eyes', 'Mirror March', 'Geomancer''s Gambit', 'Chancellor of the Dross', 'Timeless Witness', 'Myr Reservoir', 'Flash of Insight', 'Bloodchief''s Thirst', 'Lyzolda, the Blood Witch', 'Kira, Great Glass-Spinner', 'Wandering Mind', 'Logic Knot', 'Dark Ritual', 'Sangrophage', 'Llanowar Elves', 'Sword-Point Diplomacy', 'Shriekhorn', 'Flame Javelin', 'Blazing Shoal', 'Secluded Steppe', 'Fact or Fiction', 'General Ferrous Rokiric', 'Kari Zev''s Expertise', 'Etherium Sculptor', 'Needle Spires', 'Wonder', 'Skyclave Pick-Axe', 'Ranger of Eos', 'Masterful Replication', 'Silundi Vision', 'Circular Logic', 'Crack the Earth', 'Kabira Takedown', 'Power Sink', 'Vedalken Engineer', 'Ultimate Price', 'Snow-Covered Forest', 'Angel of Glory''s Rise', 'Blacklance Paragon', 'Wake Thrasher', 'Ramunap Excavator', 'Dread Return', 'Arguel''s Blood Fast', 'Death Baron', 'Lashwrithe', 'Desperate Ritual', 'Skinshifter', 'Drowned Catacomb', 'Carnophage', 'Wildfield Borderpost', 'Mobilizer Mech', 'Gideon Jura', 'Talisman of Curiosity', 'Shard Volley', 'Treasure Cruise', 'Scorched Rusalka', 'Dread Presence', 'Ethersworn Sphinx', 'Kher Keep', 'Plated Geopede', 'Mythos of Brokkos', 'Bonescythe Sliver', 'Dead Weight', 'Aether Spellbomb', 'Silverblade Paladin', 'Kunoros, Hound of Athreos', 'Mana Leak', 'Lavaclaw Reaches', 'Grand Architect', 'Claim the Firstborn', 'Futurist Sentinel', 'March of Reckless Joy', 'Heartless Act', 'Sunscorched Desert', 'Rakdos Cackler', 'Seething Song', 'Tangleroot', 'Hythonia the Cruel', 'Vampire''s Kiss', 'Arcanum Wings', 'Crumbling Necropolis', 'Crashing Drawbridge', 'Primal Command', 'Champion of Wits', 'Tymaret Calls the Dead', 'Temporal Fissure', 'Ionize', 'Edgewall Innkeeper', 'Enigma Sphinx', 'Rakdos Headliner', 'Obscura Storefront', 'Thirst for Meaning', 'Call the Bloodline', 'Sandwurm Convergence', 'Anafenza, Kin-Tree Spirit', 'Healer''s Hawk', 'Rosethorn Acolyte', 'Colossus of Akros', 'Painful Truths', 'Dark Salvation', 'Raise the Alarm', 'Archetype of Endurance', 'Platinum Angel', 'Bone Shards', 'Woodland Cemetery', 'Luminarch Ascension', 'Sygg, River Cutthroat', 'Tyrant of Discord', 'Bloodhall Priest', 'Cloudpost', 'Diabolic Edict', 'Dread Fugue', 'Cathar Commando', 'Desecration Demon', 'Venom Sliver', 'Foreboding Ruins', 'Raven''s Crime', 'Dawn of Hope', 'Obscura Charm', 'Virulent Sliver', 'Generous Visitor', 'Pia''s Revolution', 'Voldaren Epicure', 'Hive Mind', 'Sticky Fingers', 'Lifecrafter''s Bestiary', 'Elvish Visionary', 'Arcane Sanctum', 'Lantern of the Lost', 'Snow-Covered Plains', 'Swiftwater Cliffs', 'Grasp of Darkness', 'Rootborn Defenses', 'Vivid Marsh', 'Ghoultree', 'Festival Crasher', 'Sunblade Samurai', 'Rustvale Bridge', 'Mindslaver', 'Kjeldoran Outpost', 'Champion of the Parish', 'Cartel Aristocrat', 'Hunted Witness', 'Scythe Leopard', 'Collateral Damage', 'Underworld Connections', 'Vital Splicer', 'Zetalpa, Primal Dawn', 'Brain Freeze', 'Razortide Bridge', 'Nissa''s Chosen', 'Deep Forest Hermit', 'Rotting Rats', 'Reckless Waif', 'Sliver Queen', 'Electrostatic Field', 'Selesnya Charm', 'Stormtide Leviathan', 'Bastion of Remembrance', 'Sultai Charm', 'Colossification', 'Explore', 'Anax, Hardened in the Forge', 'Emmara, Soul of the Accord', 'Changeling Outcast', 'Grimdancer', 'Old Stickfingers', 'Runed Halo', 'Oversoul of Dusk', 'Day of Judgment', 'Distended Mindbender', 'Slagwoods Bridge', 'Sylvan Library', 'Mire Triton', 'Stirring Wildwood', 'Tendo Ice Bridge', 'Fyndhorn Elves', 'Maul of the Skyclaves', 'Fiery Temper', 'Graveyard Marshal', 'Ponder', 'Elvish Harbinger', 'Kumano Faces Kakkazan', 'Aven Squire', 'Erebos''s Intervention', 'Fireblade Artist', 'Mythos of Nethroi', 'Krark''s Thumb', 'Dead // Gone', 'Memory Lapse', 'Shriekmaw', 'Glen Elendra Archmage', 'Fungus Sliver', 'Spirited Companion', 'Lotleth Troll', 'Radiant Scrollwielder', 'Falkenrath Gorger', 'Mizzium Mortars', 'Demigod of Revenge', 'Faerie Vandal', 'Silent Arbiter', 'Temple of Malady', 'Good-Fortune Unicorn', 'Mirrodin Besieged', 'Chief Engineer', 'Shipwreck Sifters', 'Vindicate', 'Rabbit Battery', 'Elvish Mystic', 'Hornet Queen', 'Conclave Mentor', 'Plague Belcher', 'Firebolt', 'Heartfire Immolator', 'Sensor Splicer', 'Promise of Bunrei', 'Honor of the Pure', 'Lumbering Falls', 'Snowfield Sinkhole', 'Living Twister', 'Demonic Embrace', 'Arch of Orazca', 'Ancestral Anger', 'Metalwork Colossus', 'Jwari Disruption', 'Grapeshot', 'Wrath of God', 'Galerider Sliver', 'Stone Rain', 'Temple of Malice', 'Evershrike', 'Primalcrux', 'Firemane Avenger', 'Go for the Throat', 'Mystic Monastery', 'Scuttletide', 'Sigil of Valor', 'Azorius Charm', 'Myth Realized', 'Waterfront District', 'Feed the Swarm', 'Extractor Demon', 'Garruk Wildspeaker', 'Glorybringer', 'Tireless Provisioner', 'Glorious End', 'Nomad Outpost', 'Orim''s Chant', 'Abiding Grace', 'Porphyry Nodes', 'Burst Lightning', 'Stormblood Berserker', 'Frenetic Sliver', 'Blood Fountain', 'Mesmeric Fiend', 'Spawning Pool', 'Outland Liberator', 'Sarcomite Myr', 'Swans of Bryn Argoll', 'Hero of Precinct One', 'Fire-Lit Thicket', 'Gatekeeper of Malakir', 'Viscera Seer', 'Soul Snare', 'Angel of Sanctions', 'Incinerate', 'Llanowar Mentor', 'Twisted Abomination', 'Sylvan Advocate', 'Kaya, Ghost Assassin', 'Thirst for Discovery', 'Elves of Deep Shadow', 'Duress', 'Bile Blight', 'Terrarion', 'Tyrant''s Scorn', 'Approach of the Second Sun', 'Forgotten Cave', 'Worldgorger Dragon', 'Battle Screech', 'Chance Encounter', 'Lonely Sandbar', 'Duskwielder', 'Temple of Mystery', 'Flame Jab', 'Lurching Rotbeast', 'Obsessive Stitcher', 'Negate', 'Mission Briefing', 'Sylvan Messenger', 'Glimmerpost', 'Path of Mettle', 'Vryn Wingmare', 'Circle of Confinement', 'Wayward Guide-Beast', 'Pyroclasm', 'Korlash, Heir to Blackblade', 'Goldmire Bridge', 'Doomskar Titan', 'Maestros Charm', 'Dormant Sliver', 'Arcus Acolyte', 'The Bloodsky Massacre', 'Liliana Vess', 'Rishadan Dockhand', 'Satyr Wayfinder', 'Mech Hangar', 'Sundial of the Infinite', 'Spell Pierce', 'Elvish Archdruid', 'Westvale Abbey', 'Cerodon Yearling', 'Ashenmoor Liege', 'Joraga Treespeaker', 'Stern Dismissal', 'Caves of Koilos', 'Phyrexian Dreadnought', 'Riveteers Overlook', 'Wild Nacatl', 'Avatar of Discord', 'Vampire Nighthawk', 'Mistvein Borderpost', 'Elemental Masterpiece', 'Adanto Vanguard', 'Serrated Scorpion', 'Reflex Sliver', 'Vault of the Archangel', 'Skyclave Shade', 'Unburial Rites', 'Lose Focus', 'Reliquary Tower', 'Ghitu Lavarunner', 'Lodestone Golem', 'Ravenous Chupacabra', 'Akoum Hellhound', 'Fertile Ground', 'Piranha Marsh', 'Lone Rider', 'Bala Ged Recovery', 'Viashino Pyromancer', 'Swarm Shambler', 'Restoration Angel', 'Den Protector', 'Bump in the Night', 'Weaver of Harmony', 'Reckless Impulse', 'Panharmonicon', 'Experimental Synthesizer', 'Cleansing Wildfire', 'Restore Balance', 'Reinforced Ronin', 'Hatching Plans', 'Reality Ripple', 'Flame Rift', 'Heliod''s Pilgrim', 'Izzet Boilerworks', 'Marwyn, the Nurturer', 'Duty-Bound Dead', 'Birds of Paradise', 'Cemetery Reaper', 'Nimble Mongoose', 'Lavabelly Sliver', 'Myr Superion', 'Adorned Pouncer', 'Dimir Aqueduct', 'Nested Shambler', 'Cabal Initiate', 'Abundant Harvest', 'Crackling Drake', 'Inevitable Betrayal', 'Clifftop Retreat', 'Avaricious Dragon', 'Collective Effort', 'Crypt of Agadeem', 'Hellspark Elemental', 'Sungold Sentinel', 'Realm Razer', 'Dark Withering', 'Dismal Backwater', 'Terramorphic Expanse', 'Thaumatic Compass', 'Goblin Anarchomancer', 'Improbable Alliance', 'Blistercoil Weird', 'Ghostly Pilferer', 'Prodigy''s Prototype', 'Spectra Ward', 'Terminus', 'Diffusion Sliver', 'Putrid Imp', 'Think Twice', 'Cathartic Reunion', 'Forked Bolt', 'Voldaren Pariah', 'Gemhide Sliver', 'Port of Karfell', 'Behold the Multiverse', 'Temple of Enlightenment', 'Fire Covenant', 'Frontier Bivouac', 'Might Sliver', 'Catch // Release', 'Staff of Domination', 'Rishkar, Peema Renegade', 'Gitaxian Probe', 'Qasali Pridemage', 'Palace Siege', 'Brokers Charm', 'Battlefield Forge', 'Chain Lightning', 'Akrasan Squire', 'Castigate', 'Barrin, Tolarian Archmage', 'Heir of Falkenrath', 'Blessed Defiance', 'Mausoleum Secrets', 'Netherborn Phalanx', 'Temple of Silence', 'Condemn', 'Gonti, Lord of Luxury', 'Myr Sire', 'Seasoned Hallowblade', 'Dregscape Sliver', 'Magmatic Insight', 'Orzhov Signet', 'Lava Dart', 'Decree of Justice', 'Mire''s Grasp', 'Obliterate', 'Acquisitions Expert', 'Diregraf Ghoul', 'Barbarian Ring', 'Akroma''s Memorial', 'Ghost Quarter', 'Avatar of Woe', 'Disallow', 'It That Betrays', 'Acolyte of Affliction', 'Farseek', 'Declaration in Stone', 'Mind''s Desire', 'Nicol Bolas, Planeswalker', 'Brokers Hideout', 'Cultivate', 'Doomed Traveler', 'Detention Sphere', 'Touch the Spirit Realm', 'Raging Ravine', 'Cosmos Elixir', 'Wooded Bastion', 'Coalition Relic', 'Grimoire Thief', 'Okiba Reckoner Raid', 'Revitalize', 'Assault Strobe', 'Reap the Past', 'Otherworldly Gaze', 'Skirk Ridge Exhumer', 'Spell Burst', 'Born to Drive', 'Forbid', 'Sprite Dragon', 'Myr Battlesphere', 'Scrap Welder', 'Fabricate'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 64.2, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (107.7 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Sky Terror', 'Vapor Snag', 'Wall of Omens', 'Orim''s Chant', 'Thought Scour', 'Thirst for Knowledge', 'Kunoros, Hound of Athreos', 'Memory Lapse', 'Tajic, Legion''s Edge', 'Hagra Mauling', 'Blackmail', 'Ornithopter', 'Razortide Bridge', 'Hero of Precinct One', 'Doom Foretold', 'Midnight Clock', 'Bedeck // Bedazzle', 'Obscura Storefront', 'Blue Sun''s Zenith', 'Forgotten Cave', 'Think Twice', 'Etched Champion', 'Erebos''s Intervention', 'Overwhelming Splendor', 'Desperate Ritual', 'Shrapnel Blast', 'Torment of Scarabs', 'Worldgorger Dragon', 'Blade Splicer', 'Lizard Blades', 'Darksteel Juggernaut', 'Improbable Alliance', 'Clifftop Retreat', 'Liliana Vess', 'Chain Lightning', 'Kaya, Ghost Assassin', 'Canyon Slough', 'Dakmor Salvage', 'Cerodon Yearling', 'Signal Pest', 'Acidic Slime', 'Sojourner''s Companion', 'Ethersworn Canonist', 'Greater Mossdog', 'Trespasser''s Curse', 'Vindicate', 'Lochmere Serpent', 'Resurgent Belief', 'Shardless Agent', 'Goldmire Bridge', 'Cabal Therapist', 'Drowned Catacomb', 'Deprive', 'Faerie Vandal', 'Crackling Drake', 'Runed Halo', 'Piranha Marsh', 'Treasure Cruise', 'Lonely Sandbar', 'Wilt-Leaf Liege', 'Skyclave Cleric', 'Sphinx''s Tutelage', 'Delver of Secrets', 'Smokestack', 'Giant Killer', 'Curse of Death''s Hold', 'Porphyry Nodes', 'Temple of Deceit', 'Dryad Militant', 'Temple of Enlightenment', 'Careful Consideration', 'Dovin Baan', 'Snow-Covered Swamp', 'Hymn to Tourach', 'Curiosity', 'Voldaren Epicure', 'Captured Sunlight', 'Dark Ritual', 'Rites of Initiation', 'Touch the Spirit Realm', 'Judge''s Familiar', 'Dread Fugue', 'Shaile, Dean of Radiance', 'Tombstalker', 'Bloodvial Purveyor', 'Rabbit Battery', 'Kjeldoran Outpost', 'Auramancer', 'Oust', 'Fraying Sanity', 'Mobilized District', 'Frantic Search', 'Behold the Multiverse', 'Mana Leak', 'Mind''s Desire', 'Vesperlark', 'Curse of Thirst', 'Pyrite Spellbomb', 'Battlefield Forge', 'Gitaxian Probe', 'Tyrant''s Scorn', 'Jwari Disruption', 'Burst Lightning', 'Animate Dead', 'Izzet Boilerworks', 'Ponder', 'General Ferrous Rokiric', 'Mistvault Bridge', 'Master of Death', 'Pyretic Ritual', 'Agonizing Remorse', 'Silverbluff Bridge', 'Opt', 'Regal Caracal', 'Skyclave Shade', 'Condemn', 'Etched Monstrosity', 'Edge of Autumn', 'Ethersworn Sphinx', 'The Mending of Dominaria', 'Mystic Meditation', 'Secluded Steppe', 'Mirrorweave', 'Dream Trawler', 'Temple of Epiphany', 'Choking Sands', 'Otherworldly Gaze', 'Lavaclaw Reaches', 'Sprite Dragon', 'Knight of the White Orchid', 'Myr Retriever', 'Blazing Shoal', 'Bloodchief''s Thirst', 'Swiftblade Vindicator', 'Hunted Nightmare', 'Astral Slide', 'Thirst for Discovery', 'Deep Forest Hermit', 'Tranquil Thicket', 'Master of Etherium', 'Dawn of Hope', 'Azorius Charm', 'Brain Freeze', 'Esper Charm', 'Wooded Bastion', 'Tanglepool Bridge', 'Rootwater Depths', 'Seething Song', 'Rite of Oblivion', 'Evolving Wilds', 'Broodstar', 'Curse of Misfortunes', 'Stirring Wildwood', 'Spawning Pool', 'Eater of Virtue', 'Falkenrath Aristocrat', 'Experimental Synthesizer', 'Sleight of Hand', 'Gideon Jura', 'Pack Rat', 'Brokers Hideout', 'Omen of the Sun', 'Hypnotic Specter', 'Hall of Oracles', 'Light from Within', 'Mishra''s Factory', 'Orzhov Signet', 'Kuldotha Rebirth', 'Thraben Inspector', 'Lose Focus', 'Patient Rebuilding', 'Massacre Girl', 'Dragonskull Summit', 'Treacherous Blessing', 'Glacial Fortress', 'Caves of Koilos', 'Stonehorn Dignitary', 'Change of Fortune', 'Rain of Revelation', 'Bontu''s Last Reckoning', 'Invoke Calamity', 'Dusk Legion Zealot', 'Barren Moor', 'Fact or Fiction', 'Springbloom Druid', 'Braids, Cabal Minion', 'Cathar Commando', 'The Birth of Meletis', 'Faithful Mending', 'Prismatic Lens', 'Stern Dismissal', 'Benalish Marshal', 'Wrath of God', 'Golgari Grave-Troll', 'Forbid', 'Duress', 'Eternal Dragon', 'Hit // Run', 'Grasp of Darkness', 'Repeal', 'Fall of the Thran', 'Memorial to Genius', 'Ruin Crab', 'Goblin Bushwhacker', 'Precinct Captain', 'Mystical Teachings', 'Restoration Angel', 'Tilling Treefolk', 'Cruel Reality', 'Aether Spellbomb', 'Rustvale Bridge', 'Grapeshot', 'Swiftwater Cliffs', 'Shigeki, Jukai Visionary', 'Mirage Mirror', 'Timeless Witness', 'Smallpox', 'Infernal Grasp', 'Snowfield Sinkhole', 'Barbarian Ring', 'Astral Drift', 'Stromkirk Noble', 'Temple of Silence', 'Heartless Act'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 107.7, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (107.4 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Demonic Embrace', 'Abrade', 'Garruk Wildspeaker', 'Alesha, Who Smiles at Death', 'Odric, Lunarch Marshal', 'Blazing Shoal', 'Kiln Fiend', 'Heartless Act', 'Eater of Virtue', 'Llanowar Elves', 'Rootbound Crag', 'Zulaport Cutthroat', 'Eaten Alive', 'Memorial to War', 'See the Truth', 'Seething Song', 'Frantic Search', 'Moderation', 'Wrath of God', 'Reality Ripple', 'Gargoyle Castle', 'Fire-Lit Thicket', 'Nested Shambler', 'Goblin Bombardment', 'Chandra, Pyromaster', 'Viscera Seer', 'Gideon Jura', 'Tendrils of Agony', 'Izzet Charm', 'Jokulhaups', 'Phyrexian Dreadnought', 'Trickbind', 'Ghost Quarter', 'Oracle of Mul Daya', 'Brave the Elements', 'Orim''s Chant', 'Dispel', 'Akoum Battlesinger', 'Vapor Snag', 'Snow-Covered Swamp', 'Thraben Inspector', 'Cryptic Caves', 'Sign in Blood', 'Tymaret, Chosen from Death', 'Relic Seeker', 'Mishra''s Factory', 'The Mending of Dominaria', 'Complicate', 'Chain Lightning', 'Throne of Geth', 'Ajani Unyielding', 'Treasure Cruise', 'Pyretic Ritual', 'Hypnotic Specter', 'Essence Flux', 'Porphyry Nodes', 'Zabaz, the Glimmerwasp', 'Power Depot', 'Game Trail', 'Sylvan Advocate', 'Gatekeeper of Malakir', 'Explore', 'Moritte of the Frost', 'Hostage Taker', 'Raging Ravine', 'Summer Bloom', 'Hinterland Harbor', 'Dennick, Pious Apprentice', 'Temple of Mystery', 'Champion of the Parish', 'Buried Ruin', 'Hada Freeblade', 'Kopala, Warden of Waves', 'Soulherder', 'Mindslaver', 'Touch the Spirit Realm', 'Bloodbraid Elf', 'Mystifying Maze', 'Student of Warfare', 'Rishadan Dockhand', 'Raffine''s Informant', 'Mouth of Ronom', 'Signal Pest', 'Tithe Taker', 'Faithful Mending', 'Luminarch Ascension', 'Tectonic Giant', 'Arcbound Mouser', 'Reckoner''s Bargain', 'Ponder', 'Glimmerpost', 'Brain Freeze', 'Cloudcrest Lake', 'Abiding Grace', 'Mizzium Skin', 'Folio of Fancies', 'Cursecatcher', 'Ancestral Anger', 'Scorched Rusalka', 'Vengeful Strangler', 'Timely Reinforcements', 'Ramunap Excavator', 'Silverbluff Bridge', 'Dovin Baan', 'Crash Through', 'Oust', 'Westgate Regent', 'Arcbound Javelineer', 'Izzet Boilerworks', 'Dryad Militant', 'Bloodchief''s Thirst', 'Festival Crasher', 'Claim the Firstborn', 'Skyclave Cleric', 'Invoke Calamity', 'Dream Trawler', 'Wall of Omens', 'Coralhelm Commander', 'Hymn to Tourach', 'Radha, Heart of Keld', 'Drossforge Bridge', 'Mystic Snake', 'Secluded Courtyard', 'Kami of False Hope', 'Goblin Dark-Dwellers', 'Delver of Secrets', 'Mwonvuli Acid-Moss', 'Captain''s Claws', 'Arcbound Worker', 'Resurgent Belief', 'Psychic Possession', 'Remorseful Cleric', 'Dauntless Bodyguard', 'Pillage', 'Canyon Slough', 'Rule of Law', 'Inevitable Betrayal', 'Doomed Traveler', 'Solitary Confinement', 'Shardless Agent', 'Clifftop Retreat', 'Kabira Takedown', 'Vindicate', 'Infernal Grasp', 'Tide Shaper', 'Needle Spires', 'Maul of the Skyclaves', 'Midnight Reaper', 'Restoration Angel', 'Master of Death', 'Arcane Sanctum', 'Temple of Enlightenment', 'Nimble Larcenist', 'Iron Apprentice', 'Kaya, Ghost Assassin', 'Sleight of Hand', 'Snow-Covered Forest', 'Crackling Drake', 'Midnight Clock', 'Master of the Pearl Trident', 'Brimstone Dragon', 'Flame Slash', 'Spell Pierce', 'Outland Liberator', 'Dread Fugue', 'Weapons Trainer', 'Detention Sphere', 'Urza''s Factory', 'Secluded Steppe', 'Temur Charm', 'Putrid Goblin', 'Forbid', 'Brokers Hideout', 'Benevolent Bodyguard', 'Memory Lapse', 'Ranger of Eos', 'Condemn', 'Cleansing Wildfire', 'Raze the Effigy', 'Hunted Witness', 'Gruul Turf', 'Hanweir Garrison', 'Search Party Captain', 'Glorybringer', 'Judge''s Familiar', 'Watcher for Tomorrow', 'Patchwork Automaton', 'Selesnya Sanctuary', 'Thought Scour', 'Sylvan Scrying', 'Cultivate', 'Stone Rain', 'Dark Ritual', 'Dark-Dweller Oracle', 'Thoughtpicker Witch', 'Skyclave Shade', 'Battlefield Forge', 'Tidal Warrior', 'Mogg War Marshal', 'Mana Leak', 'Windbrisk Heights', 'Steel Overseer', 'Animation Module', 'Planar Bridge', 'Glacial Fortress', 'Razortide Bridge', 'Dragonskull Summit', 'Bedlam Reveler', 'Martyr of Sands', 'Kira, Great Glass-Spinner', 'Temple of Epiphany', 'Cathar Commando', 'Ethersworn Canonist', 'Nether Traitor', 'Swiftblade Vindicator', 'Honor of the Pure', 'Merrow Reejerey', 'Dread Presence', 'Reckless Charge', 'Abundant Harvest', 'Butcher Ghoul', 'Slip Out the Back', 'Stubborn Denial', 'Lose Focus', 'Slagwoods Bridge', 'Darigaaz Reincarnated', 'Ajani, the Greathearted', 'Bogardan Hellkite', 'Lonely Sandbar', 'Obscura Storefront', 'Benalish Marshal', 'Assault Strobe', 'Cartographer''s Survey', 'Haunted Fengraf', 'Runed Halo', 'Arcbound Ravager', 'Snow-Covered Mountain', 'Tempest Djinn', 'Elixir of Immortality', 'Gitaxian Probe', 'Judith, the Scourge Diva', 'Cloudpost', 'Dragonstorm', 'Obscura Charm', 'Tanglepool Bridge', 'Desperate Ritual', 'Animate Dead', 'Lumbering Falls', 'Vedalken Shackles', 'Mind''s Desire', 'Birds of Paradise', 'Arch of Orazca', 'Archaeomancer', 'Glen Elendra Archmage', 'Silvergill Adept', 'Rustvale Bridge', 'Unlucky Witness', 'Ancient Stirrings', 'Repeal', 'Kazandu Blademaster'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 107.4, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (171.1 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Elixir of Immortality', 'Nimble Trapfinder', 'Gatekeeper of Malakir', 'Nevinyrral''s Disk', 'Fatestitcher', 'Sandsteppe Citadel', 'Declaration in Stone', 'Doublecast', 'Urza''s Ruinous Blast', 'Timeless Witness', 'Contested War Zone', 'Urza''s Factory', 'Spellbook', 'Salvage Titan', 'Hissing Quagmire', 'Kjeldoran Outpost', 'Decree of Justice', 'Vedalken Shackles', 'Blazing Shoal', 'Signal Pest', 'Lashwrithe', 'Dual Strike', 'Bile Blight', 'Sisay, Weatherlight Captain', 'Faerie Miscreant', 'Vapor Snag', 'Chancellor of the Dross', 'Feed the Swarm', 'Llanowar Wastes', 'Dark Ritual', 'Steel Overseer', 'Field of Ruin', 'Healer of the Glade', 'Tooth of Chiss-Goria', 'Lose Focus', 'Nevermore', 'Goblin Trashmaster', 'Gilded Lotus', 'Sword of the Paruns', 'Flayer Husk', 'Wrath of God', 'Gadwick, the Wizened', 'Snowfield Sinkhole', 'Canyon Slough', 'Burst Lightning', 'Vindicate', 'Mishra''s Factory', 'Judge''s Familiar', 'Gilded Light', 'Cathar Commando', 'Archpriest of Iona', 'Porphyry Nodes', 'Seaside Citadel', 'Bone Saw', 'Demonic Rising', 'Network Disruptor', 'Goblin Bombardment', 'Purphoros''s Intervention', 'Undercity Informer', 'Balustrade Spy', 'Wayward Guide-Beast', 'Bow of Nylea', 'Invoke Calamity', 'Ruin Crab', 'Master of Etherium', 'Psychic Possession', 'Magmatic Insight', 'Scryb Ranger', 'Colossal Skyturtle', 'Cleansing Wildfire', 'Sylvan Primordial', 'Rustvale Bridge', 'Solitary Confinement', 'Outland Liberator', 'Goblin Bushwhacker', 'Shriekmaw', 'Phantasmagorian', 'Hypnotic Specter', 'Ajani Goldmane', 'Cathartic Reunion', 'Bontu''s Last Reckoning', 'Spawning Pool', 'Izzet Boilerworks', 'Yahenni''s Expertise', 'Grasp of Darkness', 'Tireless Provisioner', 'Mikaeus, the Lunarch', 'Hazoret''s Undying Fury', 'Birds of Paradise', 'Soul Spike', 'Detention Sphere', 'Read the Bones', 'Moonsnare Prototype', 'Wooded Bastion', 'Samurai of the Pale Curtain', 'Evolving Wilds', 'Aven Mindcensor', 'Valiant Rescuer', 'Oblivion Ring', 'Unburial Rites', 'Wing Shards', 'Animate Dead', 'Grenzo, Dungeon Warden', 'Shining Shoal', 'Forgotten Cave', 'Acolyte of Affliction', 'Invisible Stalker', 'Apex of Power', 'Shalai, Voice of Plenty', 'Skirk Prospector', 'Glacial Fortress', 'Locket of Yesterdays', 'Raging Ravine', 'Concerted Defense', 'Karmic Guide', 'Treasure Cruise', 'Midnight Clock', 'Spoils of Adventure', 'Bloodchief''s Thirst', 'Hamlet Vanguard', 'Dakmor Salvage', 'Conflux', 'Lightning Rift', 'Gauntlet of Power', 'Nim Deathmantle', 'Choking Sands', 'Spark Spray', 'Pelakka Predation', 'Tempest Djinn', 'Meloku the Clouded Mirror', 'Goblin Chieftain', 'Angel of Despair', 'Merfolk Secretkeeper', 'Lumbering Falls', 'Kazandu Mammoth', 'Terrarion', 'Dream Trawler', 'Smallpox', 'Grapeshot', 'Mirrormade', 'Sickening Shoal', 'Akroma''s Memorial', 'Blackbloom Rogue', 'Shigeki, Jukai Visionary', 'Laboratory Maniac', 'Yisan, the Wanderer Bard', 'Opt', 'Desperate Ritual', 'Treasure Map', 'Incandescent Soulstoke', 'Darksteel Relic', 'Commune with the Gods', 'Tectonic Reformation', 'Tocatli Honor Guard', 'Ornithopter', 'Everflowing Chalice', 'Temple of Epiphany', 'Drowned Secrets', 'Dragonskull Summit', 'Temple of Enlightenment', 'Hagra Mauling', 'Sunscour', 'Sparksmith', 'Murderous Redcap', 'Fraying Sanity', 'Lotleth Giant', 'Woodfall Primus', 'Snapback', 'Eternal Dragon', 'Thought Scour', 'Qasali Pridemage', 'Sphinx''s Tutelage', 'Luminarch Ascension', 'Oviya Pashiri, Sage Lifecrafter', 'Witching Well', 'Faerie Vandal', 'Jubilant Skybonder', 'Elvish Mystic', 'Dryad Militant', 'Jokulhaups', 'Hymn to Tourach', 'Hinterland Harbor', 'Timely Reinforcements', 'Thaumatic Compass', 'Grimdancer', 'Usher of the Fallen', 'Kaya, Ghost Assassin', 'Devastating Summons', 'Memory''s Journey', 'Cosmos Elixir', 'Spell Pierce', 'Deep Forest Hermit', 'Den Protector', 'Hypnotic Sprite', 'Secluded Steppe', 'Coiling Oracle', 'Goblin Ringleader', 'Goblin Matron', 'Master Transmuter', 'Chromatic Lantern', 'Angel of Sanctions', 'Arcum Dagsson', 'Approach of the Second Sun', 'Force of Rage', 'Wretched Banquet', 'Jace Beleren', 'Cloudcrest Lake', 'Barter in Blood', 'Mindslaver', 'Obstinate Baloth', 'Culling Scales', 'Condemn', 'Force of Despair', 'Farseek', 'Satyr Wayfinder', 'Putrid Goblin', 'Rampant Growth', 'Mogg War Marshal', 'Phyrexian Dreadnought', 'Goblin Wardriver', 'Chimeric Mass', 'Drannith Healer', 'Primal Surge', 'Jace, the Living Guildpact', 'Plumeveil', 'Zuran Orb', 'Archetype of Endurance', 'Tangled Florahedron', 'Undead Butler', 'Primal Beyond', 'Memory Lapse', 'Thopter Spy Network', 'Flourishing Fox', 'Brave the Elements', 'Zenith Flare', 'Reckless Impulse', 'Ethersworn Sphinx', 'Stirring Wildwood', 'Frantic Search', 'Magister of Worth', 'Creeping Trailblazer', 'Goblin Electromancer', 'Mind''s Desire', 'Haunted Plate Mail', 'Terramorphic Expanse', 'Myr Retriever', 'Zirda, the Dawnwaker', 'Dusk Legion Zealot', 'Sylvan Library', 'Elves of Deep Shadow', 'Favorable Winds', 'Tendrils of Agony', 'Lantern of the Lost', 'Runed Halo', 'Ponder', 'Countervailing Winds', 'Skyclave Relic', 'Shardless Agent', 'Goblin Cratermaker', 'Conqueror''s Galleon', 'Linvala, Shield of Sea Gate', 'Verdant Command', 'Elbrus, the Binding Blade', 'Tempered Steel', 'Thawing Glaciers', 'Barbarian Ring', 'Seething Song', 'Chitterspitter', 'Ghost Quarter', 'Kuldotha Rebirth', 'General''s Enforcer', 'Azami, Lady of Scrolls', 'Dread Fugue', 'Tidespout Tyrant', 'Chain Lightning', 'Gitaxian Probe', 'Grisly Salvage', 'Metalwork Colossus', 'Silverbluff Bridge', 'Ethersworn Canonist', 'Bolt Hound', 'Demigod of Revenge', 'Heartless Act', 'Seraph Sanctuary', 'Caves of Koilos', 'Hound of Griselbrand', 'Sea-Dasher Octopus', 'Mina and Denn, Wildborn', 'Saffi Eriksdotter', 'Curiosity', 'Grumgully, the Generous', 'Folio of Fancies', 'Dawn of Hope', 'Tajuru Paragon', 'Hushwing Gryff', 'Vampire Nighthawk', 'Sign in Blood', 'Snow-Covered Plains', 'Vivid Grove', 'Malakir Rebirth', 'Honor of the Pure', 'Skyclave Shade', 'Arcane Sanctum', 'Fire-Lit Thicket', 'Angel of Glory''s Rise', 'Claws of Gix', 'March of the Machines', 'Braids, Cabal Minion', 'Village Messenger', 'Panic Spellbomb', 'Diabolic Edict', 'Jack-o''-Lantern', 'March of Reckless Joy', 'Gideon Jura', 'Drannith Stinger', 'Reaper King', 'Arch of Orazca', 'Woodland Cemetery', 'Voltaic Key', 'Secluded Courtyard', 'Bone Shards', 'Homicidal Seclusion', 'Disruption Protocol', 'Consecrate // Consume', 'Orim''s Chant', 'Flamekin Bladewhirl', 'Mistveil Plains', 'Bala Ged Recovery', 'Brokers Hideout', 'Tymaret, Chosen from Death', 'Sleight of Hand', 'Dread Return', 'Rootbound Crag', 'Hornet Queen', 'Fieldmist Borderpost', 'Brushfire Elemental', 'Razortide Bridge', 'Pyretic Ritual'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 171.1, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (152.3 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Tribal Flames', 'Judge''s Familiar', 'Bygone Bishop', 'Double Vision', 'Stubborn Denial', 'Unburial Rites', 'Scryb Ranger', 'Obscura Storefront', 'Giant Killer', 'Ghost Quarter', 'Lotleth Troll', 'Basking Rootwalla', 'Doomed Necromancer', 'Rite of Oblivion', 'Soul''s Attendant', 'Dauntless Escort', 'Gonti, Lord of Luxury', 'Thawing Glaciers', 'Cathartic Pyre', 'Thassa''s Intervention', 'Sylvan Advocate', 'Hymn to Tourach', 'Nylea''s Presence', 'Deathgreeter', 'Tanglepool Bridge', 'Magister of Worth', 'Kaya, Ghost Assassin', 'Oviya Pashiri, Sage Lifecrafter', 'Silundi Vision', 'Spark Spray', 'Orzhov Signet', 'Viscera Seer', 'Obstinate Baloth', 'Wild Nacatl', 'Tombstalker', 'Drossforge Bridge', 'Pyroclasm', 'Razortide Bridge', 'Prophetic Prism', 'Glimmerpost', 'Dauntless Bodyguard', 'Isamaru, Hound of Konda', 'Canyon Slough', 'Tireless Provisioner', 'Honor of the Pure', 'Treasure Cruise', 'Buried Alive', 'Izzet Charm', 'Rally the Ancestors', 'Tempest Djinn', 'Korlash, Heir to Blackblade', 'Cathar Commando', 'Prophet of Kruphix', 'Lose Focus', 'Stern Dismissal', 'Jokulhaups', 'Reality Ripple', 'Heartless Act', 'Mina and Denn, Wildborn', 'Second Sunrise', 'Dryad Militant', 'Remorseful Cleric', 'Ponder', 'Zenith Flare', 'Temple of Enlightenment', 'Drannith Healer', 'Dread Fugue', 'Temple of Silence', 'Shardless Agent', 'Dread Presence', 'Mutilate', 'Forbid', 'Rabbit Battery', 'Touch the Spirit Realm', 'Cloudpost', 'Abiding Grace', 'Drannith Stinger', 'Shredded Sails', 'Uncage the Menagerie', 'Lich''s Mastery', 'Chain Lightning', 'Rise and Shine', 'Agonizing Remorse', 'Hour of Devastation', 'Whitemane Lion', 'Sign in Blood', 'Nezahal, Primal Tide', 'Marauding Blight-Priest', 'Read the Bones', 'Sanguine Bond', 'Pristine Talisman', 'Dark Ritual', 'Yisan, the Wanderer Bard', 'Radiant Scrollwielder', 'Raging Ravine', 'Slip Out the Back', 'First-Sphere Gargantua', 'Deep Analysis', 'Skirsdag High Priest', 'Beacon of Immortality', 'Flame Slash', 'Temple of Malady', 'Animate Dead', 'Urza''s Factory', 'Ethersworn Canonist', 'Gavony Township', 'Benevolent Bodyguard', 'Auramancer', 'Blade Splicer', 'Rotting Rats', 'Tainted Remedy', 'Jace, the Living Guildpact', 'Wall of Omens', 'Dizzy Spell', 'Vivid Grove', 'Etched Monstrosity', 'Soul Warden', 'Stromkirk Noble', 'Zulaport Cutthroat', 'Abrade', 'Kitchen Imp', 'Kjeldoran Outpost', 'Stirring Wildwood', 'Faithful Mending', 'Mizzium Mortars', 'Mission Briefing', 'Ranger of Eos', 'Thought Scour', 'Profane Procession', 'Big Game Hunter', 'Rites of Initiation', 'Bone Shards', 'Cosmos Elixir', 'Barbarian Ring', 'Terramorphic Expanse', 'Mana Leak', 'Goblin Dark-Dwellers', 'Drowned Catacomb', 'Shrapnel Blast', 'Asylum Visitor', 'Condemn', 'Signal Pest', 'Hanweir Battlements', 'Bloodbraid Elf', 'Archfiend of Sorrows', 'Forgotten Cave', 'Radiant Flames', 'Silverbluff Bridge', 'Slagwoods Bridge', 'Snowfield Sinkhole', 'Restoration Angel', 'Radha, Heart of Keld', 'Bond of Insight', 'Lochmere Serpent', 'Taborax, Hope''s Demise', 'Lightning Rift', 'Shalai, Voice of Plenty', 'Deprive', 'Llanowar Wastes', 'Champion of Wits', 'Kuldotha Rebirth', 'Declaration in Stone', 'Cleansing Wildfire', 'Heliod''s Pilgrim', 'Knight of the Reliquary', 'Phyrexian Dreadnought', 'Glacial Fortress', 'Trickbind', 'Tithe Taker', 'Armistice', 'Outland Liberator', 'Dead // Gone', 'Aven Mindcensor', 'Tyrant''s Scorn', 'Tectonic Reformation', 'Mishra''s Factory', 'Wooded Bastion', 'Scoured Barrens', 'Cabal Stronghold', 'Cut // Ribbons', 'Hanweir Garrison', 'Fire Covenant', 'Slagstorm', 'Bloodchief''s Thirst', 'Discovery // Dispersal', 'See the Truth', 'Experimental Overload', 'Battletide Alchemist', 'Vindicate', 'Chandra, Pyromaster', 'Elixir of Immortality', 'Rune-Scarred Demon', 'Fauna Shaman', 'Dream Trawler', 'Irencrag Pyromancer', 'Memory Lapse', 'Suture Priest', 'Mistveil Plains', 'Temple of Deceit', 'Flourishing Fox', 'Erebos''s Intervention', 'Frantic Search', 'Spirited Companion', 'Battle of Frost and Fire', 'Bastion of Remembrance', 'Voldaren Epicure', 'Birds of Paradise', 'Valiant Rescuer', 'Wrath of God', 'Thraben Inspector', 'Pieces of the Puzzle', 'Farseek', 'Hell Mongrel', 'Delver of Secrets', 'Infernal Grasp', 'Secluded Steppe', 'Blood for Bones', 'Mangara of Corondor', 'Sisay, Weatherlight Captain', 'Caves of Koilos', 'Goblin Bushwhacker', 'Counterflux', 'Woodland Cemetery', 'Ornithopter', 'Maestros Charm', 'Ethersworn Sphinx', 'Gitaxian Probe', 'Rocco, Cabaretti Caterer', 'Skyclave Cleric', 'Relic Vial', 'Experimental Synthesizer', 'Fact or Fiction', 'Sleight of Hand', 'Grave Scrabbler', 'Mistvault Bridge', 'Saffi Eriksdotter', 'Battlefield Forge', 'Liliana Vess', 'Mizzium Skin'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 152.3, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (102.9 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Dread Presence', 'Vivid Grove', 'Jack-o''-Lantern', 'Suture Priest', 'Inevitable Betrayal', 'Ajani''s Pridemate', 'Temple of Plenty', 'Mangara of Corondor', 'Fblthp, the Lost', 'Needle Spires', 'Tide Shaper', 'Silundi Vision', 'Inscription of Insight', 'Dakmor Salvage', 'Scoured Barrens', 'Lys Alana Huntmaster', 'Inspiring Overseer', 'Hieroglyphic Illumination', 'Chain of Plasma', 'Watcher for Tomorrow', 'Kunoros, Hound of Athreos', 'Canyon Slough', 'Okiba Reckoner Raid', 'Zurgo Bellstriker', 'Triskelion', 'Behold the Multiverse', 'Faerie Vandal', 'Beast Whisperer', 'Rustvale Bridge', 'Old Stickfingers', 'Demonic Embrace', 'Demigod of Revenge', 'Coralhelm Commander', 'Hagra Mauling', 'Timeless Witness', 'Desperate Ritual', 'Midnight Clock', 'Ravenous Chupacabra', 'Gilded Light', 'Secluded Steppe', 'Conflagrate', 'Oblivion Ring', 'Krark''s Thumb', 'Lumbering Falls', 'Kambal, Consul of Allocation', 'Zulaport Cutthroat', 'Seasons Past', 'Benevolent Bodyguard', 'Thousand-Faced Shadow', 'Fiery Impulse', 'Pack Rat', 'Jorubai Murk Lurker', 'Soul''s Attendant', 'Rune-Scarred Demon', 'Llanowar Elves', 'Arcane Sanctum', 'Deep Forest Hermit', 'Mistvault Bridge', 'Phylactery Lich', 'Deathbonnet Sprout', 'Lightning Angel', 'Karn''s Temporal Sundering', 'Mystic Monastery', 'Rift Sower', 'Stormblood Berserker', 'Commit // Memory', 'Sedraxis Specter', 'Halimar Excavator', 'Artful Dodge', 'Upheaval', 'Dispel', 'Temple of Enlightenment', 'Reclusive Taxidermist', 'Arch of Orazca', 'Unexpected Results', 'Ondu Cleric', 'Temple of Epiphany', 'Dream Trawler', 'Rishadan Dockhand', 'Lotleth Troll', 'Obliterate', 'Ghost Quarter', 'Bloodbraid Marauder', 'Merrow Reejerey', 'Lodestone Golem', 'Gonti, Lord of Luxury', 'Jace, Memory Adept', 'Judith, the Scourge Diva', 'Putrid Imp', 'Firebrand Archer', 'Garruk Wildspeaker', 'Mobilized District', 'Myr Battlesphere', 'Ob Nixilis, the Fallen', 'General Ferrous Rokiric', 'Gryff''s Boon', 'Falkenrath Noble', 'Ajani Unyielding', 'Eternal Dragon', 'Hypnotic Specter', 'Kumano Faces Kakkazan', 'Kabira Takedown', 'Qasali Pridemage', 'An Offer You Can''t Refuse', 'Lutri, the Spellchaser', 'Hunted Dragon', 'Falkenrath Aristocrat', 'Spell Pierce', 'Champion of Wits', 'Avacyn''s Pilgrim', 'Restoration Angel', 'Sign in Blood', 'Lashwrithe', 'Thawing Glaciers', 'Rabbit Battery', 'Orzhov Basilica', 'Archaeomancer', 'Spirited Companion', 'Snow-Covered Swamp', 'Goblin Electromancer', 'Yahenni, Undying Partisan', 'Gladecover Scout', 'Urza''s Factory', 'Shaile, Dean of Radiance', 'Falkenrath Pit Fighter', 'Selesnya Sanctuary', 'Asmodeus the Archfiend', 'Shigeki, Jukai Visionary', 'Tavern Scoundrel', 'Raze the Effigy', 'Infernal Grasp', 'Snowfield Sinkhole', 'Desperate Ravings', 'Pelakka Predation', 'Gaze of Granite', 'Skirge Familiar', 'Aegis of the Gods', 'Bontu''s Last Reckoning', 'Brokers Hideout', 'Angel of Despair', 'Burning Inquiry', 'Azami, Lady of Scrolls', 'Rally the Ancestors', 'Barbarian Ring', 'Boneyard Wurm', 'Ollenbock Escort', 'Icehide Golem', 'Goldmire Bridge', 'Cabal Therapist', 'Thaumatic Compass', 'Austere Command', 'Immortal Servitude', 'Stone Rain', 'Sylvan Anthem', 'Ral Zarek', 'Heliod''s Pilgrim', 'Think Twice', 'Archfiend''s Vessel', 'Tanglepool Bridge', 'Oracle of Mul Daya', 'Abbot of Keral Keep', 'Skylasher', 'Slagstorm', 'Riftwing Cloudskate', 'Raffine''s Guidance', 'Razortide Bridge', 'Radha, Heart of Keld', 'Silent Submersible', 'Grim Lavamancer', 'Runed Halo', 'Teferi, Mage of Zhalfir', 'Lavaclaw Reaches', 'Renewed Faith', 'Dire Tactics', 'Decree of Justice', 'Glorybringer', 'Mystical Teachings', 'Crumbling Necropolis', 'Codie, Vociferous Codex', 'First-Sphere Gargantua', 'Invoke Calamity', 'Stirring Wildwood', 'Ethersworn Sphinx', 'Soul Warden', 'Butcher Ghoul', 'Fatestitcher', 'Temple of Silence', 'Dowsing Dagger', 'Fact or Fiction', 'Putrid Goblin', 'Season of Growth', 'Distended Mindbender', 'Gargoyle Castle', 'Kessig Flamebreather', 'Akroma''s Memorial', 'Tranquil Cove', 'Golgari Brownscale', 'Snow-Covered Forest', 'Ghoultree', 'Opt', 'Phyrexian Dreadnought', 'Snow-Covered Mountain', 'Mantis Rider', 'Warleader''s Helix', 'Honor of the Pure', 'Tidespout Tyrant', 'Witch''s Cottage', 'Bloodsky Berserker', 'Witching Well', 'Buried Alive', 'Curiosity', 'Duskwielder', 'Ghostly Flicker', 'Mwonvuli Acid-Moss', 'Mercy Killing', 'Wrath of God', 'Blade Splicer', 'Foreboding Ruins', 'Tyrant of Discord', 'Flame Slash', 'Corrupt Court Official', 'Reveillark', 'Viscera Seer', 'Ancestral Anger', 'Dragonsguard Elite', 'Reckless Rage', 'Spirit Bonds', 'Bala Ged Recovery', 'Battlefield Forge', 'Chain Lightning', 'Primal Command', 'Kolaghan, the Storm''s Fury', 'Venerable Warsinger', 'Cathar Commando', 'Heartless Act', 'Ally Encampment', 'Grand Arbiter Augustin IV', 'Oath of Teferi', 'Dark Impostor', 'Stubborn Denial', 'Outland Liberator', 'Drossforge Bridge', 'Experimental Overload', 'Marwyn, the Nurturer', 'Secluded Courtyard', 'Legacy Weapon', 'Migration Path', 'Mirari', 'Mist-Syndicate Naga', 'Colossal Skyturtle', 'Orim''s Chant', 'Thraben Inspector', 'Ambitious Farmhand', 'Merfolk Mistbinder', 'Prophet of Kruphix', 'Chandra''s Phoenix', 'Ghostly Pilferer', 'Elvish Archdruid', 'Tempest Djinn', 'Explore', 'Heartless Summoning', 'Panharmonicon', 'Nivmagus Elemental', 'Arc Trail', 'Champion of the Parish', 'Hanweir Garrison', 'Alesha, Who Smiles at Death', 'Commune with the Gods', 'Stinkdrinker Bandit', 'Dennick, Pious Apprentice', 'Mystifying Maze', 'Ranger of Eos', 'Earthshaker Khenra', 'Silver-Fur Master', 'Dryad''s Revival', 'Wrench Mind', 'Unburial Rites', 'Expansion // Explosion', 'Rishkar''s Expertise', 'Crumbling Vestige', 'Slaughter Pact', 'Memory Lapse', 'Wasteland Strangler', 'Cruel Ultimatum', 'Westvale Abbey', 'Daxos of Meletis', 'Supernatural Stamina', 'Azorius Charm', 'Savage Lands', 'Far // Away', 'Izzet Guildgate', 'Magister of Worth', 'Prophetic Prism', 'Lonely Sandbar', 'Demonic Dread', 'Syncopate', 'Day of Judgment', 'Starstorm', 'Thorn Mammoth', 'Sarkhan the Masterless', 'Ancient Stirrings', 'Ram Through', 'Wooded Bastion', 'Tendo Ice Bridge', 'Tribute Mage', 'Vitu-Ghazi, the City-Tree', 'Serrated Scorpion', 'Shardless Agent', 'Ogre-Head Helm', 'Fog', 'Ash Zealot', 'Sylvan Library', 'Darkmoss Bridge', 'Chance Encounter', 'Rootbound Crag', 'Sorin Markov', 'Holy Strength', 'Orzhov Charm', 'Angel of Glory''s Rise', 'Elite Guardmage', 'Crackling Drake', 'Oath of Jace', 'Aetherspouts', 'Clackbridge Troll', 'Cosmos Elixir', 'Stromkirk Noble', 'Training Grounds', 'Korlash, Heir to Blackblade', 'Izzet Charm', 'Realm Razer', 'Commune with Spirits', 'Cathartic Pyre', 'Exhaustion', 'Coalition Relic', 'The Raven''s Warning', 'Abrade', 'Blood Seeker', 'Duskwatch Recruiter', 'Umara Wizard', 'Terramorphic Expanse', 'Sleight of Hand', 'Merfolk Windrobber', 'Vapor Snag', 'Nissa, Worldwaker', 'Mistblade Shinobi', 'Changeling Outcast', 'Kalastria Healer', 'Samurai of the Pale Curtain', 'Response // Resurgence', 'Repeal', 'Bladestitched Skaab', 'Sejiri Shelter', 'Final Parting', 'Haven of the Spirit Dragon', 'Blightning', 'Sea Gate Wreckage', 'Tracker''s Instincts', 'Hour of Promise', 'Predator Ooze', 'Malakir Rebirth', 'Cursecatcher', 'Hellrider', 'Phantasmagorian', 'Smallpox', 'Obscura Storefront', 'Chromatic Lantern', 'Reckless Impulse', 'Grimdancer', 'Gilded Lotus', 'Summer Bloom', 'Mind''s Desire', 'Soulherder', 'Vindicate', 'Dread Fugue', 'Gideon Jura', 'See the Truth', 'Voldaren Epicure', 'Illuminator Virtuoso', 'Satyr Hoplite', 'Viashino Pyromancer', 'Zhalfirin Void', 'Liliana Vess', 'Pyretic Ritual', 'Saw It Coming', 'Evolving Wilds', 'Scab-Clan Berserker', 'Stinkweed Imp', 'Barrenton Medic', 'Pillage', 'End-Raze Forerunners', 'Maul of the Skyclaves', 'Memorial to War', 'Big Score', 'Taigam''s Scheming', 'Firebolt', 'Cathartic Reunion', 'Skaab Ruinator', 'Stampede Driver', 'Barkhide Troll', 'Spider Umbra', 'Temple of Malady', 'Ondu Inversion', 'Carnophage', 'Bramblewood Paragon', 'Trostani''s Summoner', 'Chandra, Pyromaster', 'Big Game Hunter', 'Morselhoarder', 'Growth-Chamber Guardian', 'Ezuri, Renegade Leader', 'Mistcutter Hydra', 'Kardur, Doomscourge', 'Incinerate', 'Ravenous Squirrel', 'Tendrils of Agony', 'Dark Ritual', 'Jokulhaups', 'The Bloodsky Massacre', 'Seal of Removal', 'Awakening of Vitu-Ghazi', 'Cartographer''s Survey', 'Nivix Cyclops', 'Balustrade Spy', 'Wharf Infiltrator', 'Lord of the Undead', 'Festival Crasher', 'Talisman of Resilience', 'Archetype of Endurance', 'Pristine Talisman', 'Wonder', 'Kitchen Imp', 'Jace, the Living Guildpact', 'Mana Leak', 'Tarfire', 'Centaur Garden', 'Ponder', 'Falkenrath Gorger', 'Bloodbraid Elf', 'Sacred Cat', 'Prowling Serpopard', 'Bone Shards', 'Fanatical Firebrand', 'Sylvan Scrying', 'Student of Warfare', 'Jwari Shapeshifter', 'Fyndhorn Elves', 'Fire Covenant', 'Hornet Queen', 'Viscera Dragger', 'Honored Hydra', 'Zof Consumption', 'Counterflux', 'Mephidross Vampire', 'Thirst for Discovery', 'Imperious Perfect', 'Spikefield Hazard', 'Bloodchief''s Thirst', 'Cosima, God of the Voyage', 'Wall of Omens', 'Spirit Mantle', 'Splinterfright', 'Glimpse of Tomorrow', 'Woodland Cemetery', 'Glimmerpost', 'Ingenious Infiltrator', 'Brave the Elements', 'Duress', 'Brain Freeze', 'Birds of Paradise', 'Nezahal, Primal Tide', 'Lose Focus', 'Lich''s Mastery', 'Touch the Spirit Realm', 'Diregraf Colossus', 'Azusa''s Many Journeys', 'Kuldotha Forgemaster', 'Universal Automaton', 'Forked Bolt', 'Detention Sphere', 'Vault of the Archangel', 'Rakdos Cackler', 'Treasure Cruise', 'Animate Dead', 'Angel of Sanctions', 'Glacial Fortress', 'Judge''s Familiar', 'Faithful Mending', 'Elvish Mystic', 'Tidal Warrior', 'Nether Traitor', 'Vampire Opportunist', 'Legion''s Initiative', 'Kjeldoran Outpost', 'Kaya, Ghost Assassin', 'Illness in the Ranks', 'Sin Prodder', 'Terastodon', 'Cloudpost', 'Stitch in Time', 'Silverbluff Bridge', 'Riveteers Charm', 'Talisman of Impulse', 'Sanguine Bond', 'Sprite Dragon', 'Auramancer', 'Laboratory Maniac', 'Temur Charm', 'Murkfiend Liege', 'The Mending of Dominaria', 'Talisman of Conviction', 'Skyclave Shade', 'Hinterland Harbor', 'Primal Surge', 'Giant Killer', 'Haunted Dead', 'Contingency Plan', 'Undercity Informer', 'Stern Dismissal', 'Balefire Liege', 'Blacklance Paragon', 'Grave Scrabbler', 'Crypt of Agadeem', 'Blackbloom Rogue', 'Ranger''s Guile', 'Sylvan Advocate', 'Ajani Goldmane', 'Tireless Provisioner', 'Goblin Dark-Dwellers', 'Nimble Mongoose', 'Mishra''s Factory', 'Gatekeeper of Malakir', 'Fiend Hunter', 'Ecstatic Awakener', 'Dread Return', 'Oust', 'Llanowar Tribe', 'Rotting Rats', 'Lava Dart', 'Trespasser''s Curse', 'Erebos''s Intervention', 'Thunderbreak Regent', 'Seismic Assault', 'Wastes', 'Master of the Pearl Trident', 'Ethersworn Canonist', 'Cerodon Yearling', 'Reckoner''s Bargain', 'Nested Shambler', 'Biting-Palm Ninja', 'Bedevil', 'Sygg, River Cutthroat', 'Soaring Thought-Thief', 'Tymaret, Chosen from Death', 'Clifftop Retreat', 'Sandsteppe Citadel', 'Mutilate', 'Biomancer''s Familiar', 'Dimir Guildmage', 'Elvish Visionary', 'Regal Force', 'Fire-Lit Thicket', 'Mouth of Ronom', 'Asceticism', 'Abiding Grace', 'Rishkar, Peema Renegade', 'Slaughter Specialist', 'Skemfar Avenger', 'Grisly Salvage', 'Joraga Warcaller', 'Frantic Search', 'Coiling Oracle', 'Deep Analysis', 'Game Trail', 'Negate', 'Dusk Legion Zealot', 'Tooth and Nail', 'Cabal Stronghold', 'Dovin Baan', 'Hissing Quagmire', 'Tajic, Legion''s Edge', 'Strike It Rich', 'Mausoleum Secrets', 'Abundant Harvest', 'Gitaxian Probe', 'Beyeen Veil', 'Hymn to Tourach', 'Retreat to Hagra', 'Kargan Intimidator', 'Tribute to Horobi', 'Wavesifter', 'Caves of Koilos', 'Tectonic Giant', 'Acidic Slime', 'Exclude', 'Lochmere Serpent', 'Yahenni''s Expertise', 'Drowned Catacomb', 'Slip Out the Back', 'Dawn of Hope', 'It That Betrays', 'Braid of Fire', 'Lightning Strike', 'Glen Elendra Archmage', 'Zealous Persecution', 'Flood Plain', 'Hypnotic Grifter', 'Elixir of Immortality', 'Ornithopter', 'Eater of Virtue', 'Benthic Biomancer', 'Grapeshot', 'Nevermaker', 'Kiln Fiend', 'Pandemonium', 'Khalni Ambush', 'Myr Incubator', 'Goblin Bombardment', 'Beloved Princess', 'Jackal Pup', 'Sorin''s Vengeance', 'Unholy Heat', 'Circular Logic', 'Temple of Deceit', 'Grasp of Darkness', 'Ground Rift', 'Master of Death', 'Seething Song', 'Diregraf Captain', 'Jace Beleren', 'Kopala, Warden of Waves', 'Wilt-Leaf Liege', 'Into the Roil', 'Crash Through', 'Incendiary Flow', 'Swans of Bryn Argoll', 'Alpha Authority', 'Homestead Courage', 'Favored Hoplite', 'Improbable Alliance', 'Dizzy Spell', 'Forbid', 'Maestros Theater', 'Reality Ripple', 'Mirari''s Wake', 'Basking Rootwalla', 'Hero of Precinct One', 'Blacksmith''s Skill', 'Ethereal Armor', 'Moon-Circuit Hacker', 'Trickbind', 'Riveteers Overlook', 'Vivid Creek', 'Dimir Charm', 'Lazotep Reaver', 'Ghitu Lavarunner', 'Frontier Bivouac', 'Raging Ravine', 'Feed the Swarm', 'Karmic Guide', 'Midnight Reaper', 'Skyclave Cleric', 'Invigorate', 'Field of Ruin', 'Obstinate Baloth', 'Firedrinker Satyr', 'Temple of Mystery', 'Conclave Tribunal', 'Fauna Shaman', 'Thought Scour', 'Loxodon Smiter', 'Swiftblade Vindicator', 'Satyr Wayfinder', 'Joraga Treespeaker', 'Arcane Infusion', 'Orzhov Signet', 'Jwari Disruption', 'Walk the Aeons', 'Mythos of Illuna', 'Essence Flux', 'Eerie Interlude', 'Llanowar Wastes', 'Fallen Shinobi', 'Worldgorger Dragon', 'Commence the Endgame', 'Molten Birth', 'Braids, Cabal Minion', 'Platinum Angel', 'Search for Tomorrow', 'Pain Seer', 'Firespout', 'Thornglint Bridge', 'Forgotten Cave', 'Norin the Wary', 'Selesnya Charm', 'Mindlink Mech', 'Condemn', 'Sky Terror', 'Golgari Grave-Troll', 'Necrotic Ooze', 'Burst Lightning', 'Swiftwater Cliffs', 'Porcelain Legionnaire', 'Village Messenger', 'Skyblade''s Boon', 'Figure of Destiny', 'Taurean Mauler', 'Eiganjo Uprising', 'Searing Spear', 'Diregraf Ghoul', 'Fiery Gambit', 'Phoenix of Ash', 'Scion of Oona', 'Gavony Township', 'Dragonskull Summit', 'Mystic Snake', 'Dokuchi Silencer', 'Vesperlark', 'Izzet Boilerworks', 'Dead // Gone', 'Asylum Visitor', 'Lead the Stampede', 'Cleansing Wildfire', 'Archfiend of Sorrows', 'Draconic Roar', 'Quest for Pure Flame', 'Lantern of the Lost', 'Slagwoods Bridge', 'Dwynen''s Elite', 'The Birth of Meletis', 'Entomber Exarch', 'Dryad Militant', 'Choking Sands', 'Silvergill Adept', 'Phalanx Leader', 'Future Sight', 'Delver of Secrets', 'Fling', 'Worship', 'Prosperous Thief', 'Elves of Deep Shadow', 'Fading Hope', 'Meteor Golem', 'Malakir Blood-Priest', 'Hapless Researcher'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 102.9, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (109.0 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Llanowar Elves', 'Joraga Treespeaker', 'Boneyard Wurm', 'Thought Scour', 'Teferi, Mage of Zhalfir', 'Garruk Wildspeaker', 'Wrath of God', 'Wall of Omens', 'Tireless Provisioner', 'Halimar Excavator', 'Orzhov Basilica', 'Ethersworn Canonist', 'Primal Command', 'Underworld Connections', 'Mystical Teachings', 'Burst Lightning', 'Hissing Quagmire', 'Deathbonnet Sprout', 'Cleansing Wildfire', 'Rule of Law', 'Shrapnel Blast', 'Primal Surge', 'Corrupt Court Official', 'Abundant Harvest', 'Reveillark', 'Fyndhorn Elves', 'Bala Ged Recovery', 'Chandra, Pyromaster', 'Mogg War Marshal', 'Shriekmaw', 'Resurgent Belief', 'Repeal', 'Jewel Thief', 'Tidal Warrior', 'Improbable Alliance', 'Daxos of Meletis', 'Guardian Gladewalker', 'Cystbearer', 'Pack Rat', 'Jace, the Living Guildpact', 'Drownyard Temple', 'Spirit Mantle', 'Perilous Research', 'Hunted Dragon', 'Tendo Ice Bridge', 'Urza''s Factory', 'Scab-Clan Berserker', 'Mercy Killing', 'Immortal Servitude', 'Desperate Ravings', 'Bastion of Remembrance', 'Fiery Gambit', 'Gilded Lotus', 'Walk the Aeons', 'Hymn to Tourach', 'Oracle of Mul Daya', 'Elvish Archdruid', 'Sleight of Hand', 'Barbarian Ring', 'Honored Hydra', 'Undercity Informer', 'Lone Missionary', 'Lyzolda, the Blood Witch', 'Migration Path', 'Dimir Guildmage', 'Tavern Scoundrel', 'Electric Revelation', 'Bramblewood Paragon', 'Unpredictable Cyclone', 'Moderation', 'Mirari''s Wake', 'Secluded Courtyard', 'Broodmate Dragon', 'Cartographer''s Survey', 'Shambling Shell', 'Oread of Mountain''s Blaze', 'Might of Old Krosa', 'Jinxed Idol', 'Stitch in Time', 'Rishadan Dockhand', 'Mirrorpool', 'Tajic, Legion''s Edge', 'Benthic Biomancer', 'Mikokoro, Center of the Sea', 'Form of the Dragon', 'Flame Javelin', 'Master of the Pearl Trident', 'Satyr Hoplite', 'Demigod of Revenge', 'Gilded Light', 'Become Immense', 'Vesperlark', 'Glimpse of Tomorrow', 'Archfiend of Sorrows', 'Dire Tactics', 'Trail of Evidence', 'Inspiring Overseer', 'Ally Encampment', 'Faithful Mending', 'Selesnya Charm', 'Leyline of Anticipation', 'Lumbering Falls', 'Enduring Ideal', 'Reckless Waif', 'Slip Out the Back', 'Voldaren Epicure', 'Ajani''s Chosen', 'Elvish Visionary', 'Oblivion Ring', 'Nether Traitor', 'Arguel''s Blood Fast', 'Gladecover Scout', 'Ajani Unyielding', 'Master of Death', 'Vault Skirge', 'Rakdos Charm', 'Braid of Fire', 'Nihilith', 'Falkenrath Pit Fighter', 'Riveteers Charm', 'Kami of False Hope', 'Mirrodin''s Core', 'Laboratory Maniac', 'Howling Mine', 'Hagra Mauling', 'Bloodbraid Elf', 'Jwari Shapeshifter', 'Mistveil Plains', 'Goblin Dark-Dwellers', 'Expedition Envoy', 'Thornglint Bridge', 'Suture Priest', 'Illness in the Ranks', 'Dowsing Dagger', 'Commit // Memory', 'Archaeomancer', 'Arcbound Mouser', 'Biomancer''s Familiar', 'Shadow of the Grave', 'Ghoultree', 'Serrated Scorpion', 'Drannith Stinger', 'Necropede', 'Grisly Salvage', 'Chromatic Lantern', 'Choking Sands', 'Goblin Bombardment', 'Temple of Malady', 'Avatar of Discord', 'Haunted Dead', 'Ransack the Lab', 'Nested Shambler', 'Steel Hellkite', 'Sandsteppe Citadel', 'Kjeldoran Outpost', 'Nissa, Worldwaker', 'Terramorphic Expanse', 'Oath of Teferi', 'General Ferrous Rokiric', 'Gryff''s Boon', 'Void Beckoner', 'Reckoner''s Bargain', 'Season of Growth', 'Eater of Virtue', 'Animate Dead', 'Faith''s Fetters', 'Elves of Deep Shadow', 'Thawing Glaciers', 'Trespasser''s Curse', 'Skaab Ruinator', 'Fieldmist Borderpost', 'Unburial Rites', 'Experimental Overload', 'Arcane Sanctum', 'Ignite Memories', 'Contingency Plan', 'Meteor Golem', 'Stampede Driver', 'Stern Dismissal', 'Ugin''s Conjurant', 'Raven''s Crime', 'Jaya Ballard', 'Bojuka Brigand', 'War-Name Aspirant', 'Vitu-Ghazi, the City-Tree', 'Gitaxian Probe', 'Psychic Possession', 'Village Messenger', 'Touch the Spirit Realm', 'Renewed Faith', 'Asylum Visitor', 'Swiftwater Cliffs', 'Oath of Jace', 'Terastodon', 'Arcbound Overseer', 'Kumano Faces Kakkazan', 'Discovery // Dispersal', 'Awakening of Vitu-Ghazi', 'Fiery Temper', 'Tergrid''s Shadow', 'Anax, Hardened in the Forge', 'Wonder', 'Taigam''s Scheming', 'Phylactery Lich', 'Tendrils of Agony', 'Duskwatch Recruiter', 'Riveteers Overlook', 'Centaur Garden', 'Hypnotic Specter', 'Thaumatic Compass', 'Foreboding Ruins', 'Vampire Nighthawk', 'Westgate Regent', 'Vivid Creek', 'Mistcutter Hydra', 'Venerable Warsinger', 'Izzet Guildgate', 'Sign in Blood', 'Nimble Mongoose', 'Orzhov Charm', 'Clifftop Retreat', 'Bosh, Iron Golem', 'Firebolt', 'Akki War Paint', 'Training Grounds', 'Ashenmoor Liege', 'Demonic Dread', 'Lava Dart', 'Drossforge Bridge', 'Akoum Battlesinger', 'Blade Splicer', 'Lich''s Mastery', 'Rune-Scarred Demon', 'The Underworld Cookbook', 'Kazandu Blademaster', 'Fading Hope', 'Seasons Past', 'Death Pulse', 'Brokers Hideout', 'Sol Talisman', 'Jokulhaups', 'Vindicate', 'Bone Shards', 'Oni-Cult Anvil', 'Mana Leak', 'Rakdos Cackler', 'Logic Knot', 'Cloudsteel Kirin', 'Dangerous Wager', 'Gideon Jura', 'Spider Umbra', 'Lutri, the Spellchaser', 'Dictate of Kruphix', 'Glint Hawk', 'Judge''s Familiar', 'Colossal Might', 'Nevermore', 'Murkfiend Liege', 'Balefire Liege', 'Behold the Multiverse', 'Flametongue Kavu', 'Golgari Grave-Troll', 'Divinity of Pride', 'Blighted Agent', 'Birds of Paradise', 'Hungering Hydra', 'Debt to the Kami', 'Forgotten Cave', 'Desperate Ritual', 'Hinterland Harbor', 'Leyline of Vitality', 'Big Game Hunter', 'Tamiyo''s Safekeeping', 'Nezahal, Primal Tide', 'Arcbound Whelp', 'Haven of the Spirit Dragon', 'Regal Force', 'Dokuchi Silencer', 'Sarkhan the Mad', 'Elixir of Immortality', 'Lantern Scout', 'Golgari Signet', 'Sephara, Sky''s Blade', 'Hapless Researcher', 'Mass Hysteria', 'Arcbound Tracker', 'Snowfield Sinkhole', 'Thirst for Discovery', 'Angel of Glory''s Rise', 'Pyretic Ritual', 'Awakening Zone', 'Spikefield Hazard', 'Ghitu Lavarunner', 'Infernal Grasp', 'Big Score', 'Incinerate', 'Mirrorshell Crab', 'Sorin Markov', 'Larger Than Life', 'Aegis of the Gods', 'Cosima, God of the Voyage', 'Lantern of the Lost', 'Midnight Reaper', 'Memory Lapse', 'Draconic Roar', 'Glimmerpost', 'Chain of Plasma', 'Grapeshot', 'Go for the Throat', 'Marwyn, the Nurturer', 'Grimdancer', 'Clackbridge Troll', 'Fallen Shinobi', 'Kaya, Ghost Assassin', 'Circular Logic', 'Feed the Swarm', 'Chance Encounter', 'Ral, Storm Conduit', 'Pathrazer of Ulamog', 'Hushwing Gryff', 'Arcbound Worker', 'Oust', 'Commence the Endgame', 'Taurean Mauler', 'Archfiend''s Vessel', 'Krosan Grip', 'Jorubai Murk Lurker', 'Arcbound Lancer', 'Fling', 'Fog', 'Rally the Ancestors', 'Distortion Strike', 'Brood Birthing', 'Seaside Citadel', 'Greater Gargadon', 'Cosmos Elixir', 'Raid Bombardment', 'Wren''s Run Hydra', 'Silver-Fur Master', 'Elvish Mystic', 'Invoke Calamity', 'Raise the Alarm', 'Avacyn''s Pilgrim', 'Marauding Blight-Priest', 'Boros Reckoner', 'Fblthp, the Lost', 'Cloudcrest Lake', 'Firemantle Mage', 'Flame-Blessed Bolt', 'Alms of the Vein', 'Revitalize', 'Fire Prophecy', 'Kalastria Healer', 'Evolving Wilds', 'Dovescape', 'Kuldotha Forgemaster', 'Skyclave Cleric', 'Butcher Ghoul', 'Supernatural Stamina', 'Strike It Rich', 'Aetherspouts', 'Timely Reinforcements', 'Expansion // Explosion', 'Breya''s Apprentice', 'Dispel', 'Grave Scrabbler', 'Wildfield Borderpost', 'Silent Submersible', 'Unsubstantiate', 'Counterflux', 'Thousand-Faced Shadow', 'Tranquil Thicket', 'Mythos of Illuna', 'Obscura Storefront', 'Search for Tomorrow', 'Lead the Stampede', 'Slaughter Specialist', 'Pandemonium', 'Wastes', 'Rotting Rats', 'Sangrophage', 'Caves of Koilos', 'Treasure Cruise', 'Sejiri Shelter', 'Fire-Lit Thicket', 'Okiba Reckoner Raid', 'Animation Module', 'Abzan Ascendancy', 'Dread Return', 'Snow-Covered Swamp', 'Alchemist''s Refuge', 'Eye of Vecna', 'Luminarch Ascension', 'Dark Impostor', 'Azami, Lady of Scrolls', 'Sprite Dragon', 'Inevitable Betrayal', 'Possibility Storm', 'Pieces of the Puzzle', 'Phyrexian Dreadnought', 'Jack-o''-Lantern', 'Think Twice', 'Folio of Fancies', 'Ultimate Price', 'Orzhov Signet', 'Gray Merchant of Asphodel', 'Explore', 'Goldmire Bridge', 'Yidaro, Wandering Monster', 'Young Necromancer', 'Deep Analysis', 'Razortide Bridge', 'Bad River', 'Seismic Assault', 'Zulaport Cutthroat', 'Mutilate', 'Lashwrithe', 'Obliterate', 'Hornet Queen', 'First-Sphere Gargantua', 'Korlash, Heir to Blackblade', 'Fires of Yavimaya', 'Silundi Vision', 'Lochmere Serpent', 'Sea Gate Oracle', 'Syncopate', 'Lys Alana Huntmaster', 'Dragonskull Summit', 'Outland Liberator', 'Blacksmith''s Skill', 'Power Depot', 'Midnight Clock', 'Kitchen Imp', 'Voltage Surge', 'Spell Pierce', 'Broodwarden', 'Canyon Slough', 'Viscera Seer', 'Stubborn Denial', 'Ondu Cleric', 'Reclusive Taxidermist', 'Weathered Wayfarer', 'Student of Warfare', 'Llanowar Wastes', 'Sygg, River Cutthroat', 'Splicer''s Skill', 'Mangara of Corondor', 'Detention Sphere', 'Blight Mamba', 'Fireblade Artist', 'Rustvale Bridge', 'Tempered Steel', 'Selesnya Sanctuary', 'Rakdos Headliner', 'Ghastlord of Fugue', 'Endless One', 'Hanged Executioner', 'Hard Evidence', 'Worldgorger Dragon', 'Ponder', 'Abrade', 'Antagonize', 'Cruel Ultimatum', 'Abandoned Sarcophagus', 'Kolaghan, the Storm''s Fury', 'Commune with Spirits', 'Hieroglyphic Illumination', 'Volcano Hellion', 'Torrent Sculptor', 'Brain Freeze', 'Thorn Mammoth', 'Reality Acid', 'Ghitu Journeymage', 'Temple of Plenty', 'Sky Terror', 'Legion''s Initiative', 'Shaile, Dean of Radiance', 'Blood Seeker', 'Barren Moor', 'Hypnotic Grifter', 'Panharmonicon', 'Thornwood Falls', 'Moon-Circuit Hacker', 'Dauntless Bodyguard', 'Blastoderm', 'Dimir Aqueduct', 'Orim''s Chant', 'Pore Over the Pages', 'Rite of Replication', 'Chandra, Fire Artisan', 'Upheaval', 'Liliana Vess', 'Veinfire Borderpost', 'Obstinate Baloth', 'Trostani''s Summoner', 'Piranha Marsh', 'Putrefy', 'Sphinx''s Tutelage', 'Arcbound Javelineer', 'Rift Sower', 'Karn''s Temporal Sundering', 'Bituminous Blast', 'Magister of Worth', 'Swiftblade Vindicator', 'Skemfar Avenger', 'Saproling Burst', 'Iron Apprentice', 'See the Truth', 'Animal Magnetism', 'Tocatli Honor Guard', 'Glacial Fortress', 'Grim Haruspex', 'Protean Hydra', 'Pristine Talisman', 'Honor of the Pure', 'Satyr Wayfinder', 'Tide Shaper', 'Bump in the Night', 'Whip of Erebos', 'Vessel of Nascency', 'Kunoros, Hound of Athreos', 'Condemn', 'Unlucky Witness', 'Viashino Pyromancer', 'Sorin''s Vengeance', 'Bolt Hound', 'Mobilized District', 'Fatestitcher', 'Mwonvuli Acid-Moss', 'Pawn of Ulamog', 'Mirari', 'Bloodtithe Harvester', 'Keldon Marauders', 'Mistvein Borderpost', 'Stirring Wildwood', 'Cursecatcher', 'Dead // Gone', 'Rabbit Battery', 'Ground Rift', 'Quicken', 'Far // Away', 'Leechridden Swamp', 'Wavesifter', 'Day of Judgment', 'Jace, Memory Adept', 'Vault of the Archangel', 'Golgari Brownscale', 'Double Vision', 'Urza''s Rage', 'Ash Zealot', 'Smallpox', 'Falkenrath Aristocrat', 'Temple of Enlightenment', 'Reckless Rage', 'Boros Signet', 'Firespout', 'Soulherder', 'Groundswell', 'Krark''s Thumb', 'Talisman of Conviction', 'Arcane Infusion', 'Vraska''s Contempt', 'Prey''s Vengeance', 'Curse of Exhaustion', 'Ondu Inversion', 'Reinforced Ronin', 'Tangled Florahedron', 'Dark Ritual', 'Kambal, Consul of Allocation', 'Abiding Grace', 'Vivid Grove', 'Bedlam Reveler', 'Imperious Perfect', 'Exclude', 'Merrow Reejerey', 'An Offer You Can''t Refuse', 'Acidic Slime', 'Llanowar Augur', 'Gideon''s Intervention', 'Tymaret, Chosen from Death', 'Thraben Inspector', 'Vampire''s Kiss', 'Bloodchief''s Thirst', 'Dimir Charm', 'Nivmagus Elemental', 'Needle Spires', 'Holy Strength', 'Ethereal Armor', 'Dream Trawler', 'Slice and Dice', 'Mind''s Desire', 'Heliod''s Pilgrim', 'Tribute to Horobi', 'Eternal Dragon', 'Lavaclaw Reaches', 'Wrench Mind', 'Dryad Militant', 'Verdant Command', 'Llanowar Tribe', 'Opt', 'Blacklance Paragon', 'Sanguine Statuette', 'Porcelain Legionnaire', 'Captain''s Claws', 'Join the Dance', 'Erebos''s Intervention', 'Commune with the Gods', 'Turnabout', 'Riptide Laboratory', 'Blisterspit Gremlin', 'Myr Incubator', 'Nest Invader', 'Arcbound Ravager', 'Faerie Vandal', 'Scoured Barrens', 'Battlefield Forge', 'Squadron Hawk', 'Reckless Impulse', 'Lose Focus', 'Adaptive Automaton', 'Chamber Sentry', 'Balustrade Spy', 'Biting-Palm Ninja', 'Spawning Pool', 'Solar Blast', 'Falkenrath Noble', 'Beacon of Tomorrows', 'Into the Story', 'Grand Arbiter Augustin IV', 'Malakir Rebirth', 'Figure of Destiny', 'Wooded Bastion', 'Undead Butler', 'Park Heights Pegasus', 'Horror of the Broken Lands', 'Spawning Breath', 'Zealous Persecution', 'Assault Strobe', 'Lightning Rift', 'Tidespout Tyrant', 'Timeless Witness', 'Mtenda Lion', 'Ashenmoor Gouger', 'Invigorate', 'Mindlink Mech', 'Mishra''s Factory', 'Glowspore Shaman', 'Mistvault Bridge', 'Firewild Borderpost', 'Fauna Shaman', 'Watcher for Tomorrow', 'Azorius Charm', 'Negate', 'Earthshaker Khenra', 'Descendants'' Path', 'Colossal Dreadmaw', 'Predator Ooze', 'Ezuri, Renegade Leader', 'Sea Gate Wreckage', 'Platinum Angel', 'Lonely Sandbar', 'Vapor Snag', 'Ingenious Infiltrator', 'Collateral Damage', 'Alpha Authority', 'Forbid', 'Gavony Township', 'Wing Splicer', 'Grisly Survivor', 'Wharf Infiltrator', 'Dismal Backwater', 'Clarion Spirit', 'Patchwork Automaton', 'Westvale Abbey', 'Bedevil', 'Gatekeeper of Malakir', 'Changeling Outcast', 'Crumbling Necropolis', 'Archetype of Endurance', 'Thunderbreak Regent', 'Alchemist''s Retrieval', 'Talisman of Resilience', 'Spitemare', 'Heartless Act', 'Conflagrate', 'Molten Birth', 'Dawn of Hope', 'Kor Skyfisher', 'Tapping at the Window', 'Yahenni, Undying Partisan', 'The Bloodsky Massacre', 'Scion of Oona', 'Steel Overseer', 'Hero of Precinct One', 'Snow-Covered Mountain', 'Growth-Chamber Guardian', 'March from the Tomb', 'Shrine of Burning Rage', 'Sanguine Bond', 'Healer''s Hawk', 'Izzet Charm', 'Swans of Bryn Argoll', 'Eiganjo Uprising', 'Dwynen''s Elite', 'Arcbound Prototype', 'Traxos, Scourge of Kroog', 'Worship', 'Quest for the Holy Relic', 'Angel of Sanctions', 'Seize the Storm', 'Hand of Emrakul', 'Old Stickfingers', 'Waterfront District', 'Summer Bloom', 'Gaze of Granite', 'Fabricate', 'The Birth of Meletis', 'Soul''s Attendant', 'Hammer of Bogardan', 'Wasteland Strangler', 'Temple of Silence', 'Spirited Companion', 'Ichorclaw Myr', 'Pelakka Wurm', 'The Modern Age', 'Arcbound Crusher', 'Pain Seer', 'Akroma''s Memorial', 'Izzet Boilerworks', 'Sylvan Library', 'Deep Forest Hermit', 'Chain Lightning', 'Slip Through Space', 'Merfolk Mistbinder', 'Gigadrowse', 'Runed Halo', 'Temple of Malice', 'Bag of Holding', 'Temple of Abandon', 'Benevolent Bodyguard', 'Cathartic Pyre', 'Inscription of Insight', 'Game Trail', 'Memory''s Journey', 'Reality Ripple', 'Loxodon Smiter', 'Ajani Goldmane', 'Sokenzan Smelter', 'Giant Cockroach', 'Akroma, Angel of Fury', 'Frontier Bivouac', 'Pelakka Predation', 'Yahenni''s Expertise', 'Ranger''s Guile', 'Temple of Mystery', 'Disciple of the Vault', 'Winged Words', 'Gargoyle Castle', 'Temple of Deceit', 'Jwari Disruption', 'End-Raze Forerunners', 'Field of Ruin', 'Coiling Oracle', 'Moonsnare Prototype', 'Jace Beleren', 'Restoration Angel', 'Transcendent Envoy', 'Signal Pest', 'Buried Alive', 'Darkmoss Bridge', 'Woodland Cemetery', 'Silvergill Adept', 'Tribute Mage', 'Arch of Orazca', 'Phantasmagorian', 'Dread Fugue', 'Scour All Possibilities', 'Temple of Epiphany', 'Starstorm', 'Kird Ape', 'Scrapyard Recombiner', 'Flame Rift', 'Zhalfirin Void', 'Raze the Effigy', 'Myr Battlesphere', 'Voldaren Pariah', 'Nomad Outpost', 'Rishkar, Peema Renegade', 'Dragonsguard Elite', 'Arcbound Hybrid', 'Kuldotha Rebirth', 'Fireblade Charger', 'Witch''s Cottage', 'Dakmor Salvage', 'Augur of Bolas', 'Dread Presence', 'Lotleth Troll', 'Azusa''s Many Journeys', 'Flourishing Fox', 'Into the Roil', 'Seething Song', 'Tranquil Cove', 'Putrid Goblin', 'Khalni Ambush', 'Boomerang', 'Basking Rootwalla', 'The Raven''s Warning', 'Shigeki, Jukai Visionary', 'Cartouche of Strength', 'Force of Rage', 'Qasali Pridemage', 'Ghost Quarter', 'Hada Freeblade', 'Exhaustion', 'Blood Fountain', 'Austere Command', 'Kazandu Mammoth', 'Gruul Turf', 'Dovin Baan', 'Den Protector', 'Beast Whisperer', 'Martyr of Sands', 'Arcbound Reclaimer', 'Dizzy Spell', 'Tanglepool Bridge', 'Cerodon Yearling', 'Harabaz Druid', 'Riftwing Cloudskate', 'Secluded Steppe', 'March of Reckless Joy', 'Teshar, Ancestor''s Apostle', 'Ravenous Squirrel', 'Thrill of Possibility', 'Cloudpost', 'Colossal Skyturtle', 'Prophet of Kruphix', 'Dennick, Pious Apprentice', 'Cut // Ribbons', 'Cabal Therapist', 'Proclamation of Rebirth', 'Angel of Despair', 'Joraga Warcaller', 'Dream Stalker', 'Mountain Valley', 'Sidisi, Brood Tyrant', 'Fire Covenant', 'Blazing Rootwalla', 'Grasslands', 'Olivia Voldaren', 'Ancestral Anger', 'Michiko''s Reign of Truth', 'Mystifying Maze', 'Solitary Confinement', 'Coalition Relic', 'Coralhelm Commander', 'Champion of Lambholt', 'Codie, Vociferous Codex', 'Shardless Agent', 'Drowned Catacomb', 'Kabira Takedown', 'Lodestone Golem', 'Sacred Fire', 'Response // Resurgence', 'Karmic Guide', 'Tomb of Urami', 'Sylvan Scrying', 'Countervailing Winds', 'Phyrexian Revoker', 'Kabira Evangel', 'Goblin Electromancer', 'Goblin Arsonist', 'Mayhem Patrol', 'Slagwoods Bridge', 'Bogardan Hellkite', 'Unexpected Results', 'Argentum Armor', 'Zabaz, the Glimmerwasp', 'Shock', 'Sarkhan the Masterless', 'Witching Well', 'Bloodrite Invoker', 'Ethersworn Sphinx', 'Mardu Banner', 'Universal Automaton', 'Kopala, Warden of Waves', 'Sandwurm Convergence', 'Empty the Warrens', 'Brain in a Jar', 'Duress', 'Dusk // Dawn', 'Soul Warden', 'Auramancer', 'Splinterfright', 'Prophetic Prism', 'Ornithopter', 'Frost Bite', 'Cabal Stronghold', 'Champion of Wits', 'Benalish Marshal', 'Gonti, Lord of Luxury', 'Ancient Stirrings', 'Raging Goblin', 'Slagstorm', 'Windbrisk Heights', 'Fact or Fiction', 'Decree of Justice', 'Blackbloom Rogue', 'Blasphemous Act', 'Abbot of Keral Keep', 'Dryad''s Revival', 'Judith, the Scourge Diva', 'Hour of Promise', 'Frantic Search', 'Bile Blight', 'Slaughter Pact', 'Beloved Princess', 'Rootbound Crag', 'Radha, Heart of Keld', 'Restore Balance', 'Stinkweed Imp', 'Ghostly Pilferer', 'Experimental Synthesizer', 'Momentary Blink', 'Silverbluff Bridge', 'Conclave Tribunal', 'Shivan Wurm', 'Fiend Hunter', 'Metalwork Colossus'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 109.0, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (67.6 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Utter End', 'Essence Scatter', 'Unlucky Witness', 'Stampede Driver', 'Korlash, Heir to Blackblade', 'Temple of Malady', 'Ethersworn Canonist', 'Pillage', 'Blood Fountain', 'Haunted Dead', 'Syncopate', 'Scrapyard Recombiner', 'Summer Bloom', 'Search for Tomorrow', 'Possibility Storm', 'Drownyard Temple', 'Edge of Autumn', 'Breathless Knight', 'Mirrodin''s Core', 'Mirrorpool', 'Fact or Fiction', 'Blacklance Paragon', 'Day of Judgment', 'Thassa''s Intervention', 'Gigadrowse', 'Hada Freeblade', 'Blasphemous Act', 'Anafenza, Kin-Tree Spirit', 'Zabaz, the Glimmerwasp', 'Descendants'' Path', 'Treasure Cruise', 'Ghost Quarter', 'Barren Moor', 'Knight of the Reliquary', 'Alchemist''s Refuge', 'Touch the Spirit Realm', 'Thawing Glaciers', 'Glint Hawk', 'Thorn Mammoth', 'Scab-Clan Berserker', 'Myr Servitor', 'Thraben Inspector', 'Mistcutter Hydra', 'Olivia Voldaren', 'Ground Rift', 'Falkenrath Pit Fighter', 'Cosmos Elixir', 'Jwari Disruption', 'Lashwrithe', 'Cathartic Pyre', 'Judge''s Familiar', 'Into the Roil', 'Golgari Brownscale', 'Cloudcrest Lake', 'Ugin''s Conjurant', 'Mangara of Corondor', 'Doomed Traveler', 'Gruul Turf', 'Vivid Marsh', 'Snowfield Sinkhole', 'Arcbound Lancer', 'Clackbridge Troll', 'Oracle of Mul Daya', 'Arcbound Hybrid', 'Perilous Research', 'Marauding Blight-Priest', 'Tolsimir, Friend to Wolves', 'Shrieking Affliction', 'Flame Slash', 'Gitaxian Probe', 'Rishadan Dockhand', 'Beacon of Tomorrows', 'Mortify', 'Elvish Visionary', 'Terminus', 'Ponder', 'Kaya, Ghost Assassin', 'Hypnotic Siren', 'Last Stand', 'Furyblade Vampire', 'Barbarian Ring', 'Blisterspit Gremlin', 'Restoration Angel', 'Howling Mine', 'Ashenmoor Gouger', 'Phyrexian Revoker', 'Darksteel Colossus', 'Telling Time', 'Slagwoods Bridge', 'Soul''s Attendant', 'Snow-Covered Plains', 'Myth Realized', 'Necrogoyf', 'Martyr of Frost', 'Iron Apprentice', 'Fires of Yavimaya', 'Phylactery Lich', 'Jace, the Living Guildpact', 'Ambitious Farmhand', 'Incinerate', 'Zhalfirin Void', 'Glimmerpost', 'Sylvan Primordial', 'Secluded Steppe', 'Nicol Bolas, Planeswalker', 'Ethersworn Sphinx', 'Anax, Hardened in the Forge', 'Duress', 'Cloudpost', 'Goldmire Bridge', 'Power Depot', 'Master of Death', 'Wrath of God', 'Mistvein Borderpost', 'Lavaclaw Reaches', 'Behold the Multiverse', 'Aetherspouts', 'Storm Herald', 'Realm Razer', 'Elixir of Immortality', 'Glorybringer', 'Gilded Lotus', 'Skyclave Cleric', 'Dovin Baan', 'Sorin Markov', 'Stromkirk Occultist', 'Riveteers Charm', 'Traxos, Scourge of Kroog', 'Mind''s Desire', 'Rakdos Headliner', 'Mutilate', 'Prey''s Vengeance', 'Sangrophage', 'Kitchen Imp', 'Lullmage Mentor', 'Snow-Covered Forest', 'Eternal Dragon', 'Loyal Pegasus', 'Battlefield Forge', 'Grim Haruspex', 'Giant Killer', 'Rotting Rats', 'Mass Hysteria', 'Goblin Arsonist', 'Anguished Unmaking', 'Increasing Ambition', 'Akroma, Angel of Fury', 'Oread of Mountain''s Blaze', 'Codie, Vociferous Codex', 'Kuldotha Forgemaster', 'Firewild Borderpost', 'Underworld Connections', 'Faithful Mending', 'Signal Pest', 'Fauna Shaman', 'Glowspore Shaman', 'Ranger''s Guile', 'Talisman of Impulse', 'Pack Rat', 'Scion of Oona', 'Golgari Signet', 'Goblin Electromancer', 'The Underworld Cookbook', 'Urza''s Rage', 'Sokenzan Smelter', 'Saproling Burst', 'Razortide Bridge', 'Dauntless Bodyguard', 'Coalition Relic', 'Outland Liberator', 'Seaside Citadel', 'Thrill of Possibility', 'Elvish Archdruid', 'Otherworldly Gaze', 'Ezuri, Renegade Leader', 'Faith''s Fetters', 'Faerie Vandal', 'Fire Covenant', 'Reclusive Taxidermist', 'Ajani, Caller of the Pride', 'Ral, Storm Conduit', 'Dread Fugue', 'The Modern Age', 'Jokulhaups', 'Hymn to Tourach', 'Tranquil Cove', 'Silence', 'Go for the Throat', 'Bag of Holding', 'Arcbound Worker', 'Nissa''s Renewal', 'Mouth of Ronom', 'Wharf Infiltrator', 'Ghor-Clan Rampager', 'Unburial Rites', 'Boros Reckoner', 'Hornet Queen', 'Fire Prophecy', 'Rootbound Crag', 'Icehide Golem', 'Figure of Destiny', 'Death Pulse', 'Waterfront District', 'Teshar, Ancestor''s Apostle', 'Ondu Cleric', 'Servo Exhibition', 'Heartless Act', 'Spawning Pool', 'Liliana''s Caress', 'Myr Battlesphere', 'Predator Ooze', 'Samurai of the Pale Curtain', 'Pore Over the Pages', 'Sea Gate Oracle', 'Brainstone', 'Park Heights Pegasus', 'Chamber Sentry', 'Surprise Deployment', 'Abandoned Sarcophagus', 'Dead // Gone', 'March of Reckless Joy', 'Fiery Temper', 'Scoured Barrens', 'Dread Shade', 'Blade Splicer', 'Lone Missionary', 'Vindicate', 'Kunoros, Hound of Athreos', 'Champion of the Parish', 'Slice and Dice', 'Izzet Charm', 'Grimdancer', 'Veinfire Borderpost', 'Riftwing Cloudskate', 'Mwonvuli Acid-Moss', 'Moderation', 'Frost Bite', 'Fireblade Charger', 'Azorius Signet', 'Sprite Dragon', 'Abrade', 'Exhaustion', 'Breya''s Apprentice', 'Bosh, Iron Golem', 'Cleansing Wildfire', 'Avacyn''s Pilgrim', 'Chromatic Lantern', 'Golgari Grave-Troll', 'Infernal Grasp', 'Mirrorshell Crab', 'Basking Rootwalla', 'Renewed Faith', 'Circle of Elders', 'Twinflame', 'Protean Hydra', 'Chain Lightning', 'Laboratory Maniac', 'Hammer of Bogardan', 'Shock', 'Tempered Steel', 'Flame-Blessed Bolt', 'Mirari', 'Flame Rift', 'Silent Submersible', 'Boot Nipper', 'Nimble Mongoose', 'Aetherling', 'Tymaret, Chosen from Death', 'Kabira Takedown', 'Adaptive Automaton', 'Oblivion Ring', 'Hinterland Harbor', 'Llanowar Wastes', 'Kjeldoran Outpost', 'Dread Presence', 'Krosan Grip', 'Primal Command', 'Selesnya Charm', 'Falkenrath Aristocrat', 'Halimar Excavator', 'Stone Rain', 'Dismal Backwater', 'Patchwork Automaton', 'Ad Nauseam', 'Guardian Gladewalker', 'Arcbound Ravager', 'Archfiend''s Vessel', 'Putrefy', 'Thirst for Discovery', 'Demonic Dread', 'Blazing Rootwalla', 'Bala Ged Recovery', 'Hapless Researcher', 'Rally the Ranks', 'Choking Sands', 'Ancient Stirrings', 'Improbable Alliance', 'Thirst for Meaning', 'Frontier Bivouac', 'Sea Gate Wreckage', 'Growth-Chamber Guardian', 'Dangerous Wager', 'Condemn', 'Angel''s Grace', 'Cloudsteel Kirin', 'Selesnya Sanctuary', 'Cosima, God of the Voyage', 'Birds of Paradise', 'Tapping at the Window', 'Rune-Scarred Demon', 'Seething Song', 'Feed the Swarm', 'Weaver of Currents', 'Pyretic Ritual', 'Steel Overseer', 'Dream Salvage', 'Shigeki, Jukai Visionary', 'Sign in Blood', 'Advanced Stitchwing', 'Heliod''s Pilgrim', 'Hypnotic Specter', 'Akki War Paint', 'Tamiyo''s Safekeeping', 'Clarion Spirit', 'Sandsteppe Citadel', 'Frantic Search', 'Blessed Alliance', 'Ash Zealot', 'Voltage Surge', 'Ritual of Soot', 'Arcbound Mouser', 'Lumbering Falls', 'Mesmeric Fiend', 'Asylum Visitor', 'Magister of Worth', 'Think Twice', 'Arcbound Tracker', 'Golgari Rot Farm', 'Bastion of Remembrance', 'Nested Shambler', 'Stromkirk Noble', 'Solar Blast', 'Skyclave Shade', 'Hour of Promise', 'Folio of Fancies', 'Throne of Geth', 'Lotleth Troll', 'Wall of Omens', 'Braids, Cabal Minion', 'Merciless Eviction', 'Hagra Mauling', 'Dragonsguard Elite', 'Momentary Blink', 'Invoke Calamity', 'Brokers Hideout', 'Burst Lightning', 'Experimental Synthesizer', 'Assault Strobe', 'Commit // Memory', 'Runed Halo', 'Soul Warden', 'Vampire Nighthawk', 'Disciple of the Vault', 'Glacial Fortress', 'Elves of Deep Shadow', 'Altar''s Reap', 'Temple of Malice', 'Collateral Damage', 'Kumano Faces Kakkazan', 'Court Homunculus', 'Dakmor Salvage', 'Fog', 'Boros Signet', 'Cruel Ultimatum', 'Dawn of Hope', 'Triskelion', 'Arcbound Reclaimer', 'Discovery // Dispersal', 'Shipbreaker Kraken', 'Logic Knot', 'Broodmate Dragon', 'Healer''s Hawk', 'Grisly Salvage', 'Moonsnare Prototype', 'Serrated Scorpion', 'Woodland Cemetery', 'Archfiend of Sorrows', 'Orim''s Chant', 'Abbot of Keral Keep', 'Rattleclaw Mystic', 'Demigod of Revenge', 'Ajani''s Chosen', 'Nomad Outpost', 'Explore', 'Blacksmith''s Skill', 'Oni-Cult Anvil', 'Temmet, Vizier of Naktamun', 'You Are Already Dead', 'Colossal Might', 'Augur of Bolas', 'Ignite Memories', 'Tergrid''s Shadow', 'Nest Invader', 'Gravebreaker Lamia', 'Ascent of the Worthy', 'Den Protector', 'Viashino Pyromancer', 'Opt', 'Kird Ape', 'Quicken', 'Slagstorm', 'Eye of Vecna', 'Night of Souls'' Betrayal', 'Joraga Warcaller', 'Altered Ego', 'Bedlam Reveler', 'Dominating Vampire', 'Drowned Catacomb', 'Sphinx''s Tutelage', 'Mikokoro, Center of the Sea', 'Delver of Secrets', 'Hypergenesis', 'Umara Wizard', 'Michiko''s Reign of Truth', 'Obliterate', 'Darkmoss Bridge', 'Lead the Stampede', 'Benalish Marshal', 'Restore Balance', 'Talisman of Conviction', 'Distended Mindbender', 'Mana Leak', 'Goblin Dark-Dwellers', 'Meteor Golem', 'Orzhov Signet', 'Endless One', 'Memory Lapse', 'Garruk Wildspeaker', 'Bituminous Blast', 'Into the Story', 'Nihilith', 'Grasp of Darkness', 'Tooth and Nail', 'Castigate', 'Avatar of Discord', 'Hedron Archive', 'Ghostly Pilferer', 'Tyrant of Discord', 'Cursecatcher', 'Hollow Specter', 'Diabolic Edict', 'Obscura Storefront', 'Warden of the First Tree', 'Lightning Rift', 'Arcbound Whelp', 'Cathar Commando', 'Ancestral Anger', 'Prophetic Prism', 'Colossal Dreadmaw', 'Ransack the Lab', 'Wonder', 'Big Score', 'Splinterfright', 'Steel Hellkite', 'Satyr Hoplite', 'Vapor Snag', 'Mephidross Vampire', 'Sorin''s Vengeance', 'Pulse of Murasa', 'Wildfield Borderpost', 'Dictate of Kruphix', 'Unified Will', 'Canyon Slough', 'Kuldotha Rebirth', 'Sphere of the Suns', 'Lodestone Golem', 'Dark Ritual', 'Game Trail', 'Haze of Pollen', 'Honored Hydra', 'Arch of Orazca', 'Essence Flux', 'Forgotten Cave', 'Gavony Township', 'Experimental Overload', 'Smallpox', 'Keldon Marauders', 'Voldaren Epicure', 'Ulvenwald Captive', 'Reality Acid', 'Goblin Bombardment', 'Horror of the Broken Lands', 'Chandra, Pyromaster', 'Worship', 'Soul Spike', 'Banishing Stroke', 'Profane Procession', 'Foreboding Ruins', 'Greater Gargadon', 'Unpredictable Cyclone', 'Evolving Wilds', 'Mogg War Marshal', 'Fling', 'Centaur Garden', 'Abundant Harvest', 'Sol Talisman', 'Vanishment', 'Voldaren Pariah', 'Oust', 'Winged Words', 'Fabricate', 'Divinity of Pride', 'Pain Seer', 'Spitemare', 'Shriekmaw', 'Izzet Boilerworks', 'Judith, the Scourge Diva', 'Primal Amulet', 'Vivid Grove', 'Bontu''s Last Reckoning', 'Tanglepool Bridge', 'Metalwork Colossus', 'First-Sphere Gargantua', 'Llanowar Tribe', 'Cenn''s Enlistment', 'Empty the Warrens', 'Reckoner''s Bargain', 'Champion of Lambholt', 'Runo Stromkirk', 'Sunset Revelry', 'Kor Skyfisher', 'Liliana Vess', 'Strike It Rich', 'Colossus of Akros', 'Shardless Agent', 'Reveillark', 'Animation Module', 'Psychic Possession', 'Sylvan Library', 'Rally the Ancestors', 'Leyline of Vitality', 'Dread Return', 'Clifftop Retreat', 'Bloodbraid Elf', 'Elfhame Palace', 'Porcelain Legionnaire', 'Ally Encampment', 'Mortuary Mire', 'Viscera Seer', 'Ardenvale Tactician', 'Intangible Virtue', 'Mirari''s Wake', 'Pelakka Wurm', 'Urza''s Factory', 'The Raven''s Warning', 'Leyline of Anticipation', 'Braid of Fire', 'Angel of Despair', 'Jace, Memory Adept', 'Mausoleum Secrets', 'Satyr Wayfinder', 'Phantasmagorian', 'The Birth of Meletis', 'Antagonize', 'Gargoyle Castle', 'Bile Blight', 'Reckless Impulse', 'Timely Reinforcements', 'Raven''s Crime', 'Cabal Stronghold', 'Drossforge Bridge', 'Champion of Wits', 'Ultimate Price', 'Temple of Abandon', 'Drannith Stinger', 'Ghastlord of Fugue', 'Join the Dance', 'Imperious Perfect', 'Arcbound Javelineer', 'Field of Ruin', 'Spell Pierce', 'Firespout', 'Temple of Enlightenment', 'Dusk // Dawn', 'Leechridden Swamp', 'Vault Skirge', 'Turnabout', 'Dimir Signet', 'Sephara, Sky''s Blade', 'Lyzolda, the Blood Witch', 'Exclude', 'Deathbonnet Sprout', 'Deep Forest Hermit', 'Brain Freeze', 'Rally for the Throne', 'Reinforced Ronin', 'Magister Sphinx', 'Volcano Hellion', 'Bolt Hound', 'Power Conduit', 'Llanowar Elves', 'Riptide Laboratory', 'Ornithopter', 'Gather the Townsfolk', 'Shambling Shell', 'Beast Whisperer', 'Bloodhall Priest', 'Fyndhorn Elves', 'Colossal Skyturtle', 'Bone Shards', 'Earthshaker Khenra', 'Geomancer''s Gambit', 'Mishra''s Factory', 'Scryb Ranger', 'Witch''s Cottage', 'Shrapnel Blast', 'Talisman of Resilience', 'Walk the Aeons', 'Grasslands', 'Chandra, Fire Artisan', 'Consecrate // Consume', 'Mardu Banner', 'Soul Snare', 'Revitalize', 'Rabbit Battery', 'Tranquil Thicket', 'Spikefield Hazard', 'Sphinx of the Steel Wind', 'Mystifying Maze', 'Kabira Evangel', 'Boomerang', 'Bloodchief''s Thirst', 'Benevolent Bodyguard', 'Nezahal, Primal Tide', 'Stirring Wildwood', 'Hotshot Mechanic', 'Temple of Mystery', 'Temple of Silence', 'Door to Nothingness', 'Deep Analysis', 'Scion of Opulence', 'Rakdos Cackler', 'Dream Trawler', 'Terastodon', 'Season of Growth', 'Arcbound Overseer', 'Quest for the Holy Relic', 'Dinrova Horror', 'Colossification', 'Burning Anger', 'Commune with the Gods', 'Bogardan Hellkite', 'Unexpected Results', 'Grave Scrabbler', 'Nevermore', 'Frantic Inventory', 'Hanged Executioner', 'Advent of the Wurm', 'Combine Chrysalis', 'Electric Revelation', 'Hungering Hydra', 'Ethereal Absolution', 'Big Game Hunter', 'Awakening Zone', 'Broodwarden', 'Dryad Militant', 'Rustvale Bridge', 'Bramblewood Paragon', 'Rishkar, Peema Renegade', 'Omen of the Sun', 'Seasoned Hallowblade', 'Undead Butler', 'Midnight Clock', 'Cloudshift', 'Raise the Alarm', 'Silverbluff Bridge', 'Zulaport Cutthroat', 'Spawning Breath', 'Prismatic Lens', 'Caves of Koilos', 'Dimir Charm', 'Sanguine Statuette', 'Pawn of Ulamog', 'Decree of Justice', 'Rakdos Charm', 'Bringer of the Black Dawn', 'See the Truth', 'Temple of Epiphany', 'Blastoderm', 'Okiba Reckoner Raid', 'Shrine of Burning Rage', 'Inevitable Betrayal', 'Aegis of the Gods', 'Sylvan Scrying', 'Platinum Angel', 'Ludevic, Necrogenius', 'Forbid', 'Hunted Witness', 'Jinxed Idol', 'Desperate Ritual', 'Prophetic Titan', 'Fire-Lit Thicket', 'Argentum Armor', 'Cut // Ribbons', 'Chandra, the Firebrand', 'Golgari Germination', 'Mayhem Patrol', 'Westvale Abbey', 'Erebos''s Intervention', 'Pathrazer of Ulamog', 'Lantern of the Lost', 'War-Name Aspirant', 'Shivan Wurm', 'Lose Focus', 'Wild Cantor', 'Transcendent Envoy', 'Vault of the Archangel', 'Terramorphic Expanse', 'Sarkhan the Mad', 'Brood Birthing', 'Animate Dead', 'Ashenmoor Liege', 'Starstorm', 'Tomb of Urami', 'Nivmagus Elemental', 'Warstorm Surge', 'Myr Incubator', 'Harabaz Druid', 'Gideon Jura', 'Scour All Possibilities', 'Buried Alive', 'Thought Scour', 'Ghitu Lavarunner', 'Marwyn, the Nurturer', 'Mistvault Bridge', 'Thaumatic Compass', 'Acidic Slime', 'Elvish Mystic', 'Abzan Ascendancy', 'Timeless Witness', 'Universal Automaton', 'Suffocating Fumes', 'Dwynen''s Elite', 'Wren''s Run Hydra', 'Gatekeeper of Malakir', 'Flametongue Kavu', 'Arcbound Prototype', 'Wasteland Strangler', 'Sylvan Advocate', 'Westgate Regent', 'Edric, Spymaster of Trest', 'Seekers'' Squire', 'Yidaro, Wandering Monster', 'Thornglint Bridge', 'Radha, Heart of Keld', 'Dimir Aqueduct', 'Gray Merchant of Asphodel', 'Negate', 'Hand of Emrakul', 'Dusk Legion Zealot', 'Repeal', 'Rite of Replication', 'Wooded Bastion', 'Hieroglyphic Illumination', 'Sphinx of Uthuun', 'Simic Guildgate', 'Invigorate', 'Arcbound Crusher', 'Skaab Ruinator', 'Fieldmist Borderpost', 'Azorius Charm', 'Snapback', 'Sleight of Hand', 'Bounty of the Luxa', 'Vampire''s Kiss', 'Yahenni''s Expertise', 'Detention Sphere', 'Esper Panorama', 'Cartel Aristocrat', 'Whip of Erebos', 'Mindlink Mech', 'Sheltering Ancient', 'Resurgent Belief', 'Raging Ravine', 'Sky Hussar', 'Drowner of Hope', 'Slaughter Pact', 'Fireblade Artist', 'Dream Stalker', 'Temple of Deceit', 'Wastes', 'Cabal Therapist', 'Raid Bombardment', 'Lys Alana Huntmaster', 'It That Betrays', 'Bump in the Night', 'Crackling Drake', 'Verdant Command', 'Prophet of Kruphix', 'Madcap Experiment', 'Shadow of the Grave', 'Temple of Plenty', 'Luminarch Ascension', 'Gonti, Lord of Luxury', 'Neheb, Dreadhorde Champion', 'Grapeshot', 'Alchemist''s Retrieval', 'Desperate Ravings', 'Solitary Confinement', 'Bant Panorama', 'Raging Goblin', 'Aethermage''s Touch', 'Ravenous Squirrel', 'Dragonskull Summit', 'Immortal Servitude', 'Hissing Quagmire', 'Void Beckoner', 'Firebolt', 'Falkenrath Gorger', 'Jwari Shapeshifter'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 67.6, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (72.9 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Gonti, Lord of Luxury', 'Advanced Stitchwing', 'Unified Will', 'Grim Haruspex', 'Samut, Voice of Dissent', 'Buried Alive', 'Silverflame Squire', 'Commune with the Gods', 'Vampire''s Kiss', 'Wasteland Strangler', 'Terminus', 'Alchemist''s Refuge', 'Kalastria Highborn', 'Tavern Scoundrel', 'Strike It Rich', 'Altar''s Reap', 'Martyr of Frost', 'Riveteers Charm', 'Fabricate', 'Broodmate Dragon', 'Arcbound Worker', 'Dragon Mantle', 'Doomed Traveler', 'Incinerate', 'Champion of the Parish', 'Oust', 'Dread Presence', 'Gray Merchant of Asphodel', 'Nicol Bolas, Planeswalker', 'Stampede Driver', 'Ancient Grudge', 'Experimental Overload', 'Crib Swap', 'Captain''s Claws', 'Drowner of Hope', 'Spitemare', 'Eternal Dragon', 'Faerie Vandal', 'Razortide Bridge', 'Captivating Vampire', 'Shigeki, Jukai Visionary', 'Thousand-Faced Shadow', 'Dryad Militant', 'Tireless Provisioner', 'Foreboding Ruins', 'Gideon Jura', 'Benalish Marshal', 'Raging Ravine', 'Necrotic Ooze', 'Vanishment', 'Geomancer''s Gambit', 'Tooth and Nail', 'Vapor Snag', 'Skyclave Shade', 'Hammerhand', 'Pride of the Clouds', 'Fling', 'Fiend Hunter', 'Dream Stalker', 'Victim of Night', 'Cruel Ultimatum', 'Rustvale Bridge', 'Elves of Deep Shadow', 'Chandra, Fire Artisan', 'Midnight Reaper', 'Solitary Confinement', 'Possibility Storm', 'Kumano Faces Kakkazan', 'Putrefy', 'Birds of Paradise', 'Drannith Stinger', 'Necrogoyf', 'Hotshot Mechanic', 'Bala Ged Recovery', 'Stromkirk Occultist', 'Glowspore Shaman', 'Vilis, Broker of Blood', 'Pyrite Spellbomb', 'Moorland Haunt', 'Faithless Salvaging', 'Serrated Scorpion', 'Yidaro, Wandering Monster', 'Imperious Perfect', 'Wall of Omens', 'Drown in Filth', 'Unexpected Results', 'Secluded Glen', 'Harrow', 'Abiding Grace', 'Silver Myr', 'Sphere of the Suns', 'Dauntless Bodyguard', 'Reap and Sow', 'Vryn Wingmare', 'Sejiri Shelter', 'Zenith Flare', 'Regal Force', 'Arcbound Crusher', 'Cloudshift', 'Mangara of Corondor', 'Desperate Ritual', 'Heartless Act', 'Boreal Shelf', 'Banishing Stroke', 'Kami of False Hope', 'Grisly Salvage', 'Death Pulse', 'Lightning Rift', 'Dawn of Hope', 'Obscura Storefront', 'Jace Beleren', 'Lys Alana Huntmaster', 'Slagstorm', 'Dominating Vampire', 'Joraga Warcaller', 'Firewild Borderpost', 'Arcbound Tracker', 'Fiery Temper', 'Vorapede', 'Verdant Command', 'Scour All Possibilities', 'Zuran Orb', 'Scion of Oona', 'Volcano Hellion', 'Distended Mindbender', 'Kyodai, Soul of Kamigawa', 'Unbounded Potential', 'Savage Lands', 'Tahngarth''s Rage', 'Scorched Rusalka', 'Elvish Archdruid', 'Shrieking Affliction', 'Power Conduit', 'Blood Fountain', 'Oakhame Ranger', 'Dragonsguard Elite', 'Rally the Ranks', 'Stoneforge Masterwork', 'Falkenrath Pit Fighter', 'Haunted Dead', 'Biting-Palm Ninja', 'Thirst for Discovery', 'Aetherling', 'Darkmoss Bridge', 'Demigod of Revenge', 'Sorin Markov', 'Assault Formation', 'Heliod''s Pilgrim', 'Faerie Miscreant', 'The Birth of Meletis', 'Thunderclap Wyvern', 'Rise and Shine', 'Sanguine Statuette', 'End-Raze Forerunners', 'Triskelion', 'Castigate', 'Ethersworn Canonist', 'Explore', 'Bloodbraid Elf', 'Infernal Grasp', 'Oblivion Ring', 'Umara Wizard', 'Dismal Backwater', 'Ransack the Lab', 'Flame Rift', 'Hunted Horror', 'Repeal', 'Mantis Rider', 'Westvale Abbey', 'Soul Warden', 'Fireblade Artist', 'Valiant Rescuer', 'Haakon, Stromgald Scourge', 'Rattleclaw Mystic', 'Wrath of God', 'Cut // Ribbons', 'Ghostly Pilferer', 'Stromkirk Noble', 'Braids, Cabal Minion', 'Vedalken Shackles', 'Spawning Pool', 'Locket of Yesterdays', 'Weapons Trainer', 'Sarkhan the Masterless', 'Thirst for Meaning', 'Sign in Blood', 'Ingenious Infiltrator', 'Hypnotic Specter', 'Ethersworn Sphinx', 'Grimdancer', 'Nomad Outpost', 'Seaside Citadel', 'Niv-Mizzet, the Firemind', 'Elder Deep-Fiend', 'Sky Hussar', 'Reality Acid', 'Earthshaker Khenra', 'Assault Strobe', 'Ancient Lumberknot', 'The Scorpion God', 'Lone Missionary', 'Legion Lieutenant', 'Second Sunrise', 'Desecration Demon', 'Myth Realized', 'Arcbound Lancer', 'Dark Ritual', 'Increasing Ambition', 'Dream Trawler', 'Skirge Familiar', 'Unsubstantiate', 'Soul Spike', 'Pieces of the Puzzle', 'Outland Liberator', 'Grasslands', 'Boomerang', 'Cathartic Pyre', 'Sylvan Advocate', 'Growth-Chamber Guardian', 'Azorius Charm', 'Park Heights Pegasus', 'Kuldotha Forgemaster', 'Cloudsteel Kirin', 'Wooded Bastion', 'Spider Umbra', 'Saproling Burst', 'Falkenrath Aristocrat', 'Nightveil Predator', 'Weaver of Currents', 'Sensor Splicer', 'March of Reckless Joy', 'Ajani Unyielding', 'Slip Out the Back', 'Sangrophage', 'Night of Souls'' Betrayal', 'Midnight Clock', 'Primal Amulet', 'Invoke Calamity', 'Lullmage Mentor', 'Luminarch Ascension', 'Steel Overseer', 'Sphinx of Uthuun', 'Izzet Signet', 'Immortal Servitude', 'Scion of Opulence', 'Momentary Blink', 'Angel of Despair', 'Shardless Agent', 'Yusri, Fortune''s Flame', 'Predator Ooze', 'Bastion of Remembrance', 'Arcane Sanctum', 'Leyline of Anticipation', 'Molten Birth', 'Lashwrithe', 'Ajani''s Chosen', 'Rootbound Crag', 'Dream Salvage', 'Turnabout', 'Anax, Hardened in the Forge', 'Marauding Blight-Priest', 'Favorable Winds', 'Gaea''s Revenge', 'Solar Blast', 'Rosethorn Acolyte', 'Zulaport Cutthroat', 'Hour of Promise', 'Tectonic Giant', 'Bloodchief''s Thirst', 'Stormscape Familiar', 'Panoptic Mirror', 'Adaptive Automaton', 'Winged Words', 'Tombstalker', 'Cartel Aristocrat', 'Tribute Mage', 'Timeless Witness', 'Coiling Oracle', 'The Underworld Cookbook', 'Windbrisk Heights', 'Mortify', 'Haze of Pollen', 'Tapping at the Window', 'Arcbound Javelineer', 'Shriekhorn', 'Nivmagus Elemental', 'Ajani, Caller of the Pride', 'Walk the Aeons', 'Anguished Unmaking', 'Restoration Angel', 'Archfiend of Sorrows', 'Tanglepool Bridge', 'Temple of Malady', 'Elixir of Immortality', 'Dead // Gone', 'Claim the Firstborn', 'Voldaren Pariah', 'Rakdos Cackler', 'Asmodeus the Archfiend', 'Venerable Warsinger', 'Dragonskull Summit', 'Legion''s Initiative', 'Squadron Hawk', 'Treefolk Harbinger', 'Veinfire Borderpost', 'Pelakka Wurm', 'Kaya, Ghost Assassin', 'Nether Spirit', 'Haven of the Spirit Dragon', 'Spikefield Hazard', 'Stinkweed Imp', 'Lumbering Falls', 'Return to Nature', 'Tranquil Garden', 'Essence Scatter', 'Perilous Research', 'Tamiyo''s Safekeeping', 'Darksteel Colossus', 'Canyon Slough', 'Giant Killer', 'Gatherer of Graces', 'Orzhov Signet', 'Shipbreaker Kraken', 'Lazotep Plating', 'Temple of Epiphany', 'Foul-Tongue Invocation', 'Riptide Laboratory', 'Rune-Scarred Demon', 'Llanowar Elves', 'Runo Stromkirk', 'Urza''s Factory', 'Hissing Quagmire', 'Fauna Shaman', 'Benevolent Bodyguard', 'Breya''s Apprentice', 'Arcbound Overseer', 'Pestilence Demon', 'Whispers of the Muse', 'Prey''s Vengeance', 'Centaur Garden', 'Ornithopter of Paradise', 'Rally the Righteous', 'Thrill of Possibility', 'Legacy Weapon', 'Channel the Suns', 'Cerulean Wisps', 'Void Beckoner', 'Karn''s Temporal Sundering', 'Healer''s Hawk', 'Snow-Covered Swamp', 'Sea Gate Oracle', 'Nest Invader', 'Empty the Warrens', 'Sphinx of the Steel Wind', 'Sylvan Scrying', 'Abrade', 'Unlucky Witness', 'Sleeper Dart', 'Wrench Mind', 'Morselhoarder', 'Ranger of Eos', 'Furyblade Vampire', 'Goblin Bombardment', 'Pulse of Murasa', 'Blessed Alliance', 'Opt', 'Myr Servitor', 'Sylvan Library', 'Undead Butler', 'Realm Razer', 'Grapeshot', 'Trinket Mage', 'Dangerous Wager', 'Dread Shade', 'Sidisi, Brood Tyrant', 'Elvish Rejuvenator', 'Tergrid''s Shadow', 'Mirrorshell Crab', 'Fire Covenant', 'Experimental Synthesizer', 'Upheaval', 'Sephara, Sky''s Blade', 'Cleansing Wildfire', 'Pack Rat', 'Dovin Baan', 'Temmet, Vizier of Naktamun', 'Lavaclaw Reaches', 'Transcendent Envoy', 'Cartographer''s Survey', 'Silent Submersible', 'Harabaz Druid', 'Crackling Drake', 'Tempest Djinn', 'Rite of Replication', 'Argentum Armor', 'Awakening Zone', 'Temple of Malice', 'Into the Story', 'Kabira Takedown', 'Yahenni''s Expertise', 'Talisman of Conviction', 'Reckoner''s Bargain', 'Obliterate', 'Shredded Sails', 'Sylvan Awakening', 'Big Game Hunter', 'Witching Well', 'Asylum Visitor', 'Animate Dead', 'Mana Leak', 'Brainstone', 'Ramunap Excavator', 'Sunrise Cavalier', 'Season of Growth', 'Cosima, God of the Voyage', 'Ghitu Lavarunner', 'Barbarian Ring', 'Reality Ripple', 'Tempered Steel', 'Fyndhorn Elves', 'Ral Zarek', 'Nissa, Worldwaker', 'Keldon Marauders', 'Gloomshrieker', 'Ground Rift', 'Izzet Boilerworks', 'Ultimate Price', 'Champion of the Flame', 'Seething Song', 'Rally the Ancestors', 'Trickbind', 'Prophetic Titan', 'Hand of Emrakul', 'You Are Already Dead', 'Hymn to Tourach', 'Codex Shredder', 'Dennick, Pious Apprentice', 'Snow-Covered Mountain', 'Stormfront Pegasus', 'Needle Spires', 'Ambitious Farmhand', 'The Raven''s Warning', 'Mortuary Mire', 'Elvish Visionary', 'Llanowar Tribe', 'Restore Balance', 'Sleight of Hand', 'Mausoleum Secrets', 'Falkenrath Gorger', 'Snapback', 'Barrenton Medic', 'Negate', 'Clarion Spirit', 'Soulflayer', 'Honden of Life''s Web', 'Akroma, Angel of Fury', 'Golgari Brownscale', 'Electric Revelation', 'Cabaretti Courtyard', 'Leyline of Vitality', 'Blasphemous Act', 'Mayor of Avabruck', 'Mob Mentality', 'Endless One', 'Day of Judgment', 'Boros Signet', 'Ghost Quarter', 'Shambling Shell', 'Keeper of the Lens', 'Intangible Virtue', 'Greater Gargadon', 'Tower Defense', 'Fiery Gambit', 'Reckless Impulse', 'Hunted Witness', 'Shrine of Burning Rage', 'Profane Procession', 'Brokers Hideout', 'Big Score', 'Universal Automaton', 'Sphinx''s Tutelage', 'Tree of Redemption', 'Reveillark', 'Barren Moor', 'Sheltering Ancient', 'Korlash, Heir to Blackblade', 'Westgate Regent', 'Go-Shintai of Hidden Cruelty', 'Thawing Glaciers', 'Honden of Cleansing Fire', 'Rotting Rats', 'Temple of Mystery', 'Honden of Night''s Reach', 'Bazaar Trademage', 'Phyrexian Revoker', 'Go-Shintai of Boundless Vigor', 'Akoum Battlesinger', 'Mistcutter Hydra', 'Sky Terror', 'Mass Hysteria', 'Exhaustion', 'Merciless Eviction', 'Myr Incubator', 'Drowned Catacomb', 'Worship', 'Deep Analysis', 'Arcbound Whelp', 'Gigadrowse', 'Pyromancer Ascension', 'Bosh, Iron Golem', 'Bone Shards', 'Spell Pierce', 'Hedron Archive', 'Vampire Opportunist', 'Wayward Swordtooth', 'Ulvenwald Captive', 'Radha, Heart of Keld', 'Jace, Memory Adept', 'Go-Shintai of Ancient Wars', 'Glimmerpost', 'Ghitu Encampment', 'Eiganjo Castle', 'Ascent of the Worthy', 'Gavony Township', 'Mystifying Maze', 'Arch of Orazca', 'Bag of Holding', 'Torment of Scarabs', 'Underworld Connections', 'Twinflame', 'Whisperwood Elemental', 'Burning Vengeance', 'Commit // Memory', 'Frantic Search', 'Slaughter Pact', 'Shrapnel Blast', 'Duskwatch Recruiter', 'Hagra Mauling', 'Eater of Virtue', 'Boros Reckoner', 'Colossal Skyturtle', 'Dreadhorde Invasion', 'Deprive', 'Anticipate', 'Selesnya Sanctuary', 'Nihilith', 'Join the Dance', 'Quicken', 'Doran, the Siege Tower', 'Folio of Fancies', 'Liquimetal Coating', 'Barrin, Tolarian Archmage', 'Faith''s Fetters', 'Bounty of the Luxa', 'Moonsnare Prototype', 'Prosperous Thief', 'Champion of Dusk', 'Seasons Past', 'Sarkhan the Mad', 'Thassa''s Intervention', 'Fire Prophecy', 'Linvala, Shield of Sea Gate', 'Basking Rootwalla', 'Chandra, the Firebrand', 'Heron''s Grace Champion', 'Kor Bladewhirl', 'Marwyn, the Nurturer', 'Mythos of Illuna', 'Raven''s Crime', 'Seasoned Hallowblade', 'Expedition Envoy', 'Giant Ox', 'Cathar Commando', 'Unpredictable Cyclone', 'Flametongue Kavu', 'Power Depot', 'Tectonic Reformation', 'Yahenni, Undying Partisan', 'Crux of Fate', 'Warden of the First Tree', 'Elvish Mystic', 'Ancestral Anger', 'Colossal Might', 'Flaying Tendrils', 'Dust Corona', 'Stubborn Denial', 'Rishkar, Peema Renegade', 'Behold the Multiverse', 'Memory Lapse', 'Chancellor of the Dross', 'Horror of the Broken Lands', 'Mobilized District', 'Terramorphic Expanse', 'Future Sight', 'Guardian Gladewalker', 'Ranger''s Guile', 'Vivid Creek', 'Knight of the Reliquary', 'Joraga Treespeaker', 'Snowfield Sinkhole', 'Phylactery Lich', 'Madcap Experiment', 'Become Immense', 'Cathartic Reunion', 'Sygg, River Cutthroat', 'Ritual of Soot', 'Jokulhaups', 'Mesmeric Fiend', 'Jungle Shrine', 'Prophetic Prism', 'Tomb of Urami', 'Temple of Deceit', 'Selesnya Charm', 'Ghostfire Blade', 'Whip of Erebos', 'Into the Roil', 'An Offer You Can''t Refuse', 'Lotleth Troll', 'Waterfront District', 'Descendants'' Path', 'Vault of the Archangel', 'Clackbridge Troll', 'Samurai of the Pale Curtain', 'Condemn', 'Faithful Mending', 'Diabolic Edict', 'Buried Ruin', 'Mire Triton', 'Oni-Cult Anvil', 'Mind''s Desire', 'Search for Tomorrow', 'Martyr of Sands', 'Crystalline Giant', 'Silver-Fur Master', 'Kessig Malcontents', 'Zhalfirin Void', 'Krosan Grip', 'Runed Halo', 'Hollow Specter', 'Shivan Wurm', 'Glint Hawk', 'Garruk Wildspeaker', 'Sovereign''s Bite', 'Cartouche of Zeal', 'Hada Freeblade', 'Nezahal, Primal Tide', 'Witch''s Cottage', 'Temple of Silence', 'Spark Spray', 'Essence Flux', 'Rakdos Charm', 'Deep Forest Hermit', 'Hornet Queen', 'Fire-Lit Thicket', 'Talisman of Resilience', 'Fog', 'Urza''s Rage', 'Edgewall Innkeeper', 'Dokuchi Silencer', 'Into the North', 'Gather the Townsfolk', 'Cursecatcher', 'Pathrazer of Ulamog', 'Vivid Grove', 'Blastoderm', 'Evolving Wilds', 'Ghor-Clan Rampager', 'Golgari Signet', 'Chromium, the Mutable', 'Prismatic Lens', 'Wolf-Skull Shaman', 'Breathless Knight', 'Vesperlark', 'Desperate Ravings', 'Viscera Seer', 'Soulherder', 'Scoured Barrens', 'Bladewing''s Thrall', 'Ardenvale Tactician', 'Forgotten Cave', 'Power Sink', 'Blackmail', 'Nameless Inversion', 'Chromatic Lantern', 'Drannith Healer', 'Lose Focus', 'Gatekeeper of Malakir', 'Kaleidostone', 'Lucky Clover', 'Dragon Turtle', 'Mouth of Ronom', 'Hushwing Gryff', 'Sandsteppe Citadel', 'Exclude', 'The Modern Age', 'Mephidross Vampire', 'Silumgar''s Scorn', 'Cosmos Elixir', 'Sea Gate Wreckage', 'Ojutai, Soul of Winter', 'Thought Scour', 'Prophet of Kruphix', 'Dictate of Kruphix', 'Changeling Outcast', 'Choking Sands', 'Ignite Memories', 'Decree of Justice', 'Eldrazi Skyspawner', 'Chance Encounter', 'Spirit of the Aldergard', 'Viashino Pyromancer', 'Voldaren Epicure', 'Wastes', 'Spectral Procession', 'Omen of the Sun', 'Caves of Koilos', 'Sprite Dragon', 'Dimir Charm', 'Young Necromancer', 'Consecrate // Consume', 'Sterling Grove', 'Rampant Growth', 'Lantern of the Lost', 'Bond of Insight', 'Glorybringer', 'Nissa''s Renewal', 'Porcelain Legionnaire', 'Desolate Lighthouse', 'Master of Winds', 'Mishra''s Factory', 'Frontier Bivouac', 'Talisman of Impulse', 'Vivid Meadow', 'Hungering Hydra', 'Temple of Enlightenment', 'Arcbound Reclaimer', 'Dakmor Salvage', 'Ash Zealot', 'Sacred Fire', 'Jace, the Living Guildpact', 'Lonely Sandbar', 'Sorin''s Vengeance', 'Tranquil Cove', 'Gilded Lotus', 'Mogg War Marshal', 'Stromkirk Captain', 'Oracle of Mul Daya', 'Myr Battlesphere', 'Putrid Goblin', 'Bramblewood Paragon', 'Zabaz, the Glimmerwasp', 'Kjeldoran Outpost', 'Blacksmith''s Skill', 'Jwari Shapeshifter', 'Inscription of Ruin', 'Phantasmagorian', 'Delver of Secrets', 'Catapult Fodder', 'Iron Apprentice', 'Servo Exhibition', 'Wandering Mind', 'Moderation', 'Faerie Guidemother', 'Kor Skyfisher', 'Ashenmoor Liege', 'Tajic, Legion''s Edge', 'Liquimetal Torque', 'Leechridden Swamp', 'Summer Bloom', 'Invigorate', 'Piranha Marsh', 'Signal Pest', 'Detention Sphere', 'Oread of Mountain''s Blaze', 'Akroan Crusader', 'Aethermage''s Touch', 'Wing Splicer', 'Kitchen Imp', 'Aetherize', 'Terastodon', 'Firemantle Mage', 'Riftwing Cloudskate', 'Anafenza, Kin-Tree Spirit', 'Think Twice', 'Jinxed Idol', 'Ethereal Absolution', 'Slagwoods Bridge', 'General Ferrous Rokiric', 'Treasure Cruise', 'Trading Post', 'Disciple of the Vault', 'Irencrag Pyromancer', 'Satyr Wayfinder', 'Steel Hellkite', 'Goblin Electromancer', 'Orazca Relic', 'Magmatic Insight', 'Augur of Bolas', 'Shriekmaw', 'Sokenzan Smelter', 'Bogardan Hellkite', 'Chain Lightning', 'Burning Inquiry', 'Abandoned Sarcophagus', 'Fieldmist Borderpost', 'Aegis of the Gods', 'Kuldotha Rebirth', 'Trostani''s Summoner', 'Scab-Clan Berserker', 'Markov Enforcer', 'Honden of Infinite Rage', 'Biolume Egg', 'Esper Panorama', 'Bankrupt in Blood', 'Brood Birthing', 'Soul''s Attendant', 'Izzet Charm', 'Blazing Rootwalla', 'Beacon of Tomorrows', 'Cruel Bargain', 'Malakir Rebirth', 'Goblin Dark-Dwellers', 'Containment Construct', 'Justice Strike', 'Abbot of Keral Keep', 'Master of Death', 'Hieroglyphic Illumination', 'Winged Portent', 'Dread Return', 'Silverbluff Bridge', 'Tymaret, Chosen from Death', 'Ral, Storm Conduit', 'Telling Time', 'Tyrant''s Choice', 'Broodwarden', 'Drossforge Bridge', 'Olivia Voldaren', 'Mikokoro, Center of the Sea', 'Thaumatic Compass', 'Swiftwater Cliffs', 'Gruul Turf', 'Game Trail', 'Spawning Breath', 'Avacyn''s Pilgrim', 'Bituminous Blast', 'Radiant Scrollwielder', 'Wren''s Run Hydra', 'Shimmerdrift Vale', 'Liliana Vess', 'Rally for the Throne', 'Read the Bones', 'Venerated Loxodon', 'Response // Resurgence', 'Bump in the Night', 'Circle of Elders', 'Wildfield Borderpost', 'Beast Whisperer', 'Fruit of Tizerus', 'Firebolt', 'Aetherspouts', 'Bringer of the Black Dawn', 'Gravebreaker Lamia', 'Snow-Covered Plains', 'Sylvan Messenger', 'Erebos''s Intervention', 'Collateral Damage', 'Abundant Harvest', 'Meteor Golem', 'Sunset Revelry', 'Valorous Stance', 'Jwari Disruption', 'Bedlam Reveler', 'Nether Traitor', 'Scryb Ranger', 'Burst Lightning', 'Cenn''s Enlistment', 'Logic Knot', 'Mirari', 'Gargoyle Castle', 'Abyssal Persecutor', 'Orator of Ojutai', 'Vindicate', 'Dusk // Dawn', 'Quest for the Holy Relic', 'Ezuri, Renegade Leader', 'Slice and Dice', 'Mardu Banner', 'Shadow of the Grave', 'Fatestitcher', 'Hanged Executioner', 'Brain Freeze', 'Arcbound Ravager', 'Mutilate', 'Thornglint Bridge', 'Worldgorger Dragon', 'Reinforced Ronin', 'Satoru Umezawa', 'Arcbound Mouser', 'Nevermore', 'Sylvan Primordial', 'Den Protector', 'Hinterland Harbor', 'Pain Seer', 'Dwynen''s Elite', 'First-Sphere Gargantua', 'Null Profusion', 'Alpha Authority', 'Codie, Vociferous Codex', 'Combine Chrysalis', 'Surprise Deployment', 'Llanowar Wastes', 'Hooting Mandrills', 'Duress', 'Bedevil', 'Champion of Lambholt', 'Mirari''s Wake', 'Psychic Possession', 'Rakdos Headliner', 'Metalwork Colossus', 'Animal Magnetism', 'Quest for the Nihil Stone', 'Champion of Wits', 'Dread Fugue', 'Faith''s Reward', 'Nyxathid', 'Unburial Rites', 'Judith, the Scourge Diva', 'Cabal Therapist', 'Neheb, Dreadhorde Champion', 'Pawn of Ulamog', 'Sunhome, Fortress of the Legion', 'Thorn Mammoth', 'Inscription of Insight', 'Dusk Legion Zealot', 'Arcbound Hybrid', 'Bile Blight', 'Wicked Akuba', 'Field of Ruin', 'Nullpriest of Oblivion', 'Raise the Alarm', 'Warkite Marauder', 'Putrid Imp', 'Lead the Stampede', 'Butcher Ghoul', 'Hammer of Bogardan', 'Suffocating Fumes', 'Boot Nipper', 'Rift Sower', 'Icehide Golem', 'Colossus of Akros', 'Painful Truths', 'Braid of Fire', 'Patchwork Automaton', 'Arcbound Prototype', 'Revitalize', 'Otherworldly Gaze', 'Traxos, Scourge of Kroog', 'Primal Command', 'Ravenous Squirrel', 'Go for the Throat', 'Court Homunculus', 'Soul Snare', 'Grave Scrabbler', 'Generous Visitor', 'Chandra, Pyromaster', 'Figure of Destiny', 'Orcish Lumberjack', 'Demonic Dread', 'Frantic Inventory', 'Golgari Rot Farm', 'Avatar of Discord', 'Honden of Seeing Winds', 'Colossal Dreadmaw', 'Scrapyard Recombiner', 'Kazandu Blademaster', 'Pore Over the Pages', 'Ugin''s Conjurant', 'Kird Ape', 'Krark''s Thumb', 'Familiar''s Ruse', 'Banefire', 'Icefall Regent', 'Plow Under', 'Fact or Fiction', 'Snow-Covered Forest', 'Wild Cantor', 'Shinka, the Bloodsoaked Keep', 'Cryptolith Rite', 'Platinum Angel', 'Nested Shambler', 'Mistvein Borderpost', 'Ancient Stirrings', 'Clifftop Retreat', 'Simic Guildgate', 'Guild Globe', 'Prohibit', 'Ruination Guide', 'Tolsimir, Friend to Wolves', 'Divinity of Pride', 'Improbable Alliance', 'Rishadan Dockhand', 'Genesis', 'Hero of Precinct One', 'Mirrorpool', 'Vicious Conquistador', 'Kunoros, Hound of Athreos', 'Blacklance Paragon', 'Secluded Steppe', 'Thraben Inspector', 'Vampire Nighthawk', 'Impostor of the Sixth Pride', 'Ashenmoor Gouger', 'Lodestone Golem', 'Orim''s Chant', 'Silundi Vision', 'Skyclave Cleric', 'Golgari Germination', 'Lyev Skyknight', 'Resurgent Belief', 'Mwonvuli Acid-Moss', 'Liliana''s Caress', 'Woodland Cemetery', 'Forbid', 'Cabal Stronghold', 'Firespout', 'Renewed Faith', 'Acidic Slime', 'Utter End', 'Stirring Wildwood', 'Okiba Reckoner Raid', 'Voltage Surge', 'Fblthp, the Lost', 'Abzan Ascendancy', 'Ally Encampment', 'Howling Mine', 'See the Truth', 'Bygone Bishop', 'Fallen Shinobi', 'Phyrexian Dreadnought', 'Judge''s Familiar', 'Jeskai Ascendancy', 'Dinrova Horror', 'Rocky Tar Pit', 'Wandermare', 'Gitaxian Probe', 'Markov Retribution', 'Advent of the Wurm', 'Taste for Mayhem', 'Flourishing Fox', 'Circuit Mender', 'Cloudcrest Lake', 'Tyrant of Discord', 'Furor of the Bitten', 'Bloodtithe Harvester', 'Battlefield Forge', 'Animation Module', 'Mindlink Mech', 'Tranquil Thicket', 'Vault Skirge', 'Secluded Courtyard', 'Dimir Aqueduct', 'Honor of the Pure', 'Feed the Swarm', 'Archfiend''s Vessel', 'Ondu Cleric', 'Inevitable Betrayal', 'Tyrant''s Scorn', 'Smallpox', 'Skycat Sovereign', 'Goldmire Bridge', 'Hypnotic Siren', 'Temple of Plenty', 'Discovery // Dispersal', 'Coalition Relic', 'Jukai Naturalist', 'Fires of Yavimaya', 'Alms of the Vein', 'Seekers'' Squire', 'Cloudpost', 'Bant Panorama', 'Eye of Vecna', 'Blade Splicer', 'Halimar Excavator', 'Elsewhere Flask', 'Arctic Flats', 'Edric, Spymaster of Trest', 'Syncopate', 'Glacial Fortress', 'Mindslaver', 'Gone Missing', 'Spatial Contortion', 'Rabbit Battery', 'Michiko''s Reign of Truth', 'Teshar, Ancestor''s Apostle', 'Timely Reinforcements', 'Ponder', 'Pyretic Ritual', 'Drownyard Temple', 'Magister of Worth', 'Canopy Cover', 'Ludevic, Necrogenius', 'Tocatli Honor Guard', 'Bontu''s Last Reckoning', 'Protean Hydra', 'Stitch in Time', 'Karn, Silver Golem', 'Staff of Domination', 'Of One Mind', 'Shenanigans', 'Elfhame Palace', 'Chamber Sentry', 'Sanctum of Stone Fangs', 'Last Stand', 'Ornithopter', 'Loyal Pegasus', 'Alchemist''s Retrieval', 'Naya Panorama', 'Xathrid Necromancer', 'Ghastlord of Fugue', 'Touch the Spirit Realm', 'Cloudfin Raptor', 'Vivid Marsh', 'Satyr Hoplite', 'Starstorm', 'Kabira Evangel', 'Door to Nothingness', 'Mistral Charger', 'Moon-Circuit Hacker', 'Master Splicer', 'Dark-Dweller Oracle', 'Golgari Grave-Troll', 'Mistvault Bridge', 'It That Betrays', 'Lyzolda, the Blood Witch'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 72.9, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (65.7 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Behold the Multiverse', 'Champion of Wits', 'Underworld Dreams', 'General Ferrous Rokiric', 'Homestead Courage', 'Mindwrack Demon', 'Forbid', 'Diabolic Edict', 'Forgotten Cave', 'Ob Nixilis, the Fallen', 'Lose Focus', 'Ponder', 'Egon, God of Death', 'Mob Mentality', 'Runic Repetition', 'Dread Presence', 'Thirst for Discovery', 'Sire of Insanity', 'Archfiend''s Vessel', 'Dragonskull Summit', 'Arguel''s Blood Fast', 'An Offer You Can''t Refuse', 'Mask of Griselbrand', 'Orcish Lumberjack', 'Cabaretti Courtyard', 'Thawing Glaciers', 'Vilis, Broker of Blood', 'Dream Trawler', 'Spell Pierce', 'Familiar''s Ruse', 'Tocatli Honor Guard', 'Champion of the Flame', 'Shrieking Affliction', 'Twinblade Geist', 'Fatestitcher', 'It That Betrays', 'Smallpox', 'Vendetta', 'Frontier Bivouac', 'Taborax, Hope''s Demise', 'Demigod of Revenge', 'Simic Charm', 'Sanguine Bond', 'Radiant Scrollwielder', 'Gods Willing', 'Mishra''s Factory', 'Snowfield Sinkhole', 'Game Trail', 'Duress', 'Mythos of Vadrok', 'Underworld Connections', 'Dennick, Pious Apprentice', 'Fieldmist Borderpost', 'Malakir Rebirth', 'Battlefield Forge', 'Rootbound Crag', 'Pelakka Predation', 'Karmic Guide', 'Unburial Rites', 'Outlaws'' Merriment', 'Favored Hoplite', 'Clifftop Retreat', 'Frantic Search', 'Timeless Witness', 'Trostani''s Summoner', 'Black Sun''s Zenith', 'Wrath of God', 'Commune with the Gods', 'Thousand-Faced Shadow', 'March of Burgeoning Life', 'Treasure Cruise', 'Canyon Slough', 'Dragon Mantle', 'Blazing Shoal', 'Heartless Act', 'Bloodtithe Harvester', 'Putrid Imp', 'Foreboding Ruins', 'Korlash, Heir to Blackblade', 'Bala Ged Recovery', 'Pristine Talisman', 'Launch the Fleet', 'Heartless Summoning', 'Electrolyze', 'Faithful Mending', 'Liliana''s Contract', 'Secluded Glen', 'Witch''s Cottage', 'Soulcage Fiend', 'Cabal Stronghold', 'Snapback', 'Nullpriest of Oblivion', 'Blackmail', 'Quest for the Nihil Stone', 'Terastodon', 'Phyrexian Dreadnought', 'Feed the Swarm', 'Canopy Cover', 'Angel of Despair', 'Gitaxian Probe', 'Repeal', 'Primal Empathy', 'Jwari Disruption', 'Gatekeeper of Malakir', 'Slip Out the Back', 'Favor of the Overbeing', 'Ancestral Anger', 'Nefarox, Overlord of Grixis', 'Slaughter Pact', 'Changeling Outcast', 'Taste for Mayhem', 'Cabal Shrine', 'Azorius Charm', 'Abrade', 'Murderous Cut', 'Dream Devourer', 'Ingenious Infiltrator', 'Akroan Crusader', 'Windbrisk Heights', 'Soulherder', 'Flame Slash', 'Fiery Temper', 'Blood Speaker', 'Opt', 'Magister of Worth', 'Alley Evasion', 'Phantasmagorian', 'Izzet Boilerworks', 'Glacial Fortress', 'Lich''s Mastery', 'Nightmare Shepherd', 'Evolving Wilds', 'Natural State', 'Silver-Fur Master', 'Memory''s Journey', 'Obscura Storefront', 'Cold-Eyed Selkie', 'Gatherer of Graces', 'Alpha Authority', 'Memory Lapse', 'Mausoleum Secrets', 'Liliana Vess', 'Animate Dead', 'Summoning Trap', 'Moon-Circuit Hacker', 'Negate', 'Varragoth, Bloodsky Sire', 'Necropolis Fiend', 'Counterflux', 'Ethersworn Canonist', 'Hieroglyphic Illumination', 'Urza''s Factory', 'Blackbloom Rogue', 'Heliod''s Pilgrim', 'Gigantosaurus', 'Hinterland Harbor', 'Pyromancer Ascension', 'Elixir of Immortality', 'Ammit Eternal', 'Bogardan Hellkite', 'Buried Alive', 'Ritual of Restoration', 'Heirloom Mirror', 'Balustrade Spy', 'Ritual of Soot', 'Dread Fugue', 'Asmodeus the Archfiend', 'Condemn', 'Dread Return', 'Undercity Informer', 'Illuminator Virtuoso', 'Darksteel Colossus', 'Chancellor of the Dross', 'Dark Ritual', 'Demonic Bargain', 'Profane Command', 'Tribute to Hunger', 'Mortuary Mire', 'Chain Lightning', 'Temple of Epiphany', 'The Raven''s Warning', 'Tomb of Urami', 'Demonlord Belzenlok', 'Pestilence Demon', 'Postmortem Lunge', 'Okiba Reckoner Raid', 'Sign in Blood', 'Izzet Charm', 'Whirlwind of Thought', 'Fallen Shinobi', 'Stinkweed Imp', 'Vesperlark', 'Lashwrithe', 'Midnight Clock', 'Dinrova Horror', 'Kitchen Imp', 'Flaying Tendrils', 'Alms of the Vein', 'Jack-o''-Lantern', 'Lotleth Giant', 'Sorin Markov', 'Angel of Invention', 'Soul Spike', 'Tymaret, Chosen from Death', 'Faerie Miscreant', 'Crackling Drake', 'Extract the Truth', 'Corrupt', 'Oust', 'Tyrant''s Choice', 'Tangled Florahedron', 'Spider Umbra', 'Rune-Scarred Demon', 'Cruel Bargain', 'Avacyn''s Pilgrim', 'Seizan, Perverter of Truth', 'Coiling Oracle', 'Caves of Koilos', 'Drowned Catacomb', 'Dragonstorm', 'Birds of Paradise', 'Detention Sphere', 'Bloodchief''s Thirst', 'Deep Forest Hermit', 'Hidetsugu, Devouring Chaos', 'Shadowborn Demon', 'Dust Corona', 'Hypnotic Specter', 'Mystic Monastery', 'Necrogen Spellbomb', 'Laboratory Maniac', 'Secluded Courtyard', 'Drossforge Bridge', 'Hymn to Tourach', 'Bile Blight', 'Prosperous Thief', 'Skyclave Shade', 'Generous Visitor', 'Hagra Mauling', 'Admiral''s Order', 'Aethermage''s Touch', 'Firespout', 'Satyr Wayfinder', 'Diabolic Tutor', 'Triskelion', 'Vampire''s Kiss', 'Improbable Alliance', 'Cosmos Elixir', 'Ecstatic Awakener', 'Void Snare', 'Kazandu Mammoth', 'Wild Pair', 'Seal of Removal', 'Azami, Lady of Scrolls', 'Voldaren Epicure', 'Snow-Covered Swamp', 'Angel of Glory''s Rise', 'Thought Scour', 'Force of Despair', 'Erebos''s Intervention', 'Ornithopter', 'Vampire Nighthawk', 'Shrapnel Blast', 'Lonely Sandbar'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 65.7, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (117.3 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Izzet Boilerworks', 'Thaumatic Compass', 'Fallen Shinobi', 'Gideon Jura', 'Falkenrath Pit Fighter', 'Slagwoods Bridge', 'Treefolk Harbinger', 'Elixir of Immortality', 'Wall of Omens', 'Birds of Paradise', 'Arch of Orazca', 'Porphyry Nodes', 'Lose Focus', 'Commit // Memory', 'Touch the Spirit Realm', 'Wrath of God', 'Thawing Glaciers', 'Omen of the Sun', 'Faerie Miscreant', 'Mystifying Maze', 'Giant Ox', 'Ajani Unyielding', 'Graypelt Refuge', 'Jokulhaups', 'Ethersworn Sphinx', 'Jace, the Living Guildpact', 'Distended Mindbender', 'Sylvan Primordial', 'Terastodon', 'Wildfield Borderpost', 'Tendrils of Agony', 'Turnabout', 'Abrade', 'Lonely Sandbar', 'Earthshaker Khenra', 'Dynavolt Tower', 'Nicol Bolas, Planeswalker', 'Thirst for Discovery', 'Clarion Spirit', 'Thornglint Bridge', 'Sylvan Scrying', 'Firespout', 'Colossal Skyturtle', 'Treacherous Blessing', 'Demigod of Revenge', 'Terramorphic Expanse', 'Vivid Grove', 'Spell Pierce', 'Hushwing Gryff', 'Argentum Armor', 'Thought Scour', 'Sylvan Library', 'Ancient Stirrings', 'Frontier Bivouac', 'Reality Ripple', 'Primal Command', 'The Birth of Meletis', 'Temple of Silence', 'Canyon Slough', 'See the Truth', 'Oust', 'Game Trail', 'Doran, the Siege Tower', 'Liliana Vess', 'Fieldmist Borderpost', 'Dread Fugue', 'Stubborn Denial', 'Delver of Secrets', 'Sign in Blood', 'Razortide Bridge', 'Improbable Alliance', 'Prismatic Omen', 'Rings of Brighthearth', 'Memory Lapse', 'Viashino Pyromancer', 'Tomb of Urami', 'Bala Ged Recovery', 'Warstorm Surge', 'Goldmire Bridge', 'Seething Song', 'Mistvein Borderpost', 'Flame Slash', 'Tooth and Nail', 'Mishra''s Factory', 'Sarkhan the Masterless', 'Orcish Lumberjack', 'Hymn to Tourach', 'Auramancer', 'Drowned Catacomb', 'Wooded Bastion', 'Fiery Impulse', 'Grapeshot', 'Ornithopter', 'Triskelion', 'Secluded Glen', 'Vault Skirge', 'Prosperous Thief', 'Timeless Witness', 'Elvish Mystic', 'Hunted Nightmare', 'Treasure Cruise', 'Condemn', 'Thousand-Faced Shadow', 'Slagstorm', 'Feed the Swarm', 'Search for Tomorrow', 'Engulf the Shore', 'Moon-Circuit Hacker', 'Catapult Fodder', 'Forbid', 'Cleansing Wildfire', 'Sephara, Sky''s Blade', 'Talisman of Impulse', 'Mana Leak', 'Mind''s Desire', 'Oracle of Mul Daya', 'Brain Freeze', 'Fire-Lit Thicket', 'Repeal', 'Hunted Horror', 'Rosethorn Acolyte', 'Woodland Wanderer', 'Summary Dismissal', 'Cut // Ribbons', 'Garruk Wildspeaker', 'Burst Lightning', 'Radiant Epicure', 'Deploy the Gatewatch', 'Snowfield Sinkhole', 'Aetherspouts', 'Healer''s Hawk', 'Vapor Snag', 'Mouth of Ronom', 'Realm Razer', 'Bloodbraid Elf', 'Geomancer''s Gambit', 'Greater Gargadon', 'Rhox War Monk', 'Secluded Courtyard', 'Gatekeeper of Malakir', 'Mobilized District', 'Eternal Dragon', 'Tanglepool Bridge', 'Ash Zealot', 'Mysterious Tome', 'Heartless Act', 'Familiar''s Ruse', 'Veinfire Borderpost', 'Grimdancer', 'Silverbluff Bridge', 'Changeling Outcast', 'Samut, Voice of Dissent', 'Mephidross Vampire', 'Hypnotic Specter', 'Tyrant of Discord', 'Phyrexian Dreadnought', 'Negate', 'Scab-Clan Berserker', 'Skyshroud Ranger', 'Jace, Memory Adept', 'Unsubstantiate', 'Fabricate', 'Choking Sands', 'Goblin Dark-Dwellers', 'Temple of Epiphany', 'Glint Hawk', 'Incinerate', 'Tymaret, Chosen from Death', 'Judge''s Familiar', 'Invoke Calamity', 'Vedalken Shackles', 'Carth the Lion', 'Doom Foretold', 'Inscription of Ruin', 'Tower Defense', 'Restore Balance', 'Chain Lightning', 'Hagra Mauling', 'Kumano Faces Kakkazan', 'Dead // Gone', 'Vampire Nighthawk', 'Scoured Barrens', 'Shardless Agent', 'Spikefield Hazard', 'Last Stand', 'Lashwrithe', 'It That Betrays', 'Hour of Promise', 'Prophetic Prism', 'Possibility Storm', 'Slip Out the Back', 'Dark Ritual', 'Caves of Koilos', 'Desperate Ritual', 'Blackbloom Rogue', 'Snow-Covered Forest', 'Primal Amulet', 'Gitaxian Probe', 'Loyal Pegasus', 'Ghitu Lavarunner', 'Primal Surge', 'Bloodchief''s Thirst', 'Evolving Wilds', 'Glimmerpost', 'Counterflux', 'Pieces of the Puzzle', 'Quest for the Holy Relic', 'Cloudpost', 'Urza''s Factory', 'Abzan Charm', 'Sandsteppe Citadel', 'Curious Pair', 'Farseek', 'Frantic Search', 'Firewild Borderpost', 'Mirrorshell Crab', 'Midnight Clock', 'Silver-Fur Master', 'Crackling Drake', 'Forgotten Cave', 'Assault Formation', 'Wild Cantor', 'Llanowar Wastes', 'Ingenious Infiltrator', 'Kaya, Ghost Assassin', 'Tocatli Honor Guard', 'Sorin Markov', 'Dimir Aqueduct', 'Metalwork Colossus', 'Vindicate', 'Hieroglyphic Illumination', 'Duress', 'Flame Rift', 'Coalition Relic', 'Ponder', 'Sejiri Shelter', 'Faerie Vandal', 'Rite of Oblivion', 'Demonic Dread', 'Voyaging Satyr', 'Chamber Sentry', 'Oath of Liliana', 'Ghalta, Primal Hunger', 'Reinforced Ronin'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 117.3, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (62.0 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Smokestack', 'Temple of Silence', 'Chain Lightning', 'Zetalpa, Primal Dawn', 'Dawn of Hope', 'Mindslaver', 'Stubborn Denial', 'Pentarch Ward', 'Prosperous Thief', 'Tyrant of Discord', 'Specter''s Shriek', 'Memory Lapse', 'Mana Leak', 'Talara''s Battalion', 'Outland Liberator', 'Wrath of God', 'Big Game Hunter', 'Spawnsire of Ulamog', 'Saproling Burst', 'Glacial Fortress', 'Birds of Paradise', 'Orim''s Chant', 'Gather the Townsfolk', 'Hypnotic Specter', 'Ironroot Warlord', 'Smallpox', 'Lotleth Troll', 'Swiftwater Cliffs', 'Falkenrath Pit Fighter', 'Fallen Shinobi', 'Treasure Cruise', 'Renegade Doppelganger', 'March of Burgeoning Life', 'Veilborn Ghoul', 'Inkwell Leviathan', 'Ash Zealot', 'Azorius Charm', 'Deep Analysis', 'Vindicate', 'Mystifying Maze', 'Reality Ripple', 'Repeal', 'Sigil Blessing', 'Uba Mask', 'Crackling Drake', 'Grimdancer', 'Ponder', 'Satyr''s Cunning', 'Drogskol Infantry', 'Viashino Pyromancer', 'Incinerate', 'Hard Evidence', 'Pariah', 'Buried Ruin', 'Slagwoods Bridge', 'Darksteel Colossus', 'Condemn', 'Trickbind', 'Bloodbraid Elf', 'Lazotep Plating', 'Detention Sphere', 'Hagra Mauling', 'Llanowar Wastes', 'Kazuul''s Fury', 'Drossforge Bridge', 'Reinforced Ronin', 'Temple of Plenty', 'Animate Dead', 'Earthshaker Khenra', 'Necrogoyf', 'Call of the Herd', 'Burst Lightning', 'Terastodon', 'Faerie Miscreant', 'Cleansing Wildfire', 'Hymn to Tourach', 'Midnight Clock', 'Necrogen Spellbomb', 'Sire of Insanity', 'Abrade', 'Arcane Sanctum', 'Selesnya Charm', 'Dream Trawler', 'Canopy Cover', 'Abundant Harvest', 'Truth or Tale', 'Game Trail', 'Silverbluff Bridge', 'Call of the Conclave', 'Transmogrify', 'Stern Dismissal', 'Spider Umbra', 'Sarcomancy', 'Oracle of Mul Daya', 'Duress', 'Tendo Ice Bridge', 'Tooth and Nail', 'Hissing Quagmire', 'Tectonic Edge', 'Urza''s Factory', 'Sylvan Library', 'Doom Foretold', 'Bala Ged Recovery', 'Evolving Wilds', 'Liliana Vess', 'Radha, Heart of Keld', 'Kitchen Imp', 'Thirst for Discovery', 'Voldaren Pariah', 'Ingenious Infiltrator', 'Delver of Secrets', 'Sorin Markov', 'Sprite Dragon', 'Caves of Koilos', 'Hopeful Eidolon', 'Ethereal Armor', 'Temple of Deceit', 'Bag of Holding', 'Prophetic Prism', 'Demonic Bargain', 'Negate', 'Gitaxian Probe', 'Temple of Epiphany', 'Dread Fugue', 'Talisman of Impulse', 'Ghost Quarter', 'Unflinching Courage', 'Dark Ritual', 'Seasons Past', 'Lose Focus', 'Spikefield Hazard', 'Mouth of Ronom', 'Silundi Vision', 'Eldrazi Mimic', 'Curiosity', 'Kumano Faces Kakkazan', 'Blackbloom Rogue', 'Tymaret Calls the Dead', 'Spectral Procession', 'Ghalta, Primal Hunger', 'Reassembling Skeleton', 'Distended Mindbender', 'Blackmail', 'Haunted Fengraf', 'Ramunap Excavator', 'Temple of Enlightenment', 'Children of Korlis', 'Pull from Eternity', 'Terrarion', 'Sheltering Ancient', 'Mephidross Vampire', 'Temur Ascendancy', 'Sylvan Primordial', 'Pacifism', 'Cartographer''s Survey', 'Frantic Search', 'Forgotten Cave', 'Ilysian Caryatid', 'Asylum Visitor', 'Polymorph', 'Tenacious Dead', 'Phylactery Lich', 'Aphemia, the Cacophony', 'Tallowisp', 'Gatekeeper of Malakir', 'Phyrexian Dreadnought', 'Putrid Imp', 'Michiko''s Reign of Truth', 'Dreadhorde Invasion', 'Cloudpost', 'Unburial Rites', 'Secluded Glen', 'Tempest Djinn', 'Higure, the Still Wind', 'Sylvan Scrying', 'Stinkweed Imp', 'Drowned Catacomb', 'Dizzy Spell', 'Behold the Multiverse', 'Zombie Infestation', 'Slip Out the Back', 'Primal Command', 'Darkmoss Bridge', 'Timeless Witness', 'Flame Rift', 'Mizzium Skin', 'Teysa, Orzhov Scion', 'Blazing Archon', 'Braids, Cabal Minion', 'Gavony Township', 'Eidolon of Countless Battles', 'Treacherous Blessing', 'Hinterland Harbor', 'Reprobation', 'Frontier Bivouac', 'Nether Traitor', 'Runed Halo', 'Spell Pierce', 'Plunge into Darkness', 'Glimmerpost', 'Gisa''s Bidding', 'Snow-Covered Forest', 'Hour of Promise', 'Changeling Outcast', 'Generous Visitor', 'Izzet Charm', 'Riveteers Charm', 'Thousand-Faced Shadow', 'Woodland Cemetery', 'Angelic Gift', 'Tyrant''s Scorn', 'Intangible Virtue', 'Wooded Bastion', 'Fact or Fiction', 'Coalition Relic', 'Pathrazer of Ulamog', 'Goldmire Bridge', 'Kher Keep', 'Moon-Circuit Hacker', 'Raise the Alarm', 'Vault of the Archangel', 'Dimir Aqueduct', 'Thought Scour', 'Explore', 'Realm Razer', 'Silver-Fur Master', 'Twinblade Geist', 'Stirring Wildwood', 'Tombstalker', 'Vapor Snag', 'Warriors'' Lesson', 'Cryptic Caves', 'Improbable Alliance', 'Forbid', 'Garruk Wildspeaker', 'Liliana''s Devotee', 'Scab-Clan Berserker', 'It That Betrays', 'Triskelion', 'Jokulhaups', 'Laboratory Maniac', 'Ancient Stirrings', 'Arch of Orazca', 'Bloodchief''s Thirst', 'Soulflayer', 'Ghitu Lavarunner', 'Rite of Oblivion'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 62.0, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (72.5 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Barrin, Tolarian Archmage', 'Pestilent Haze', 'Steel Hellkite', 'Metalwork Colossus', 'Adorned Pouncer', 'Gruul Turf', 'Wrath of God', 'Toils of Night and Day', 'Ghost Quarter', 'Prophet of Kruphix', 'Fire Covenant', 'Wall of Omens', 'Thawing Glaciers', 'Omen of the Forge', 'Trickbind', 'Thought Erasure', 'Blightning', 'Ensoul Artifact', 'Oracle of Mul Daya', 'Tempest Djinn', 'Tradewind Rider', 'Bond of Insight', 'Rise and Shine', 'Temple of Malice', 'Chemister''s Insight', 'Future Sight', 'Faerie Miscreant', 'Cathar Commando', 'Radiant Scrollwielder', 'Curiosity', 'Vault of the Archangel', 'Draconic Roar', 'Temple of Silence', 'Scourge Wolf', 'Soaring Thought-Thief', 'Talus Paladin', 'Reinforced Ronin', 'Skirge Familiar', 'Lumbering Falls', 'Viridian Emissary', 'The Scorpion God', 'Lodestone Golem', 'Snow-Covered Swamp', 'Alms of the Vein', 'Painful Truths', 'Prism Ring', 'Chief Engineer', 'Dennick, Pious Apprentice', 'Diabolic Edict', 'Infernal Grasp', 'Okina, Temple to the Grandfathers', 'World Shaper', 'Condemn', 'Etali, Primal Storm', 'Cabal Stronghold', 'Blackmail', 'Serrated Scorpion', 'Vantress Gargoyle', 'Talisman of Resilience', 'Hymn to Tourach', 'Sejiri Steppe', 'Eldrazi Skyspawner', 'Tandem Lookout', 'Specter''s Shriek', 'Bontu''s Last Reckoning', 'Justice Strike', 'Drana''s Emissary', 'Boros Reckoner', 'Jushi Apprentice', 'Inspired Ultimatum', 'Barbarian Ring', 'Laboratory Maniac', 'Murderous Cut', 'Champion of the Parish', 'Consume Spirit', 'Mission Briefing', 'Garruk Wildspeaker', 'Artificer''s Assistant', 'Ripjaw Raptor', 'Lotleth Giant', 'Brainspoil', 'Aether Spellbomb', 'Sorin Markov', 'Night of Souls'' Betrayal', 'Stirring Wildwood', 'Wood Elves', 'Student of Warfare', 'Moonsnare Prototype', 'Vexing Shusher', 'Metallic Rebuke', 'Sphinx''s Tutelage', 'Game Trail', 'Spark Spray', 'Tyrant''s Choice', 'Kitchen Imp', 'Riveteers Charm', 'Eerie Interlude', 'Riftwing Cloudskate', 'Commit // Memory', 'Llanowar Elves', 'Mishra''s Factory', 'Resurgent Belief', 'Lightning Strike', 'Nivix, Aerie of the Firemind', 'Clifftop Retreat', 'Delver of Secrets', 'Fiery Gambit', 'Golgari Rot Farm', 'Kessig Wolf Run', 'Theater of Horrors', 'Abiding Grace', 'Izzet Locket', 'Coalition Relic', 'Chief of the Foundry', 'Wooded Bastion', 'Zombie Infestation', 'Myr Battlesphere', 'Disciple of the Vault', 'Haunted Fengraf', 'Brood Birthing', 'Always Watching', 'Wayward Guide-Beast', 'Demigod of Revenge', 'Jolt', 'Temple of Mystery', 'Pulse of Murasa', 'Jack-o''-Lantern', 'Cerodon Yearling', 'Taurean Mauler', 'Bloodline Keeper', 'Unravel the Aether', 'Jace, the Living Guildpact', 'Day of Judgment', 'Soul Spike', 'Thaumatic Compass', 'Gatekeeper of Malakir', 'Serene Steward', 'Kavu Predator', 'Demonfire', 'Thirst for Knowledge', 'Master of Etherium', 'Ancestral Anger', 'Abundant Harvest', 'Rally the Ranks', 'Meteor Golem', 'Melek, Izzet Paragon', 'Azure Mage', 'Thoughtpicker Witch', 'Bump in the Night', 'Nameless Inversion', 'Silverbluff Bridge', 'Weathered Wayfarer', 'Etherium Sculptor', 'Rise // Fall', 'Tendrils of Agony', 'Night Market Lookout', 'Etched Monstrosity', 'Remorseful Cleric', 'Cyclone Summoner', 'Survivor of the Unseen', 'Magister of Worth', 'Incinerate', 'Asmodeus the Archfiend', 'Dream Twist', 'Riptide Laboratory', 'Keldon Megaliths', 'Lunarch Veteran', 'Myr Moonvessel', 'Talisman of Impulse', 'Joraga Treespeaker', 'Tyrant of Discord', 'Bane of Bala Ged', 'Thirst for Discovery', 'Raging Ravine', 'Far // Away', 'Jace''s Archivist', 'Drossforge Bridge', 'Raze the Effigy', 'Putrefy', 'Scholar of the Ages', 'Glint Hawk', 'Captivating Vampire', 'Universal Automaton', 'Ravenous Chupacabra', 'Turnabout', 'Heartless Act', 'Riverwise Augur', 'Overgrown Battlement', 'Sword-Point Diplomacy', 'Grand Architect', 'Haunted Cloak', 'Sygg, River Cutthroat', 'Dauntless Bodyguard', 'Jaya''s Immolating Inferno', 'Flourishing Fox', 'Cursecatcher', 'Indebted Samurai', 'Brave the Elements', 'Trading Post', 'Conduit of Ruin', 'Pull from Tomorrow', 'Tempered Steel', 'Court Homunculus', 'Dovin Baan', 'Runed Halo', 'Liliana''s Caress', 'Memory''s Journey', 'Merchant of the Vale', 'Vraska''s Contempt', 'Lost Legacy', 'Marauding Raptor', 'Banishing Slash', 'Grapeshot', 'Primal Amulet', 'Strike It Rich', 'Gitaxian Probe', 'Dispel', 'Ramunap Excavator', 'Stoke the Flames', 'Arguel''s Blood Fast', 'Restore Balance', 'Gavony Township', 'Sacred Cat', 'Skyclave Cleric', 'Viashino Pyromancer', 'Urza''s Factory', 'Wild Nacatl', 'Azami, Lady of Scrolls', 'Kumano Faces Kakkazan', 'Phantasmagorian', 'Treasure Cruise', 'Slip Out the Back', 'Icehide Golem', 'Patchwork Automaton', 'Lucky Offering', 'Pride Sovereign', 'Circular Logic', 'Mouth of Ronom', 'Kabira Evangel', 'Plow Under', 'Tomb of Urami', 'Plaguecrafter', 'Hand of Emrakul', 'Augur of Bolas', 'Eternal Dragon', 'Tome Scour', 'Adanto Vanguard', 'Noose Constrictor', 'Phyrexian Dreadnought', 'Angel of Sanctions', 'Spikefield Hazard', 'Vicious Conquistador', 'Goblin Matron', 'Kinjalli''s Caller', 'Samurai of the Pale Curtain', 'Joraga Warcaller', 'King of the Pride', 'Kuldotha Rebirth', 'Embodiment of Agonies', 'Pentavus', 'Ritual of Soot', 'Wingmate Roc', 'Izzet Cluestone', 'Goblin Settler', 'Ash Zealot', 'Last Word', 'Discordant Piper', 'Tangled Florahedron', 'Merfolk Windrobber', 'Faerie Vandal', 'Underworld Connections', 'Bogardan Hellkite', 'Chandra, Pyromaster', 'Ransack the Lab', 'Shuko', 'Gideon Jura', 'Brass Knuckles', 'Strategic Planning', 'Mindlash Sliver', 'Liquimetal Coating', 'Hostage Taker', 'Never // Return', 'Temple of Plenty', 'Wild Mongrel', 'Whip of Erebos', 'Toolcraft Exemplar', 'Neverending Torment', 'Impostor of the Sixth Pride', 'Jester''s Scepter', 'Logic Knot', 'Devoted Retainer', 'Birds of Paradise', 'Feed the Swarm', 'Sprite Dragon', 'Arcbound Worker', 'Tectonic Edge', 'Lys Alana Huntmaster', 'Throne of the God-Pharaoh', 'Inexorable Blob', 'Circuit Mender', 'Sleeper Dart', 'Kiln Fiend', 'Yidaro, Wandering Monster', 'Cranial Extraction', 'Keruga, the Macrosage', 'Flame Slash', 'Slayers'' Stronghold', 'Crackling Drake', 'Drowned Catacomb', 'Memory Sluice', 'Falkenrath Pit Fighter', 'Elvish Archdruid', 'Jori En, Ruin Diver', 'Seaside Citadel', 'Underworld Dreams', 'Barrenton Medic', 'Flame Jab', 'General Ferrous Rokiric', 'The Biblioplex', 'Experimental Synthesizer', 'Animation Module', 'Drake Haven', 'Zabaz, the Glimmerwasp', 'Fleecemane Lion', 'Thryx, the Sudden Storm', 'Demon''s Disciple', 'Inspiring Statuary', 'Orcish Lumberjack', 'Forbidden Alchemy', 'Dread Return', 'Sensei Golden-Tail', 'Goblin Bombardment', 'Memory Lapse', 'Force of Rage', 'Veinfire Borderpost', 'Crater''s Claws', 'Twitch', 'Reality Ripple', 'Mortuary Mire', 'Hinterland Harbor', 'Judge''s Familiar', 'Ammit Eternal', 'Regal Force', 'Sylvan Library', 'Stern Dismissal', 'Vampire Neonate', 'Drannith Healer', 'Moon-Circuit Hacker', 'Elvish Rejuvenator', 'Ral, Storm Conduit', 'Hornet Queen', 'Martyr''s Soul', 'Char', 'Gravebreaker Lamia', 'Pain Seer', 'Cut // Ribbons', 'Realm Razer', 'Sanguine Bond', 'Syncopate', 'Firespout', 'Eye of Vecna', 'Stinkdrinker Bandit', 'Lavaclaw Reaches', 'Nissa, Worldwaker', 'Foreboding Ruins', 'Snow-Covered Forest', 'Dwynen''s Elite', 'Decree of Justice', 'Centaur Peacemaker', 'Twinshot Sniper', 'Dragonskull Summit', 'Bile Blight', 'Whisper Squad', 'Caves of Koilos', 'Lone Rider', 'Power Depot', 'Guild Globe', 'Phylactery Lich', 'Goblin Assault', 'Shredded Sails', 'Find // Finality', 'Duress', 'Fraying Sanity', 'Goldmire Bridge', 'Primal Command', 'Grim Lavamancer', 'Farhaven Elf', 'Goblin Trashmaster', 'Elvish Visionary', 'Riveteers Overlook', 'Spatial Contortion', 'Worship', 'Selesnya Sanctuary', 'Stingscourger', 'Shardless Agent', 'Soul Snare', 'Star Compass', 'Imperious Mindbreaker', 'Silver-Fur Master', 'Invigorate', 'Sterling Grove', 'Glen Elendra Archmage', 'Platinum Angel', 'Fire-Lit Thicket', 'Blade Splicer', 'Jadelight Ranger', 'Midnight Clock', 'Growth-Chamber Guardian', 'Ajani, Caller of the Pride', 'Basking Rootwalla', 'Steel Overseer', 'Vampire Lacerator', 'Thraben Inspector', 'Nezahal, Primal Tide', 'Mulch', 'Centaur Garden', 'Scoured Barrens', 'Ruin Crab', 'Eater of Virtue', 'Myojin of Seeing Winds', 'Malakir Rebirth', 'Psychatog', 'Opt', 'Rabbit Battery', 'Bloodbraid Marauder', 'Ghitu Lavarunner', 'Vapor Snag', 'Sacred Ground', 'Smother', 'Unpredictable Cyclone', 'Tajic, Legion''s Edge', 'The Mirari Conjecture', 'Honden of Cleansing Fire', 'Frost Titan', 'Burning Inquiry', 'Oracle''s Vault', 'Hypnotic Specter', 'Mind''s Desire', 'Seal of Fire', 'Tymaret, Chosen from Death', 'Asylum Visitor', 'Momentary Blink', 'Woodfall Primus', 'Liliana Vess', 'Dwarven Mine', 'Dryad Militant', 'Sylvan Scrying', 'Secluded Steppe', 'Chalice of Life', 'Thrashing Brontodon', 'Soul Warden', 'Gnarlwood Dryad', 'Piranha Marsh', 'Lonely Sandbar', 'Sanctum of Stone Fangs', 'Cloudpost', 'Iron Apprentice', 'Orim''s Chant', 'Falkenrath Aristocrat', 'Aethermage''s Touch', 'Secluded Glen', 'Voldaren Epicure', 'Psychogenic Probe', 'Cleansing Wildfire', 'Seismic Assault', 'Hand of Honor', 'Memoricide', 'Glacial Fortress', 'Infinite Obliteration', 'Changeling Outcast', 'Snow-Covered Plains', 'Neutralize', 'Glass Casket', 'The Birth of Meletis', 'Faithful Mending', 'Snow-Covered Mountain', 'Kitsune Blademaster', 'Witch''s Cottage', 'Skirk Prospector', 'Mirari''s Wake', 'Servo Exhibition', 'Hidden Strings', 'Fanatic of Mogis', 'Labyrinth of Skophos', 'Demonic Dread', 'Oni-Cult Anvil', 'Manor Gargoyle', 'Maestros Theater', 'Hero of Precinct One', 'Ezuri, Renegade Leader', 'Desecration Demon', 'Goblin Bushwhacker', 'Obelisk of Urd', 'Teferi, Mage of Zhalfir', 'Familiar''s Ruse', 'Oath of Chandra', 'Oblivion Ring', 'Kuldotha Forgemaster', 'Pelakka Predation', 'Cloudstone Curio', 'Blackbloom Rogue', 'Rift Sower', 'Forgotten Cave', 'Revitalize', 'Elspeth''s Nightmare', 'Gilded Lotus', 'Mogg Fanatic', 'Pyroclasm', 'Devout Chaplain', 'Thousand-Faced Shadow', 'Mirage Mirror', 'Terramorphic Expanse', 'Feline Sovereign', 'Endbringer', 'Gather the Townsfolk', 'Thassa''s Intervention', 'Sleeper Agent', 'Djinn of Wishes', 'Volcanic Salvo', 'Chancellor of the Dross', 'Rustvale Bridge', 'Ojutai''s Command', 'Takeno, Samurai General', 'Molten Psyche', 'Ancient Stirrings', 'Quest for the Holy Relic', 'Dega Sanctuary', 'Tempered in Solitude', 'Lantern of the Lost', 'Mikokoro, Center of the Sea', 'Crackling Doom', 'Arcbound Mouser', 'Blossoming Sands', 'Seeker of the Way', 'Into the Story', 'Realms Uncharted', 'Kaya, Ghost Assassin', 'Mind Sculpt', 'Myriad Construct', 'Jace, Memory Adept', 'Glimmerpost', 'Nomad Stadium', 'Bramblewood Paragon', 'Razortide Bridge', 'Knight of the Stampede', 'Animate Dead', 'Riddlesmith', 'Arch of Orazca', 'Taigam''s Scheming', 'Temple of Triumph', 'Burn from Within', 'Erebos''s Intervention', 'Ondu Inversion', 'Scuttling Doom Engine', 'Wedding Invitation', 'Goblin Dark-Dwellers', 'Pulse Tracker', 'Fatigue', 'Wild Cantor', 'Wretched Gryff', 'Empty the Warrens', 'Obscura Storefront', 'Ranger of Eos', 'Mizzium Skin', 'Master of Death', 'Unburial Rites', 'Beast Whisperer', 'Needle Spires', 'Quest for the Nihil Stone', 'Kjeldoran Outpost', 'Rites of Initiation', 'Arcane Melee', 'Crux of Fate', 'Hidetsugu''s Second Rite', 'Hissing Quagmire', 'Foundry Street Denizen', 'Exquisite Blood', 'Arcbound Reclaimer', 'Tithe Taker', 'Careful Consideration', 'Arcbound Ravager', 'Arrogant Wurm', 'Satyr Wayfinder', 'Battlefield Forge', 'Cabal Therapist', 'Ally Encampment', 'Ingenious Infiltrator', 'Think Twice', 'Howling Mine', 'Forbid', 'Drannith Stinger', 'Lorthos, the Tidemaker', 'Verdurous Gearhulk', 'Frantic Search', 'Shatter the Sky', 'Elspeth Conquers Death', 'Drowned Secrets', 'Gray Merchant of Asphodel', 'Undead Butler', 'Giant Killer', 'Risona, Asari Commander', 'Mukotai Soulripper', 'Deep Forest Hermit', 'Sarkhan, the Dragonspeaker', 'Squadron Hawk', 'Rude Awakening', 'Vivid Marsh', 'Moonsilver Key', 'Hagra Mauling', 'Survival Cache', 'Scrabbling Claws', 'Radiant Flames', 'Eldrazi Conscription', 'Candles of Leng', 'Konda''s Hatamoto', 'Paradoxical Outcome', 'Angel of Glory''s Rise', 'Martyr of Sands', 'Darkmoss Bridge', 'Prosperous Thief', 'Liquimetal Torque', 'Honden of Infinite Rage', 'Encroaching Wastes', 'Butcher of the Horde', 'Glorybringer', 'Makeshift Mannequin', 'Brokers Hideout', 'Into the Roil', 'Dream Trawler', 'Sphinx Ambassador', 'Chromatic Lantern', 'Reckless Impulse', 'Outland Liberator', 'Everflowing Chalice', 'Soul''s Attendant', 'Resistance Squad', 'Sovereign''s Bite', 'Thornglint Bridge', 'Warden of the First Tree', 'Cathartic Reunion', 'Haktos the Unscarred', 'Dakmor Salvage', 'Blazing Rootwalla', 'Sleight of Hand', 'Thought Scour', 'Siege-Gang Commander', 'Magus of the Future', 'Westvale Abbey', 'Searing Spear', 'Glaze Fiend', 'Sky Terror', 'Lochmere Serpent', 'Sadistic Sacrament', 'Wastes', 'Goblin Ringleader', 'Yahenni''s Expertise', 'Expansion // Explosion', 'Mogg War Marshal', 'Shrieking Affliction', 'Bloodbraid Elf', 'Spitemare', 'Mind Funeral', 'Diviner''s Lockbox', 'Goblin Cratermaker', 'Bloodtithe Harvester', 'Mistvein Borderpost', 'Search Party Captain', 'Obstinate Baloth', 'Restoration Angel', 'Shigeki, Jukai Visionary', 'Summer Bloom', 'Linessa, Zephyr Mage', 'Kira, Great Glass-Spinner', 'Earthshaker Khenra', 'Spear of Heliod', 'Silundi Vision', 'Elder Deep-Fiend', 'Triskaidekaphobia', 'Necrotic Sliver', 'Kunoros, Hound of Athreos', 'Sejiri Shelter', 'Goblin Electromancer', 'It That Betrays', 'Mothdust Changeling', 'Pyxis of Pandemonium', 'Talisman of Conviction', 'Soulherder', 'Vivid Grove', 'Vampire Opportunist', 'Evolving Wilds', 'Kazuul''s Fury', 'Mistvault Bridge', 'Luminarch Ascension', 'Conclave Mentor', 'Orzhov Signet', 'Cartographer''s Survey', 'Buried Alive', 'Fatestitcher', 'Hada Freeblade', 'Sandsteppe Citadel', 'Ad Nauseam', 'Discovery // Dispersal', 'Staff of Domination', 'Artisan of Kozilek', 'Mentor of the Meek', 'Goblin Warchief', 'Inscription of Ruin', 'Snowfield Sinkhole', 'Naga Oracle', 'Dawn of Hope', 'Elfhame Palace', 'Nearheath Pilgrim', 'Jeskai Ascendancy', 'Kederekt Leviathan', 'Vorapede', 'Blighted Agent', 'Woodland Cemetery', 'Honor of the Pure', 'Mizzium Mortars', 'Swiftblade Vindicator', 'Prophetic Prism', 'Jace''s Sanctum', 'Wayward Swordtooth', 'Victim of Night', 'Hunted Horror', 'Reliquary Tower', 'Master of the Wild Hunt', 'Soul Transfer', 'Electrolyze', 'Consign // Oblivion', 'Shaile, Dean of Radiance', 'Countryside Crusher', 'Furyblade Vampire', 'Hour of Promise', 'Mephidross Vampire', 'Tooth and Nail', 'Semblance Anvil', 'Sunhome, Fortress of the Legion', 'Sage of Epityr', 'Raven''s Crime', 'Acidic Slime', 'Ogre-Head Helm', 'Rule of Law', 'Quarantine Field', 'Charging Monstrosaur', 'Psychic Possession', 'Dreamborn Muse', 'Angel of Despair', 'Morselhoarder', 'Elsewhere Flask', 'Cosmos Elixir', 'Seasons Past', 'Thada Adel, Acquisitor', 'Behold the Multiverse', 'Viscera Seer', 'Terminus', 'Niv-Mizzet, the Firemind', 'Colossal Plow', 'Cordial Vampire', 'Kazandu Blademaster', 'Kami of the Crescent Moon', 'Drakuseth, Maw of Flames', 'Charmed Stray', 'Qasali Ambusher', 'Prismatic Lens', 'Colossus of Akros', 'Tocatli Honor Guard', 'Spell Pierce', 'Countervailing Winds', 'Honden of Night''s Reach', 'Rune-Scarred Demon', 'Lightning Rift', 'Stone Haven Outfitter', 'Nezumi Shortfang', 'Colossal Skyturtle', 'Zendikar''s Roil', 'Slagwoods Bridge', 'Curse of the Swine', 'Loam Lion', 'Conclave Tribunal', 'Yavimaya Elder', 'Faithless Salvaging', 'Cabaretti Courtyard', 'Spawning Pool', 'Endless Horizons', 'Grisly Salvage', 'Stubborn Denial', 'Invoke Calamity', 'Esper Charm', 'Argentum Armor', 'Wildfield Borderpost', 'Lose Focus', 'Gideon''s Intervention', 'Terastodon', 'Sylvan Messenger', 'Endless One', 'Mutilate', 'Treacherous Blessing', 'Signal Pest', 'Ponder', 'Glory-Bound Initiate', 'Renewed Faith', 'Planar Bridge', 'Temple of Deceit', 'Consuming Aberration', 'Pathrazer of Ulamog', 'Jokulhaups', 'Field of Ruin', 'Pyretic Ritual', 'Wheel of Fate', 'Temple of Enlightenment', 'Mindslaver', 'Desolate Lighthouse', 'Debt to the Kami', 'Peer Through Depths', 'Howl of the Horde', 'Oust', 'Crypt Ghast', 'Triskelion', 'Negate', 'Angel''s Grace', 'Sunbond', 'Fallen Shinobi', 'Nomad Outpost', 'Precognition Field', 'Desperate Ritual', 'Brain Freeze', 'Nightveil Specter', 'Jace''s Phantasm', 'Buried Ruin', 'Arcanis the Omnipotent', 'Prizefight', 'Sunscour', 'Banefire', 'Escape Protocol', 'Akroma''s Memorial', 'Zhalfirin Void', 'Sai of the Shinobi', 'Timely Reinforcements', 'Fact or Fiction', 'Eternal Scourge', 'Dark Ritual', 'Repeal', 'Hushwing Gryff', 'Firewild Borderpost', 'Touch the Spirit Realm', 'Mirror of Fate', 'Ethereal Absolution', 'Arcane Sanctum', 'Sacred Fire', 'Commune with Dinosaurs', 'Fanning the Flames', 'Haven of the Spirit Dragon', 'Ethersworn Canonist', 'Wonder', 'Planar Portal', 'Ignite Memories', 'Torment of Scarabs', 'Dread Fugue', 'Telling Time', 'Ambitious Farmhand', 'Mudslide', 'Enter the God-Eternals', 'Ajani Goldmane', 'Naomi, Pillar of Order', 'Fieldmist Borderpost', 'Arcbound Javelineer', 'Blazing Shoal', 'Hazoret''s Undying Fury', 'Approach of the Second Sun', 'Cathartic Pyre', 'Radha, Heart of Keld', 'Mystifying Maze', 'Hieroglyphic Illumination', 'Champion of Wits', 'Vindicate', 'Increasing Vengeance', 'Anax, Hardened in the Forge', 'Wilt-Leaf Liege', 'Carnival // Carnage', 'Sylvan Primordial', 'Michiko''s Reign of Truth', 'Kazandu Mammoth', 'Rakdos Headliner', 'Merfolk Secretkeeper', 'Oath of Teferi', 'Norn''s Annex', 'Disciple of the Ring', 'Bushi Tenderfoot', 'Myr Incubator', 'Etherium Spinner', 'Haunting Echoes', 'Bone Shards', 'Koll, the Forgemaster', 'Fabricate', 'Thopter Assembly', 'Ghalta, Primal Hunger', 'Balustrade Spy', 'Vampire of the Dire Moon', 'Izzet Boilerworks', 'Scryb Ranger', 'Zurgo Bellstriker', 'Bedlam Reveler', 'Fiery Temper', 'Vault Skirge', 'Double Vision', 'Commune with the Gods', 'Ajani''s Mantra', 'Okiba Reckoner Raid', 'Ajani''s Pridemate', 'Memnarch', 'Blasphemous Act', 'Mistveil Plains', 'Mobilized District', 'Grimdancer', 'Vampire Nighthawk', 'Cloudblazer', 'Seething Song', 'Sea Gate Wreckage', 'Elvish Mystic', 'Sickening Shoal', 'Dungrove Elder', 'Flood Plain', 'Goblin Arsonist', 'Fling', 'Kabira Takedown', 'Scrapheap Scrounger', 'Dream''s Grip', 'Acolyte of Affliction', 'Necrotic Ooze', 'Zombify', 'Pack Rat', 'Bad River', 'Cliffhaven Vampire', 'Mystic Monastery', 'Throne of Geth', 'Bloodchief''s Thirst', 'Archaeomancer', 'Muddle the Mixture', 'Fires of Yavimaya', 'Jace Beleren', 'Stromkirk Noble', 'Putrid Imp', 'Indulgent Aristocrat', 'Tectonic Giant', 'Shrapnel Blast', 'Call to Glory', 'Nature''s Lore', 'Gargoyle Castle', 'Sorin''s Vengeance', 'Doomed Traveler', 'Alchemist''s Vial', 'Deep Analysis', 'Simic Charm', 'Bitter Ordeal', 'Blacksmith''s Skill', 'Araba Mothrider', 'Watcher for Tomorrow', 'Rootbound Crag', 'Explore', 'Lead the Stampede', 'Moderation', 'Undercity Informer', 'Search for Tomorrow', 'Detention Sphere', 'Reveillark', 'Oathkeeper, Takeno''s Daisho', 'Smallpox', 'The Raven''s Warning', 'Jwari Disruption', 'Canyon Slough', 'Gonti, Lord of Luxury', 'Tombstalker', 'Mirrorshell Crab', 'Quest for Ancient Secrets', 'Elixir of Immortality', 'Nevinyrral''s Disk', 'Ornithopter', 'Venerated Loxodon', 'Upheaval', 'Eldrazi Mimic', 'Insolent Neonate', 'Valiant Changeling', 'Solitary Confinement', 'Secluded Courtyard', 'Honored Hydra', 'Bala Ged Recovery', 'Leonin Relic-Warder', 'Distended Mindbender', 'Fanatical Firebrand', 'Fauna Shaman', 'Benalish Marshal', 'Knight of the Reliquary', 'Borrowed Time', 'Sarkhan the Masterless', 'Death Cloud', 'Gilded Pinions', 'Llanowar Wastes', 'Falkenrath Gorger', 'Frostwalk Bastion', 'Hotshot Mechanic', 'Mythos of Illuna', 'Otherworldly Gaze', 'Sylvan Advocate', 'Breaking // Entering', 'First-Sphere Gargantua', 'Vampire''s Kiss', 'Greater Gargadon', 'Dreadhorde Invasion', 'Kami of False Hope', 'Temple of Epiphany', 'Wrench Mind', 'Overeager Apprentice', 'Genesis Wave', 'Panoptic Mirror', 'Chain Lightning', 'Burst Lightning', 'Increasing Devotion', 'Marwyn, the Nurturer', 'Sign in Blood', 'Dread Presence', 'Kalastria Healer', 'Fyndhorn Elves', 'Phoenix of Ash', 'Abrade', 'Clarion Spirit', 'Padeem, Consul of Innovation', 'Genesis', 'Mana Leak', 'Timeless Witness', 'Apex of Power', 'Deranged Assistant', 'Quicken', 'Nevermore'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 72.5, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (61.1 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Hero''s Downfall', 'Hostage Taker', 'Faithful Mending', 'Chasm Skulker', 'Hagra Mauling', 'Dragonskull Summit', 'Teferi''s Ageless Insight', 'Grim Haruspex', 'Bounty of the Luxa', 'Argentum Armor', 'Abiding Grace', 'Kitesail Cleric', 'Shard Volley', 'Glen Elendra Archmage', 'Dwynen''s Elite', 'Tyrant''s Scorn', 'Sorin Markov', 'Frantic Inventory', 'Flame-Kin Zealot', 'Kjeldoran Outpost', 'Twincast', 'Boros Reckoner', 'Devastating Summons', 'Gadwick, the Wizened', 'Selective Memory', 'Immolating Souleater', 'Dire Tactics', 'Woodland Cemetery', 'Pain''s Reward', 'Ritual of Subdual', 'Search for Tomorrow', 'Clifftop Retreat', 'Blood Vassal', 'Vault Skirge', 'Laboratory Maniac', 'Divinity of Pride', 'Marwyn, the Nurturer', 'Dire Fleet Daredevil', 'Deep Analysis', 'Cleansing Wildfire', 'Curious Pair', 'Tymaret, Chosen from Death', 'Vault of the Archangel', 'Michiko''s Reign of Truth', 'Fblthp, the Lost', 'Delver of Secrets', 'Cartel Aristocrat', 'Dire Fleet Captain', 'Caves of Koilos', 'Heartless Act', 'Tome Scour', 'Revitalize', 'Court Homunculus', 'Lashwrithe', 'Vampire Nighthawk', 'Secluded Courtyard', 'Warkite Marauder', 'Loxodon Warhammer', 'Rift Sower', 'Sign in Blood', 'Sylvan Library', 'Oracle of Mul Daya', 'Stern Dismissal', 'Hero of Precinct One', 'Ghost Quarter', 'Wrath of God', 'Thought Scour', 'Malakir Rebirth', 'Armament Master', 'Bazaar Trader', 'Captain''s Claws', 'Fauna Shaman', 'Prophet of Kruphix', 'Gonti, Lord of Luxury', 'Cruel Bargain', 'Fanatical Firebrand', 'Harmless Offering', 'Faerie Vandal', 'Grimdancer', 'Game Trail', 'Hissing Quagmire', 'Icehide Golem', 'Altar of the Brood', 'Admiral Beckett Brass', 'Shuko', 'Akroma''s Memorial', 'Mentor of the Meek', 'Deathless Knight', 'Black Sun''s Zenith', 'Rosethorn Acolyte', 'Blackbloom Rogue', 'Thraben Inspector', 'Perilous Myr', 'Kitesail Apprentice', 'Blighted Agent', 'Wall of Omens', 'Foreboding Ruins', 'Glint Hawk', 'Daring Buccaneer', 'Demigod of Revenge', 'Ornithopter', 'Crumbling Necropolis', 'Tranquil Cove', 'Pyretic Ritual', 'Sphinx''s Tutelage', 'Lys Alana Huntmaster', 'Reality Ripple', 'Glacial Fortress', 'Ruin Crab', 'Fire Covenant', 'Ominous Seas', 'Llanowar Tribe', 'Stone Haven Outfitter', 'Sandwurm Convergence', 'Pull from Tomorrow', 'Snowfield Sinkhole', 'Midnight Clock', 'Izzet Boilerworks', 'Blazing Shoal', 'Drowned Secrets', 'Firebrand Archer', 'Canyon Slough', 'Evolving Wilds', 'Muddle the Mixture', 'Blade Splicer', 'Ayli, Eternal Pilgrim', 'Witch''s Cottage', 'Brokers Hideout', 'Diamond Lion', 'Behold the Multiverse', 'Soul Spike', 'Servo Exhibition', 'Bump in the Night', 'Touch the Spirit Realm', 'Vampire''s Kiss', 'Scryb Ranger', 'Beyeen Veil', 'Vapor Snag', 'Ezuri, Renegade Leader', 'Sanguine Bond', 'Condemn', 'Phyrexian Dreadnought', 'Rabbit Battery', 'Hypnotic Specter', 'Underworld Connections', 'Hinterland Harbor', 'Timeless Witness', 'Shred Memory', 'Dire Fleet Poisoner', 'Jwari Disruption', 'Gitaxian Probe', 'Signal Pest', 'Peer Through Depths', 'Elvish Mystic', 'Dimir Machinations', 'Liliana''s Standard Bearer', 'Intervention Pact', 'Fumigate', 'Akroma, Angel of Fury', 'Birds of Paradise', 'Open the Armory', 'Falkenrath Noble', 'Duress', 'Dream Trawler', 'Forsaken Sanctuary', 'Possibility Storm', 'Bramblewood Paragon', 'Keldon Megaliths', 'Heartless Summoning', 'Temple of Enlightenment', 'Darkmoss Bridge', 'Llanowar Elves', 'Sleight of Hand', 'Clarion Spirit', 'Temple of Mystery', 'Figure of Destiny', 'Rustvale Bridge', 'Arch of Orazca', 'Fathom Fleet Captain', 'Dread Fugue', 'Hymn to Tourach', 'Chancellor of the Spires', 'Silundi Vision', 'Forerunner of the Coalition', 'Bedlam Reveler', 'Seal of Fire', 'Blightning', 'Scoured Barrens', 'Needle Spires', 'Ghirapur Orrery', 'Torrent Sculptor', 'Fyndhorn Elves', 'Regal Force', 'Spell Pierce', 'Arcbound Ravager', 'Viashino Pyromancer', 'Castigate', 'Jace''s Phantasm', 'Turnabout', 'Dovescape', 'Snow-Covered Plains', 'Vantress Gargoyle', 'Basal Sliver', 'Lose Focus', 'Ghitu Lavarunner', 'Bond of Insight', 'Goblin Dark-Dwellers', 'Stromkirk Noble', 'Joraga Treespeaker', 'Pack Rat', 'Acidic Slime', 'Dream Twist', 'Day of Judgment', 'Beast Whisperer', 'Incinerate', 'Jolrael, Mwonvuli Recluse', 'Bloodchief''s Thirst', 'General Ferrous Rokiric', 'Call the Bloodline', 'Primal Command', 'Repeal', 'Lava Dart', 'Lonely Sandbar', 'Cliffhaven Kitesail', 'Llanowar Wastes', 'Gaea''s Will', 'Immortal Coil', 'Sacred Fire', 'Joraga Warcaller', 'Overwhelming Splendor', 'Protean Raider', 'Double Vision', 'Vindicate', 'Judge''s Familiar', 'Memory Lapse', 'Arbor Elf', 'Scrabbling Claws', 'Opt', 'Tyrant''s Choice', 'Mishra''s Factory', 'Frantic Search', 'Outland Liberator', 'Feed the Swarm', 'Zof Consumption', 'Reckless Impulse', 'Suture Priest', 'Kessig Flamebreather', 'Nissa, Worldwaker', 'Kabira Takedown', 'Garruk Wildspeaker', 'Sword-Point Diplomacy', 'Battlefield Forge', 'Burst Lightning', 'Elvish Archdruid', 'Phoenix of Ash', 'Drowned Catacomb', 'Zealous Persecution', 'Jace''s Erasure', 'Temple of Deceit', 'Volcanic Salvo', 'Temporal Extortion', 'Jace''s Archivist', 'Plow Under', 'Upheaval', 'Siren''s Ruse', 'Blue Sun''s Zenith', 'Into the Story', 'Ethersworn Canonist', 'Brain Freeze', 'Growth-Chamber Guardian', 'Ponder', 'Sickening Shoal', 'Painful Truths', 'Submerged Boneyard', 'Elvish Visionary', 'Barbarian Ring', 'Slip Out the Back', 'Asylum Visitor', 'Desperate Ritual', 'Cathar Commando', 'Goldmire Bridge', 'Captain Lannery Storm', 'Rootbound Crag', 'Form of the Dragon', 'Champion of the Parish', 'Brainstone', 'Dark Ritual', 'Chain Lightning', 'Pelakka Predation', 'Dimir Aqueduct', 'Westvale Abbey', 'Locket of Yesterdays', 'Fell Flagship', 'The Flame of Keld', 'Lead the Stampede', 'Temple of Epiphany', 'Explore', 'Lantern of the Lost', 'Gilt-Leaf Archdruid', 'Kaya, Ghost Assassin', 'Children of Korlis', 'Quest for the Holy Relic', 'Treasure Cruise', 'Vizkopa Guildmage', 'Cabal Stronghold', 'Ancestral Blade', 'Seething Song', 'Healer''s Hawk', 'Reveillark', 'Sephara, Sky''s Blade', 'Drossforge Bridge', 'Scout''s Warning', 'Chamber Sentry', 'Erebos''s Intervention', 'Invoke Calamity', 'Apex of Power', 'Maestros Theater', 'Auriok Steelshaper', 'Tempered Steel', 'Detention Sphere', 'Voldaren Epicure', 'Tradewind Rider', 'Restoration Angel', 'Kor Duelist', 'Giant Killer', 'Kumano Faces Kakkazan', 'Stubborn Denial', 'Enduring Ideal', 'Triskaidekaphobia', 'Hotshot Mechanic', 'Liliana Vess', 'Myr Retriever', 'Knight of the White Orchid', 'Souls of the Faultless', 'Tendrils of Agony', 'Loyal Pegasus', 'Gatekeeper of Malakir', 'Hidetsugu''s Second Rite', 'Sovereign''s Bite', 'Cosima, God of the Voyage', 'Falkenrath Aristocrat', 'Mind''s Desire'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 61.1, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (65.4 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Cerebral Vortex', 'Jack-o''-Lantern', 'Vault of the Archangel', 'Flame-Kin Zealot', 'Hanweir Garrison', 'Glen Elendra Liege', 'Sylvan Advocate', 'Dread Presence', 'Stirring Wildwood', 'Undercity Informer', 'Gryff''s Boon', 'Basking Rootwalla', 'Arch of Orazca', 'Wipe Away', 'Eye of Nowhere', 'Malakir Rebirth', 'Dire Fleet Daredevil', 'Icehide Golem', 'Kambal, Consul of Allocation', 'Sanguine Bond', 'Blackmail', 'Hinterland Harbor', 'Hunted Horror', 'Nissa, Worldwaker', 'Raging Ravine', 'Maestros Theater', 'Submerged Boneyard', 'Joraga Treespeaker', 'Consuming Aberration', 'Gaea''s Will', 'Thaumatic Compass', 'Llanowar Wastes', 'Strike It Rich', 'Zabaz, the Glimmerwasp', 'Benevolent Bodyguard', 'Reveillark', 'Regal Force', 'Pyretic Ritual', 'Dimir Aqueduct', 'Burst Lightning', 'Eternal Dragon', 'Hymn to Tourach', 'Jace, the Living Guildpact', 'Caves of Koilos', 'Brainstone', 'Jokulhaups', 'Dark Ritual', 'Mirror Entity', 'Sign in Blood', 'Acidic Slime', 'Return to Nature', 'Wrath of God', 'Admiral Beckett Brass', 'Banisher Priest', 'Radha, Heart of Keld', 'Zetalpa, Primal Dawn', 'Upheaval', 'Hotshot Mechanic', 'Double Vision', 'Titanoth Rex', 'Kaya, Ghost Assassin', 'Restoration Angel', 'Heartwood Storyteller', 'Immortal Coil', 'Big Score', 'Captain Lannery Storm', 'Vindicate', 'Oracle of Mul Daya', 'Boon of Safety', 'Hissing Quagmire', 'Azami, Lady of Scrolls', 'Snow-Covered Plains', 'Render Silent', 'Hushwing Gryff', 'Field of Ruin', 'Eiganjo Castle', 'Changeling Outcast', 'Orcish Lumberjack', 'Heartless Act', 'Hypnotic Specter', 'Blade Splicer', 'Cloudblazer', 'Blazing Rootwalla', 'Canyon Slough', 'Hagra Mauling', 'Growth-Chamber Guardian', 'Akroma, Angel of Fury', 'Beast Whisperer', 'Chandra, the Firebrand', 'Kazandu Mammoth', 'Chasm Skulker', 'Ethereal Armor', 'Blazing Shoal', 'Cabal Therapist', 'Animate Dead', 'Black Sun''s Zenith', 'Gatekeeper of Malakir', 'Merfolk Secretkeeper', 'Prismatic Lens', 'Underworld Connections', 'Pillage', 'Pain''s Reward', 'Jace''s Archivist', 'Faerie Miscreant', 'Temporal Extortion', 'Sorin Markov', 'Dread Return', 'Greater Tanuki', 'Dread Fugue', 'Forbid', 'Call the Bloodline', 'Barren Moor', 'Sejiri Shelter', 'Izzet Charm', 'Ayli, Eternal Pilgrim', 'Day of Judgment', 'Diamond Lion', 'Erebos''s Intervention', 'Outland Liberator', 'Cartel Aristocrat', 'Michiko''s Reign of Truth', 'Snowfield Sinkhole', 'Neheb, Dreadhorde Champion', 'Arcbound Javelineer', 'Runed Halo', 'Fire Covenant', 'Fatestitcher', 'Desperate Ritual', 'Banefire', 'Rootbound Crag', 'Stern Dismissal', 'Muddle the Mixture', 'Bloodchief''s Thirst', 'Umara Wizard', 'Lantern of the Lost', 'Prophet of Kruphix', 'Tapping at the Window', 'Blighted Agent', 'Champion of the Parish', 'Mana Leak', 'Chandra, Fire Artisan', 'Ethersworn Canonist', 'See the Truth', 'Fauna Shaman', 'Touch the Spirit Realm', 'Scoured Barrens', 'Jolrael, Mwonvuli Recluse', 'Memory''s Journey', 'Bond of Insight', 'Brokers Hideout', 'Bygone Bishop', 'Tyrant''s Scorn', 'Cosima, God of the Voyage', 'Talisman of Curiosity', 'Fblthp, the Lost', 'Mirari''s Wake', 'Seething Song', 'Ingenious Infiltrator', 'Asylum Visitor', 'Soulherder', 'Temple of Mystery', 'Stone Rain', 'Secluded Courtyard', 'Cabaretti Courtyard', 'Repeal', 'Nyxathid', 'Ghost Quarter', 'Phyrexian Dreadnought', 'Chandra, Pyromaster', 'Goldmire Bridge', 'Fevered Visions', 'Vizkopa Guildmage', 'Hero of Precinct One', 'Intervention Pact', 'Blackbloom Rogue', 'Kjeldoran Outpost', 'Spirit Mantle', 'Condemn', 'Barbarian Ring', 'Needle Spires', 'Silundi Vision', 'Temple of Deceit', 'Bala Ged Recovery', 'Silverblade Paladin', 'Thousand-Faced Shadow', 'Timely Reinforcements', 'Sylvan Library', 'Laboratory Maniac', 'Detention Sphere', 'Joraga Warcaller', 'Revitalize', 'Steel Overseer', 'Gadwick, the Wizened', 'Fraying Sanity', 'Rustvale Bridge', 'Warkite Marauder', 'Vault Skirge', 'Behold the Multiverse', 'Silverbluff Bridge', 'Fell Flagship', 'Pull from Tomorrow', 'Plow Under', 'Dwynen''s Elite', 'Lys Alana Huntmaster', 'Engulf the Shore', 'Memory Lapse', 'Primal Command', 'Lashwrithe', 'Into the Story', 'Explore', 'Rift Sower', 'Midnight Clock', 'Lightning Axe', 'Reality Ripple', 'Secluded Glen', 'Forerunner of the Coalition', 'Vapor Snag', 'Shalai, Voice of Plenty', 'Mayor of Avabruck', 'Frantic Search', 'Thraben Inspector', 'Gonti, Lord of Luxury', 'Castigate', 'Azorius Signet', 'Woodland Cemetery', 'Souls of the Faultless', 'Deep Analysis', 'Cleansing Wildfire', 'Experimental Synthesizer', 'Burning Inquiry', 'Song-Mad Treachery', 'Scrabbling Claws', 'Children of Korlis', 'Boomerang', 'Karmic Guide', 'Dryad Militant', 'Simic Signet', 'Forsaken Sanctuary', 'Wooded Bastion', 'Inscription of Ruin', 'Tymaret, Chosen from Death', 'Thought Scour', 'Hazoret''s Undying Fury', 'Geomancer''s Gambit', 'Boros Reckoner', 'Siren''s Ruse', 'Mind Funeral', 'Glacial Fortress', 'Foreboding Ruins', 'Dream Twist', 'Mind''s Desire', 'Drowned Secrets', 'Foundation Breaker', 'Bramblewood Paragon', 'Arcbound Worker', 'Signal Pest', 'Force of Rage', 'Delirium Skeins', 'Coalition Relic', 'Chancellor of the Spires', 'Invoke Calamity', 'Jace''s Phantasm', 'Divinity of Pride', 'Llanowar Elves', 'Demigod of Revenge', 'Avacyn''s Pilgrim', 'Tranquil Cove', 'Timeless Witness', 'Witch''s Cottage', 'Sacred Fire', 'Gideon Jura', 'Phalanx Leader', 'Fire-Lit Thicket', 'Saffi Eriksdotter', 'Selective Memory', 'Mentor of the Meek', 'Nevermaker', 'Tangled Florahedron', 'Spikefield Hazard', 'Oona''s Prowler', 'Apex of Power', 'Banehound', 'Commune with the Gods', 'Zealous Persecution', 'Frantic Inventory', 'Feed the Swarm', 'Akoum Warrior', 'Liliana Vess', 'Raven''s Crime', 'Daring Buccaneer', 'Cosmos Elixir', 'Duress', 'Bloodbraid Elf', 'Locket of Yesterdays', 'Fathom Fleet Captain', 'Volcanic Salvo', 'Faithful Mending', 'Ghirapur Orrery', 'Ezuri, Renegade Leader', 'Fumigate', 'Search for Tomorrow', 'Treasure Cruise', 'Peer Through Depths', 'Tendrils of Agony', 'Ondu Inversion', 'Patchwork Automaton', 'Empty the Warrens', 'Zof Consumption', 'Protean Raider', 'Dire Tactics', 'Dire Fleet Poisoner', 'Goblin Dark-Dwellers', 'Vampire of the Dire Moon', 'Crumbling Necropolis', 'Skyclave Cleric', 'Ruin Crab', 'Jwari Disruption', 'Arcbound Ravager', 'Blue Sun''s Zenith', 'Containment Construct', 'Mirrorshell Crab', 'Samut, the Tested', 'Spell Pierce', 'Drossforge Bridge', 'Illuminator Virtuoso', 'Painful Truths', 'Mirran Crusader', 'Consecrate // Consume', 'Wight of Precinct Six', 'Grisly Salvage', 'Temple of Epiphany', 'Lonely Sandbar', 'Chain Lightning', 'Sorcerous Spyglass', 'Cragplate Baloth', 'Temple of Enlightenment', 'Phantasmagorian', 'Pack Rat', 'Cut // Ribbons', 'The Raven''s Warning', 'Fyndhorn Elves', 'Slip Out the Back', 'Lead the Stampede', 'Dream Salvage', 'Sorin''s Vengeance', 'Mina and Denn, Wildborn', 'Soul Spike', 'Angel of Glory''s Rise', 'Twincast', 'Knight of the White Orchid', 'Haunting Echoes', 'General Ferrous Rokiric', 'Clifftop Retreat', 'Harmless Offering', 'Hunted Nightmare', 'The Birth of Meletis', 'Turnabout', 'Hostage Taker', 'Elixir of Immortality', 'Invoke the Ancients', 'Beyeen Veil', 'Favored Hoplite', 'Garruk Wildspeaker', 'Deathless Knight', 'Scryb Ranger', 'Westvale Abbey', 'Evolving Wilds', 'Tocatli Honor Guard', 'Elvish Mystic', 'Balustrade Spy', 'Debt to the Kami', 'Gird for Battle', 'Tradewind Rider', 'Ominous Seas', 'Soulflayer', 'Pelakka Predation', 'Silver-Fur Master', 'Court Homunculus', 'Quicken', 'Homestead Courage', 'Vampire Nighthawk', 'Drowned Catacomb', 'Sphinx''s Tutelage', 'Gitaxian Probe', 'Defiant Strike', 'Search Party Captain', 'Teferi''s Ageless Insight', 'Seaside Citadel', 'Cruel Bargain', 'Darkmoss Bridge', 'Selesnya Signet', 'Kunoros, Hound of Athreos', 'Hero''s Downfall', 'Dream Trawler', 'Vantress Gargoyle', 'Servo Exhibition', 'Arcbound Mouser', 'Izzet Boilerworks', 'Falkenrath Aristocrat', 'Tectonic Giant', 'Eidolon of Countless Battles', 'Battlefield Forge', 'Leechridden Swamp', 'Immolating Souleater', 'Lose Focus', 'Stave Off', 'Sickening Shoal', 'Birds of Paradise', 'Mishra''s Factory', 'Ornithopter', 'Bazaar Trader', 'Opt', 'Elvish Visionary', 'Sleight of Hand', 'Glorybringer', 'Bounty of the Luxa', 'Animation Module', 'Dragonskull Summit', 'Cathar Commando', 'Tome Scour', 'Dire Fleet Captain', 'Elvish Archdruid', 'Ponder', 'Sarkhan the Masterless', 'Giant Killer', 'Shrapnel Blast', 'Suture Priest', 'Vraska''s Contempt', 'Glen Elendra Archmage', 'Cabal Stronghold', 'Gaea''s Revenge', 'Figure of Destiny', 'Wall of Omens', 'Decree of Justice', 'Grimdancer', 'Sandsteppe Citadel', 'Abiding Grace', 'Ramunap Excavator', 'Tempered Steel', 'Mindstab', 'Colossal Skyturtle', 'Temple of Silence', 'Lotleth Troll', 'Unsubstantiate', 'Game Trail'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 65.4, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (62.4 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Day of Judgment', 'Memory Lapse', 'Harmless Offering', 'Battlefield Forge', 'Pariah', 'Seed the Land', 'Elixir of Immortality', 'Snow-Covered Plains', 'Nivmagus Elemental', 'Mistveil Plains', 'Arbor Elf', 'Midnight Clock', 'Bag of Holding', 'Void Snare', 'Trickbind', 'Peek', 'Rally the Ranks', 'Scrabbling Claws', 'Fieldmist Borderpost', 'Dregscape Zombie', 'Vapor Snag', 'Dark Salvation', 'Tooth of Chiss-Goria', 'Trespasser''s Curse', 'Cultivator of Blades', 'Bazaar Trader', 'Silundi Vision', 'Fire-Lit Thicket', 'Vindicate', 'Cloudpost', 'Revitalize', 'Fact or Fiction', 'Sylvan Library', 'Barren Glory', 'Westvale Abbey', 'Reckless Impulse', 'Form of the Dragon', 'Dungrove Elder', 'Gitaxian Probe', 'Fire Covenant', 'Rootbound Crag', 'Triskelion', 'Crashing Drawbridge', 'Counterflux', 'Viscera Seer', 'Illness in the Ranks', 'Merfolk Sovereign', 'Coralhelm Commander', 'Sphere of Safety', 'Firewild Borderpost', 'Infernal Grasp', 'Squirrel Sanctuary', 'Nyxathid', 'Goblin Cratermaker', 'Ponder', 'Mystifying Maze', 'Elves of Deep Shadow', 'Mobilized District', 'Thought Scour', 'Ancient Stirrings', 'Mana Leak', 'Nephalia Academy', 'Bloodchief''s Thirst', 'Chaplain of Alms', 'Squirrel Sovereign', 'Faerie Vandal', 'Explore', 'Sign in Blood', 'Forbid', 'Mouth of Ronom', 'Duskwatch Recruiter', 'Drossforge Bridge', 'Gideon Jura', 'Murderous Cut', 'Skyclave Relic', 'Mind''s Desire', 'Sylvan Primordial', 'Timeless Witness', 'Temple of Malice', 'Empty the Warrens', 'Scale of Chiss-Goria', 'Goblin Matron', 'Glacial Fortress', 'Kabira Takedown', 'Temple of Deceit', 'Champion of the Parish', 'Izzet Charm', 'Augur of Skulls', 'Evolving Wilds', 'Fraying Sanity', 'Massive Might', 'Hagra Mauling', 'Outland Liberator', 'Traumatize', 'Decree of Justice', 'Thraben Inspector', 'Lochmere Serpent', 'Arcane Sanctum', 'Goldmire Bridge', 'Lullmage Mentor', 'Overgrowth', 'Kopala, Warden of Waves', 'Squadron Hawk', 'Rustvale Bridge', 'Careful Cultivation', 'Harrow', 'Nameless Inversion', 'Temple of Mystery', 'Demonic Dread', 'Rite of Oblivion', 'Golgari Charm', 'Runed Halo', 'Mistvein Borderpost', 'Commune with Spirits', 'Immortal Coil', 'Kruphix''s Insight', 'Kaya, Ghost Assassin', 'Wrench Mind', 'Tyrant of Discord', 'Negate', 'Coalition Relic', 'Chitterspitter', 'Realm Razer', 'Phyrexian Dreadnought', 'Jace, Memory Adept', 'Dragonskull Summit', 'Sorin Markov', 'Harmonize', 'Grumgully, the Generous', 'Turnabout', 'Yavimaya Elder', 'Metalwork Colossus', 'Buried Ruin', 'Anguished Unmaking', 'Fabricate', 'Tanglepool Bridge', 'Ghost Quarter', 'Shard Volley', 'Foreboding Ruins', 'Vedalken Shackles', 'Early Harvest', 'Abiding Grace', 'Stingscourger', 'Drowned Catacomb', 'Shrieking Affliction', 'Ingenious Infiltrator', 'Malakir Rebirth', 'Stirring Wildwood', 'Spell Pierce', 'Canyon Slough', 'It That Betrays', 'Blood Fountain', 'Cemetery Reaper', 'Joraga Treespeaker', 'Stonybrook Banneret', 'Invigorate', 'Slip Out the Back', 'Sky Hussar', 'Ensoul Artifact', 'Grimdancer', 'Abundant Harvest', 'Wrath of God', 'Rampant Growth', 'Arcbound Ravager', 'Weathered Wayfarer', 'Michiko''s Reign of Truth', 'Student of Warfare', 'Beyeen Veil', 'Slaughter Specialist', 'Quest for the Nihil Stone', 'Mistblade Shinobi', 'Tithe Taker', 'Smallpox', 'Ammit Eternal', 'Cold-Eyed Selkie', 'Forgotten Cave', 'Talisman of Impulse', 'Primal Command', 'Shock', 'Fertile Ground', 'Sojourner''s Companion', 'Thirst for Meaning', 'Thassa''s Intervention', 'Satoru Umezawa', 'Goblin Chieftain', 'Thirst for Discovery', 'Ral Zarek', 'Sterling Grove', 'Doomwake Giant', 'Consecrate // Consume', 'Brain Freeze', 'Nested Shambler', 'Maestros Theater', 'Goblin Dark-Dwellers', 'Barrenton Medic', 'Razortide Bridge', 'Stubborn Denial', 'Veinfire Borderpost', 'Asmodeus the Archfiend', 'Mogg War Marshal', 'Prophetic Prism', 'Mindslaver', 'Inevitable Betrayal', 'Zabaz, the Glimmerwasp', 'Compulsive Research', 'Condemn', 'Kaervek, the Spiteful', 'Desperate Ritual', 'Ghostly Flicker', 'Lantern of the Lost', 'Jwari Disruption', 'The Birth of Meletis', 'Shardless Agent', 'Judge''s Familiar', 'Skirk Prospector', 'Seething Song', 'Restore Balance', 'Secluded Glen', 'Lonely Sandbar', 'Lord of the Undead', 'Caves of Koilos', 'Squirrel Mob', 'Silvergill Adept', 'Lose Focus', 'Radha, Heart of Keld', 'Familiar''s Ruse', 'Dual Strike', 'Azorius Charm', 'Serra Avatar', 'Torment of Scarabs', 'Kami of False Hope', 'Barren Moor', 'Gray Merchant of Asphodel', 'Gatekeeper of Malakir', 'Ranger''s Guile', 'Thornglint Bridge', 'Darkmoss Bridge', 'Lava Dart', 'Mist-Cloaked Herald', 'Burst Lightning', 'Jokulhaups', 'Grenzo, Dungeon Warden', 'Dread Return', 'Dauntless Bodyguard', 'Skyclave Cleric', 'Thoughtpicker Witch', 'Benalish Marshal', 'Cleansing Wildfire', 'Dire Tactics', 'Changeling Outcast', 'Phylactery Lich', 'Resurgent Belief', 'Undercity Informer', 'Glorybringer', 'Terastodon', 'Hour of Promise', 'Animation Module', 'Arch of Orazca', 'Porphyry Nodes', 'Vampire Nighthawk', 'Faerie Miscreant', 'Erebos''s Intervention', 'Glimmerpost', 'Unified Will', 'Might of Old Krosa', 'Fell Stinger', 'Asylum Visitor', 'Firebrand Archer', 'Brokers Hideout', 'Urza''s Factory', 'See the Truth', 'Snow-Covered Forest', 'Demigod of Revenge', 'Distortion Strike', 'Bloodbraid Elf', 'Merrow Reejerey', 'Secluded Steppe', 'Pyretic Ritual', 'Mephidross Vampire', 'Liliana Vess', 'Ornithopter', 'Nature''s Lore', 'Sylvan Scrying', 'Invoke Calamity', 'Wildfield Borderpost', 'Leechridden Swamp', 'Greener Pastures', 'Secluded Courtyard', 'Master of Death', 'Mesmeric Fiend', 'Pelakka Predation', 'Blight Mamba', 'Honor of the Pure', 'Liliana''s Reaver', 'Tempered Steel', 'The Flame of Keld', 'Devastation Tide', 'Fallen Shinobi', 'Tyrant''s Scorn', 'Detention Sphere', 'Golden Wish', 'The Scorpion God', 'Animate Dead', 'Orim''s Chant', 'Llanowar Wastes', 'Repeal', 'Dokuchi Silencer', 'Temple of Epiphany', 'Master of the Pearl Trident', 'Yorvo, Lord of Garenbrig', 'Silverbluff Bridge', 'Thaumatic Compass', 'Ethersworn Canonist', 'Agonizing Remorse', 'Verdant Command', 'Temple of Silence', 'Izzet Boilerworks', 'Nissa, Worldwaker', 'Archghoul of Thraben', 'Delver of Secrets', 'Fertile Thicket', 'Goblin Anarchomancer', 'Commune with Nature', 'Assemble the Legion', 'Hieroglyphic Illumination', 'Tectonic Giant', 'Riveteers Charm', 'Kappa Tech-Wrecker', 'Arcbound Javelineer', 'Bala Ged Recovery', 'Chain Lightning', 'Acidic Slime', 'Timely Reinforcements', 'Woodland Cemetery', 'Faithful Mending', 'Hornet Queen', 'Skirge Familiar', 'Reverse Engineer', 'Chromescale Drake', 'Dark Ritual', 'Goblin Ringleader', 'Terminus', 'Kira, Great Glass-Spinner', 'Slip Through Space', 'Distended Mindbender', 'Garruk Wildspeaker', 'Goblin Trashmaster', 'Power Depot', 'Zuran Orb', 'Sarcomancy', 'Jack-o''-Lantern', 'Dread Fugue', 'Mishra''s Factory', 'Awakened Awareness', 'Colossal Skyturtle', 'Brave the Elements', 'Abrade', 'Sarkhan the Masterless', 'Dryad Militant', 'Double Vision', 'Liliana''s Caress', 'Tide Shaper', 'Stern Dismissal', 'Tendo Ice Bridge', 'Blackbloom Rogue', 'Thousand-Faced Shadow', 'Tidal Warrior', 'Seasons Past', 'Vampire Opportunist', 'Vernal Bloom', 'Kessig Flamebreather', 'Shinka, the Bloodsoaked Keep', 'Pyroclasm', 'Research // Development', 'Balustrade Spy', 'Murderous Redcap', 'Voldaren Epicure', 'Arcbound Worker', 'Twinshot Sniper', 'Strike It Rich', 'Metallic Rebuke', 'Mistvault Bridge', 'Slagwoods Bridge', 'Chandra, Pyromaster', 'Benevolent Bodyguard', 'Ramunap Excavator', 'Buried Alive', 'Become Immense', 'Fatestitcher', 'Sandwurm Convergence', 'Dream Trawler', 'Spearbreaker Behemoth', 'Phantasmagorian', 'Ghitu Lavarunner', 'Arcbound Mouser', 'Seafloor Oracle', 'Temple of Enlightenment', 'End-Raze Forerunners', 'Elvish Mystic', 'Signal Pest', 'Cursecatcher', 'Hypnotic Specter', 'Deep Analysis', 'Brainstone', 'Esper Charm', 'Destiny Spinner', 'Tooth and Nail', 'Wayward Guide-Beast', 'Hissing Quagmire', 'Nantuko Husk', 'Blackmail', 'Sire of Insanity', 'Tempest Djinn', 'Snow-Covered Swamp', 'Tendrils of Agony', 'Lumbering Falls', 'Frantic Search', 'Commit // Memory', 'Nezahal, Primal Tide', 'Geomancer''s Gambit', 'Ichorclaw Myr', 'Treasure Cruise', 'Duress', 'Voyaging Satyr', 'Morselhoarder', 'Graveyard Marshal', 'Snapback', 'Diabolic Edict', 'Ranger of Eos', 'Scour All Possibilities', 'Ethersworn Sphinx', 'Thoughtrender Lamia', 'Cathar Commando', 'Ravenous Squirrel', 'Heartless Act', 'Hinterland Harbor', 'Sungold Sentinel', 'Mirrorshell Crab', 'Diregraf Colossus', 'Moon-Circuit Hacker', 'Seal of Fire', 'Tribute to Horobi', 'Obscura Storefront', 'Hymn to Tourach', 'Raven''s Crime', 'Prosperous Thief', 'Silver-Fur Master', 'Goblin Instigator', 'Reality Ripple', 'Blighted Agent', 'Martyr of Sands', 'Greater Gargadon', 'Opt', 'Rishadan Dockhand', 'Necrotic Ooze', 'Birds of Paradise', 'Patchwork Automaton', 'Fyndhorn Elves', 'Delay', 'Kumano Faces Kakkazan', 'Sylvan Anthem', 'Game Trail', 'Alchemist''s Refuge', 'Barbarian Ring', 'Obelisk of Urd'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 62.4, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (80.9 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Fireblade Charger', 'Serra Avatar', 'Tarfire', 'Triskelion', 'Firespout', 'Ral, Storm Conduit', 'Lavaclaw Reaches', 'Cloudfin Raptor', 'Coiling Oracle', 'Blazing Rootwalla', 'Chandra, Pyromaster', 'Thaumatic Compass', 'Skirk Prospector', 'Wailing Ghoul', 'Skybridge Towers', 'Fire Covenant', 'Vivid Marsh', 'Witch''s Cottage', 'Double Vision', 'Abbot of Keral Keep', 'Raging Ravine', 'Boomerang', 'Kodama''s Reach', 'Infernal Plunge', 'Crackling Drake', 'Quest for Ula''s Temple', 'Cathar Commando', 'Necrologia', 'Bontu''s Last Reckoning', 'Hobgoblin Captain', 'Fling', 'Inkwell Leviathan', 'Gaea''s Will', 'Touch the Spirit Realm', 'Snapback', 'Dakmor Salvage', 'Quicken', 'Reprobation', 'Windcaller Aven', 'Erebos''s Intervention', 'Kjeldoran Dead', 'Skyline Cascade', 'Tyrant''s Choice', 'Folio of Fancies', 'Gadwick, the Wizened', 'Primal Command', 'Gather the Townsfolk', 'Cabal Therapist', 'Jadelight Ranger', 'Demonic Embrace', 'Infernal Grasp', 'Scroll of Avacyn', 'Dockside Chef', 'Devastation Tide', 'Harsh Mentor', 'Nevermore', 'Oblivion Ring', 'Trespasser''s Curse', 'Pyretic Ritual', 'Midnight Reaper', 'Dreadhorde Invasion', 'Avaricious Dragon', 'Arcbound Stinger', 'Commune with the Gods', 'Weaver of Harmony', 'Fire-Belly Changeling', 'Dregscape Zombie', 'Noxious Dragon', 'Thornglint Bridge', 'Braids, Cabal Minion', 'Ward of Bones', 'Invigorating Hot Spring', 'Psychic Possession', 'Dragon''s Hoard', 'Starnheim Courser', 'Hissing Quagmire', 'Uncage the Menagerie', 'Nomad Outpost', 'Falkenrath Pit Fighter', 'Shock', 'Ball Lightning', 'Timeless Witness', 'Buried Alive', 'Search for Tomorrow', 'Stave Off', 'Expansion // Explosion', 'Shardless Agent', 'Draconic Roar', 'Lashwrithe', 'Ramunap Excavator', 'Hopeful Eidolon', 'Ghoulcaller''s Harvest', 'Duskwatch Recruiter', 'Duskdale Wurm', 'Jukai Naturalist', 'Mythos of Brokkos', 'Stubborn Denial', 'Condemn', 'Burning Inquiry', 'Turnabout', 'Whelming Wave', 'Cathartic Reunion', 'Zurgo Bellstriker', 'Forgotten Cave', 'Bramble Wurm', 'Invoke Calamity', 'Gitaxian Probe', 'Tangled Florahedron', 'Twinblade Geist', 'Temple of Deceit', 'Delver of Secrets', 'Clarion Spirit', 'Nissa''s Zendikon', 'Glorybringer', 'Distended Mindbender', 'Leyline of the Meek', 'Dark Ritual', 'Blessed Respite', 'Vedalken Archmage', 'Remorseful Cleric', 'Entrancing Melody', 'Azorius Charm', 'Ghitu Lavarunner', 'Gryff''s Boon', 'Hypnotic Specter', 'Stingscourger', 'Response // Resurgence', 'Slumbering Dragon', 'Angel of Jubilation', 'Raven''s Crime', 'Qasali Pridemage', 'Tendrils of Agony', 'Izzet Charm', 'Tyrant''s Scorn', 'Sign in Blood', 'Fatal Grudge', 'Snow-Covered Mountain', 'Anticognition', 'Cloudblazer', 'Canyon Slough', 'Wayward Guide-Beast', 'Black Sun''s Zenith', 'Rotten Reunion', 'Champion of the Parish', 'Shard Volley', 'Temple of Malady', 'Wheel of Fate', 'Wall of Omens', 'Treasure Cruise', 'Riftwing Cloudskate', 'Luminarch Ascension', 'Sylvan Library', 'Gruul Turf', 'Temple of Enlightenment', 'Raise the Alarm', 'Skycat Sovereign', 'Temple of Mystery', 'Snowfield Sinkhole', 'Dead Weight', 'Gorging Vulture', 'Unesh, Criosphinx Sovereign', 'Blade Splicer', 'Zur''s Weirding', 'Inspiring Overseer', 'Vigorspore Wurm', 'Disallow', 'Faithful Mending', 'Orb of Dragonkind', 'Dream Trawler', 'Galvanic Relay', 'Windborn Muse', 'Tooth and Nail', 'Dryad Militant', 'Foundation Breaker', 'Old Stickfingers', 'Frontier Bivouac', 'Abrade', 'Secluded Glen', 'Patchwork Automaton', 'Bronzeplate Boar', 'Malakir Rebirth', 'Phylactery Lich', 'Ash Zealot', 'Cloudpost', 'Mishra''s Factory', 'Heartless Act', 'Essence Flux', 'Wild Cantor', 'Incendiary Flow', 'Ajani, the Greathearted', 'Urza''s Factory', 'Alchemist''s Refuge', 'Sanctum of Stone Fangs', 'Hateful Eidolon', 'Seaside Citadel', 'Snow-Covered Forest', 'Demigod of Revenge', 'Keruga, the Macrosage', 'Fact or Fiction', 'Ajani Goldmane', 'Veinfire Borderpost', 'Staff of Domination', 'Colossal Skyturtle', 'Choking Sands', 'Pieces of the Puzzle', 'Kazuul''s Fury', 'Oust', 'The Flame of Keld', 'Vampiric Fury', 'Akoum Stonewaker', 'Tymaret, Chosen from Death', 'Spatial Contortion', 'Doomed Traveler', 'Restoration Angel', 'Mass Hysteria', 'Runeflare Trap', 'Cosima, God of the Voyage', 'Cultivate', 'Clifftop Retreat', 'Scour All Possibilities', 'Goblin Chieftain', 'Cleansing Wildfire', 'Shalai, Voice of Plenty', 'Fatigue', 'Goblin Trailblazer', 'Cerebral Vortex', 'Mind''s Desire', 'Mistvault Bridge', 'Deathbonnet Sprout', 'Heartfire Immolator', 'Ghostly Flicker', 'Jokulhaups', 'Ghost Quarter', 'Tallowisp', 'Doom Foretold', 'Michiko''s Reign of Truth', 'Thunderclap Wyvern', 'Temple of Triumph', 'Imposing Sovereign', 'Goblin Warchief', 'Akoum Hellhound', 'Flamescroll Celebrant', 'Crackling Doom', 'Iron Apprentice', 'Anticipate', 'Armor of Thorns', 'Ghitu Encampment', 'Stirring Wildwood', 'Tanglepool Bridge', 'Epochrasite', 'Snow-Covered Plains', 'Firewild Borderpost', 'Saw It Coming', 'Enigmatic Incarnation', 'The Bloodsky Massacre', 'Gray Merchant of Asphodel', 'Ornithopter of Paradise', 'Hedron Alignment', 'Lonely Sandbar', 'Thousand-Faced Shadow', 'Stone Haven Outfitter', 'Pack Rat', 'Student of Warfare', 'Barren Moor', 'Moorland Haunt', 'Cliffside Lookout', 'Khalni Ambush', 'Leechridden Swamp', 'Springbloom Druid', 'Tendo Ice Bridge', 'Hall of the Bandit Lord', 'River Serpent', 'Blisterpod', 'Voltage Surge', 'Phyrexian Revoker', 'Karn''s Bastion', 'Darksteel Reactor', 'Liesa, Forgotten Archangel', 'Thirst for Discovery', 'Firebrand Archer', 'Pull from Tomorrow', 'Glyph Keeper', 'Forbid', 'Sekki, Seasons'' Guide', 'Farseek', 'Nested Shambler', 'Chromatic Lantern', 'Casualties of War', 'Ingenious Infiltrator', 'Sultai Charm', 'Kiln Fiend', 'Dread Return', 'Dread Presence', 'Fire-Lit Thicket', 'Empty the Warrens', 'Spirit Mantle', 'Doomed Dissenter', 'Abundant Harvest', 'Destiny Spinner', 'Sylvan Advocate', 'Flametongue Kavu', 'Hymn to Tourach', 'Dimir Charm', 'Kumano Faces Kakkazan', 'Darkmoss Bridge', 'Mentor of the Meek', 'Woodland Cemetery', 'Smokestack', 'Circuit Mender', 'Cauldron''s Gift', 'Hero of Iroas', 'Tribute to Horobi', 'Magmatic Insight', 'Oran-Rief Ooze', 'Dragon Hatchling', 'Declaration in Stone', 'Pariah', 'Future Sight', 'Cleansing Nova', 'Witching Well', 'Take Inventory', 'Thought Scour', 'Watcher for Tomorrow', 'Eiganjo Castle', 'Varragoth, Bloodsky Sire', 'Mistvein Borderpost', 'Falkenrath Aristocrat', 'Nicol Bolas, Planeswalker', 'Tempered Steel', 'Bone Picker', 'Sleight of Hand', 'Drowned Catacomb', 'Vampire Nighthawk', 'Thunderbreak Regent', 'Earthshaker Khenra', 'Aphemia, the Cacophony', 'Scout''s Warning', 'Glimmerpost', 'Nightveil Specter', 'Soul''s Attendant', 'Inner-Flame Acolyte', 'Archaeomancer', 'Bump in the Night', 'Sarkhan, the Dragonspeaker', 'Strike It Rich', 'Crackling Emergence', 'Lava Dart', 'Hotshot Mechanic', 'Grumgully, the Generous', 'Tatsunari, Toad Rider', 'Suture Priest', 'Giant Killer', 'Temple of Malice', 'Grenzo, Dungeon Warden', 'Fodder Tosser', 'Field of Ruin', 'Dauntless Bodyguard', 'Dimir Aqueduct', 'Security Rhox', 'Mirari''s Wake', 'Go-Shintai of Ancient Wars', 'Dripping-Tongue Zubera', 'Game Trail', 'Rustvale Bridge', 'Obscura Storefront', 'Hold for Ransom', 'Engulf the Shore', 'Mysterious Tome', 'Pelakka Predation', 'Needle Spires', 'Balustrade Spy', 'Delay', 'Flame Rift', 'Painful Truths', 'Teachings of the Kirin', 'Golden Wish', 'Call of the Death-Dweller', 'Slagstorm', 'Korlash, Heir to Blackblade', 'Shattered Perception', 'Nephalia Academy', 'Dwarven Reinforcements', 'Dragonskull Summit', 'Diabolic Edict', 'Foreboding Ruins', 'Glint-Horn Buccaneer', 'Myth Realized', 'Maestros Charm', 'Murderous Redcap', 'Ponder', 'Reap the Past', 'Illness in the Ranks', 'Universal Automaton', 'Weapons Trainer', 'Phantasmagorian', 'Wooded Bastion', 'Invade the City', 'The Raven''s Warning', 'Chain Reaction', 'Ravenous Chupacabra', 'Soul Snare', 'Panoptic Mirror', 'Day of Judgment', 'Sphere of Safety', 'Canopy Cover', 'Chain Lightning', 'Orim''s Chant', 'Reckless Impulse', 'Tragic Slip', 'Favored Hoplite', 'Novice Occultist', 'Explore', 'Hada Freeblade', 'Moss-Pit Skeleton', 'Vivid Grove', 'Tormentor''s Helm', 'Demonic Dread', 'Auramancer', 'Riveteers Requisitioner', 'Invert // Invent', 'Magus of the Candelabra', 'Servo Exhibition', 'Avacyn, Guardian Angel', 'Elixir of Immortality', 'Cloudcrest Lake', 'Phoenix of Ash', 'Bloodbraid Marauder', 'Genju of the Realm', 'Norin the Wary', 'Trostani''s Summoner', 'Blue Sun''s Zenith', 'Sea Gate Wreckage', 'Bankrupt in Blood', 'Goblin Electromancer', 'Kessig Flamebreather', 'Laboratory Maniac', 'Precognition Field', 'Ivory Tower', 'Kher Keep', 'Bala Ged Recovery', 'Rally the Peasants', 'Vampires'' Vengeance', 'Spell Pierce', 'Endbringer', 'Barbarian Ring', 'Rampant Growth', 'Mirrorshell Crab', 'Gearseeker Serpent', 'Surge Node', 'Eye Collector', 'Kick in the Door', 'Dovin Baan', 'Vivid Creek', 'Goblin Cratermaker', 'Rootbound Crag', 'Promise of Bunrei', 'Riddleform', 'Vastwood Zendikon', 'Ancient Stirrings', 'Oketra the True', 'Kuldotha Rebirth', 'Wipe Away', 'Hour of Promise', 'Nahiri''s Wrath', 'See the Truth', 'Raffine''s Informant', 'Silver-Fur Master', 'Harmonious Emergence', 'Jungle Shrine', 'Rise from the Tides', 'Annex', 'Big Score', 'Ally Encampment', 'Crusher Zendikon', 'Grapeshot', 'Savage Lands', 'Buried Ruin', 'Haunted Dead', 'Mindslaver', 'Figure of Destiny', 'Putrid Leech', 'Nevinyrral''s Disk', 'Gloomshrieker', 'Brokers Hideout', 'Goblin Instigator', 'Etched Champion', 'Stoneforge Masterwork', 'Walking Skyscraper', 'Stormscape Familiar', 'Dragon Turtle', 'Blood for Bones', 'Bone Splinters', 'Razortide Bridge', 'Captain''s Claws', 'Nightshade Stinger', 'Honden of Infinite Rage', 'Honden of Night''s Reach', 'Howling Mine', 'Duress', 'Hunted Phantasm', 'Incubation Druid', 'Possessed Skaab', 'Upriser Renegade', 'Deathreap Ritual', 'Rally the Ancestors', 'Master of Death', 'Moon-Circuit Hacker', 'Gideon Jura', 'Honden of Life''s Web', 'Animate Dead', 'Ancestral Anger', 'All Suns'' Dawn', 'Stern Dismissal', 'Squadron Hawk', 'Vivid Meadow', 'Myr Retriever', 'Thundering Raiju', 'Mausoleum Secrets', 'Pirate''s Pillage', 'Vault Skirge', 'Shatter', 'Clackbridge Troll', 'Brave the Elements', 'Banefire', 'Honden of Cleansing Fire', 'Bident of Thassa', 'Changeling Outcast', 'Caves of Koilos', 'Behold the Multiverse', 'Postmortem Lunge', 'Seal of Removal', 'Greater Gargadon', 'Eidolon of Countless Battles', 'Seal of Fire', 'Funeral Rites', 'Court Homunculus', 'Wildfield Borderpost', 'Stimulus Package', 'Spell Burst', 'Treacherous Blessing', 'Refuse // Cooperate', 'Legion''s Initiative', 'Arch of Orazca', 'Lumbering Falls', 'Addle', 'Gatekeeper of Malakir', 'Thawing Glaciers', 'Divert', 'Thassa''s Intervention', 'Tectonic Giant', 'Brain Freeze', 'Simian Sling', 'Void Shatter', 'Negate', 'Liliana Vess', 'Chalice of Life', 'Excavation Mole', 'Mogg War Marshal', 'Pyroclasm', 'General Ferrous Rokiric', 'Everquill Phoenix', 'Electrolyze', 'Riveteers Overlook', 'Sojourner''s Companion', 'Mirrodin''s Core', 'Grim Haruspex', 'Triplicate Spirits', 'Spiteful Visions', 'Drossforge Bridge', 'Deprive', 'Astral Cornucopia', 'Goblin Trashmaster', 'Benevolent Bodyguard', 'Mythos of Nethroi', 'Rite of Oblivion', 'Hunted Nightmare', 'Sky Diamond', 'Basalt Ravager', 'Master of Predicaments', 'Guardian of Tazeem', 'Mana Leak', 'Gaea''s Blessing', 'Endless One', 'Kaya, Ghost Assassin', 'Garruk Wildspeaker', 'Fyndhorn Elves', 'Thraben Inspector', 'Thrashing Brontodon', 'Omen of the Sun', 'Spellgorger Weird', 'Kazandu Mammoth', 'Avatar of Woe', 'Brainstone', 'Temple of Plenty', 'Fatestitcher', 'Hunted Witness', 'Viscera Seer', 'Temple of Epiphany', 'Guardian Seraph', 'Falkenrath Gorger', 'Sephara, Sky''s Blade', 'The Birth of Meletis', 'Favorable Winds', 'Eldrazi Mimic', 'Dragonkin Berserker', 'Displace', 'Elite Guardmage', 'Myr Servitor', 'Shriekmaw', 'Consuming Vapors', 'Shrapnel Blast', 'Mikokoro, Center of the Sea', 'Flame-Kin Zealot', 'Grimdancer', 'Ardent Elementalist', 'Blossoming Calm', 'Magistrate''s Scepter', 'Desperate Ravings', 'Putrefy', 'Bone Shards', 'Metallic Rebuke', 'Eye of Nowhere', 'Temple of Silence', 'Sygg, River Cutthroat', 'Revel in Riches', 'Detention Sphere', 'Go-Shintai of Boundless Vigor', 'Kor Skyfisher', 'Acolyte of Affliction', 'Blur of Blades', 'Voltaic Key', 'Fallen Shinobi', 'Smallpox', 'Spear of Heliod', 'Shinka, the Bloodsoaked Keep', 'Oath of Liliana', 'Memory Lapse', 'Wind Zendikon', 'Stitch in Time', 'Akoum Battlesinger', 'An Offer You Can''t Refuse', 'Blackbloom Rogue', 'Tunnel Ignus', 'Dread Fugue', 'Silverbluff Bridge', 'Containment Construct', 'Wrath of God', 'Lochmere Serpent', 'Asylum Visitor', 'Pillage', 'Secluded Steppe', 'Seething Song', 'Benalish Marshal', 'Skemfar Avenger', 'Corrupted Zendikon', 'Glacial Fortress', 'Genesis Wave', 'Jarad''s Orders', 'Orzhov Charm', 'Etherium Sculptor', 'Sea''s Claim', 'Timely Reinforcements', 'Underworld Dreams', 'Bile Blight', 'Seraph Sanctuary', 'Spirited Companion', 'Sylvan Scrying', 'Experimental Overload', 'Vampire of the Dire Moon', 'Renegade Tactics', 'Azor, the Lawbringer', 'Reinforced Ronin', 'Spider Umbra', 'Bad River', 'Coalition Relic', 'Mystifying Maze', 'Dragon Fangs', 'Experimental Synthesizer', 'The Scorpion God', 'Rabbit Battery', 'Fuel for the Cause', 'Dennick, Pious Apprentice', 'Bontu the Glorified', 'Flame Slash', 'Harrow', 'Herald of the Pantheon', 'Tomb of Urami', 'Faerie Miscreant', 'Fiery Temper', 'Nezahal, Primal Tide', 'Sungold Sentinel', 'Fieldmist Borderpost', 'Elves of Deep Shadow', 'Dead // Gone', 'Jeskai Ascendancy', 'Liquimetal Coating', 'Dawn of Hope', 'Queen of Ice', 'Arcbound Worker', 'Hanweir Battlements', 'Hanweir Garrison', 'Runed Halo', 'Festival Crasher', 'Nyxathid', 'Secluded Courtyard', 'Hypnox', 'Sanguine Statuette', 'Xathrid Necromancer', 'Goblin Dark-Dwellers', 'Contagion Engine', 'Master of the Feast', 'Rakdos Pit Dragon', 'Think Twice', 'Silundi Vision', 'Stormfist Crusader', 'Mystic Retrieval', 'Foul Orchard', 'Azorius Signet', 'Run Amok', 'Lizard Blades', 'Bloodchief''s Thirst', 'Hostage Taker', 'Growth-Chamber Guardian', 'Terrarion', 'Haven of the Spirit Dragon', 'Vryn Wingmare', 'Angel of Sanctions', 'Blood Seeker', 'It That Betrays', 'Grimoire Thief', 'Bloodbraid Elf', 'Tempest Djinn', 'Hagra Mauling', 'Goblin Bombardment', 'Frantic Search', 'Intangible Virtue', 'Undead Butler', 'Mesmeric Fiend', 'Insolent Neonate', 'Blanchwood Armor', 'Floating-Dream Zubera', 'Justice Strike', 'Evolving Wilds', 'Ethereal Armor', 'Soul Warden', 'Dauntless Unity', 'Mire''s Grasp', 'Not of This World', 'Lifelink', 'Halimar Depths', 'Devastating Summons', 'Ancestral Statue', 'Conduit of Ruin', 'Rishadan Dockhand', 'Transguild Promenade', 'Ghoultree', 'Unholy Heat', 'Arcbound Ravager', 'Bag of Holding', 'Dowsing Dagger', 'Dragon Tempest', 'Mouth of Ronom', 'Revitalize', 'Mirrodin Besieged', 'Lodestone Golem', 'Bygone Bishop', 'Llanowar Wastes', 'Fauna Shaman', 'Stormtide Leviathan', 'Reckoner''s Bargain', 'Ritual of Soot', 'Wandering Mind', 'Goldhound', 'Grozoth', 'Ornithopter', 'Kitchen Imp', 'Crack the Earth', 'Solitary Confinement', 'Zulaport Cutthroat', 'Olivia Voldaren', 'Avacyn''s Pilgrim', 'Artisan of Kozilek', 'Sky Terror', 'Wrench Mind', 'Resurgent Belief', 'Fiend Hunter', 'Tymaret Calls the Dead', 'Pacifism', 'Shreds of Sanity', 'Sarkhan the Masterless', 'Fraying Sanity', 'Vengeful Pharaoh', 'Talus Paladin', 'Tribute Mage', 'Blazing Hope', 'Sunrise Cavalier', 'Gladecover Scout', 'Fevered Visions', 'Sejiri Shelter', 'Acidic Slime', 'Spikefield Hazard', 'Icehide Golem', 'Vindicate', 'Skyclave Shade', 'Prizefight', 'Jace, Memory Adept', 'Mire Triton', 'Swarming Goblins', 'Soulherder', 'Alms of the Vein', 'Shigeki, Jukai Visionary', 'Honor of the Pure', 'Valiant Changeling', 'Cruel Ultimatum', 'Oni-Cult Anvil', 'Westvale Abbey', 'Waterfront District', 'Grisly Salvage', 'Patch Up', 'Myojin of Seeing Winds', 'Hieroglyphic Illumination', 'Death Baron', 'Poison the Cup', 'Spectral Procession', 'Lotleth Troll', 'Hero of Precinct One', 'Built to Smash', 'Mesa Enchantress', 'Judge''s Familiar', 'Roil Eruption', 'Scuttling Doom Engine', 'Crux of Fate', 'Altar''s Reap', 'Decree of Justice', 'Kazandu Blademaster', 'Sterling Grove', 'Battlefield Forge', 'Summer Bloom', 'Mirror Entity', 'Towashi Guide-Bot', 'Kabira Takedown', 'Ethersworn Canonist', 'Deep Analysis', 'Martyr''s Soul', 'Midnight Clock', 'Immortal Servitude', 'Jwari Disruption', 'Words of Worship', 'Kjeldoran Outpost', 'Magister of Worth', 'Voldaren Epicure', 'Frost Titan', 'Dangerous Wager', 'Pentarch Ward', 'Life of Toshiro Umezawa', 'Improbable Alliance', 'Burst Lightning', 'Sundial of the Infinite', 'Slagwoods Bridge', 'Opt', 'Collected Conjuring', 'Kefnet the Mindful', 'Glen Elendra Archmage', 'Scab-Clan Berserker', 'Bloodsky Berserker', 'Winged Portent', 'Goldmire Bridge', 'Archfiend''s Vessel', 'Fast // Furious', 'Sacred Fire', 'Diregraf Rebirth', 'Honden of Seeing Winds', 'Vesperlark', 'Nightscape Familiar', 'Rise and Shine', 'Mobilized District', 'Twinshot Sniper', 'Mortuary Mire', 'Ruric Thar, the Unbowed', 'Terminus', 'Vapor Snag', 'Skyclave Cleric', 'Fatespinner', 'Power Conduit', 'Beyeen Veil', 'Jace Beleren', 'Shrieking Affliction', 'Nevermaker', 'Gadrak, the Crown-Scourge', 'Search Party Captain', 'Goblin Bushwhacker', 'Angelic Gift', 'Generous Visitor', 'Viashino Pyromancer', 'Slaughter Specialist', 'Drowned Secrets', 'Feed the Swarm', 'Tazri, Beacon of Unity', 'Llanowar Elves', 'Drogskol Infantry', 'Maestros Theater', 'Flames of the Blood Hand', 'Esper Charm', 'Exclude', 'Sphinx of Foresight', 'Faerie Vandal', 'Outland Liberator', 'Sea Gate Oracle', 'Unflinching Courage', 'Brittle Effigy', 'Crumbling Necropolis', 'Shriekhorn', 'Time Wipe', 'Stormblood Berserker', 'Lone Rider', 'Honeymoon Hearse', 'Munda, Ambush Leader', 'Alchemist''s Gambit', 'Tajic, Legion''s Edge', 'Path to the World Tree', 'Blood Fountain', 'Ember-Fist Zubera', 'Impostor of the Sixth Pride', 'Creakwood Liege', 'Go-Shintai of Hidden Cruelty', 'Garrison Cat', 'Dusk Legion Zealot', 'Augur of Bolas', 'Undercity Informer', 'Discovery // Dispersal', 'Restore Balance', 'Goblin Motivator', 'Lose Focus', 'Goblin Ringleader', 'Judith, the Scourge Diva', 'Swiftwater Cliffs', 'Archpriest of Iona', 'Fabricate', 'Snow-Covered Swamp', 'Vivid Crag', 'Hinterland Harbor', 'Vampire''s Kiss', 'Mizzium Mortars', 'Dream Eater', 'Archway Commons', 'Chasm Skulker', 'Ensoul Artifact', 'Izzet Boilerworks', 'Abzan Charm', 'Everflowing Chalice', 'Lunarch Veteran', 'Grindclock', 'Satyr Wayfinder', 'Furyblade Vampire', 'Tithe Taker', 'Stromkirk Occultist', 'Birds of Paradise', 'Pyromancer Ascension', 'Porphyry Nodes', 'Bane of Bala Ged', 'Signal Pest', 'Desperate Ritual', 'Pride of the Clouds', 'Haze of Rage', 'Jack-o''-Lantern', 'Incinerate', 'Mortician Beetle', 'Bedlam Reveler', 'Dragon Mage', 'Mystic Monastery', 'Glint Hawk', 'Master of Etherium', 'Metalwork Colossus', 'Sandsteppe Citadel', 'Repeal', 'Dragonspark Reactor', 'Unlucky Witness', 'Goblin Anarchomancer', 'The Modern Age', 'Prophetic Prism', 'Dismal Backwater', 'Memory''s Journey', 'Kabira Evangel', 'Dusk Mangler', 'Crash Through', 'Goblin Matron', 'Stone Rain'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 80.9, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (81.0 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Abrade', 'Haze of Rage', 'Pyretic Ritual', 'Vedalken Archmage', 'Olivia Voldaren', 'Slagstorm', 'Snow-Covered Swamp', 'Kessig Wolf Run', 'Bow of Nylea', 'Sol Talisman', 'Mirari''s Wake', 'Sky Diamond', 'Wall of Omens', 'Akroma''s Memorial', 'Become Immense', 'Choking Sands', 'Rise and Shine', 'Bramble Wurm', 'Plague Belcher', 'Myr Battlesphere', 'Postmortem Lunge', 'Bone Shards', 'Kazuul''s Fury', 'Scout''s Warning', 'Scryb Ranger', 'Mogg Fanatic', 'Distortion Strike', 'Timely Reinforcements', 'Hanweir Garrison', 'Elvish Visionary', 'Eye Collector', 'Stone Haven Outfitter', 'Lumbering Falls', 'Search Party Captain', 'Doomwake Giant', 'Stitch in Time', 'Goblin Motivator', 'Lantern Scout', 'Surge Node', 'Cauldron''s Gift', 'Haunted Dead', 'Sprite Dragon', 'Ranger of Eos', 'Goblin Anarchomancer', 'Fatestitcher', 'Memorial to War', 'Tempered Steel', 'Skirk Prospector', 'Scroll of Avacyn', 'Shreds of Sanity', 'Lavaclaw Reaches', 'Graf Harvest', 'Restore Balance', 'Temmet, Vizier of Naktamun', 'Jadelight Ranger', 'Zur''s Weirding', 'Reconstruction', 'Desperate Ritual', 'Unlucky Witness', 'Gaea''s Will', 'Khalni Ambush', 'Ward of Bones', 'Endbringer', 'Master of Etherium', 'Fast // Furious', 'Aphemia, the Cacophony', 'Hero of Precinct One', 'Ghost Quarter', 'Avatar of Woe', 'Think Twice', 'Simian Sling', 'Immortal Servitude', 'Steel Hellkite', 'Novice Occultist', 'Shard Volley', 'Pirate''s Pillage', 'Spell Pierce', 'Judge''s Familiar', 'Steel Overseer', 'Sylvan Scrying', 'Shuko', 'Enduring Ideal', 'Metallic Rebuke', 'Quest for the Holy Relic', 'Restoration Angel', 'Tectonic Giant', 'Jeskai Ascendancy', 'Alesha, Who Smiles at Death', 'Stubborn Denial', 'Captain''s Claws', 'Mystic Retrieval', 'Ruric Thar, the Unbowed', 'Flame-Kin Zealot', 'Sea Gate Oracle', 'Shigeki, Jukai Visionary', 'Mystifying Maze', 'Mistveil Plains', 'Empty the Warrens', 'Possessed Skaab', 'Grim Lavamancer', 'Arcbound Javelineer', 'Terminus', 'Goblin Matron', 'Invigorate', 'Murderous Redcap', 'Stormblood Berserker', 'Honden of Cleansing Fire', 'Necrologia', 'Acidic Slime', 'Llanowar Wastes', 'Inner-Flame Acolyte', 'Archaeomancer', 'Goblin Trashmaster', 'Black Sun''s Zenith', 'Crack the Earth', 'Pack Rat', 'Time Wipe', 'Laboratory Maniac', 'Chandra, Pyromaster', 'Valiant Changeling', 'Entrancing Melody', 'Blanchwood Armor', 'Nezahal, Primal Tide', 'Altered Ego', 'Lava Dart', 'Lochmere Serpent', 'Contagion Engine', 'Kunoros, Hound of Athreos', 'Suture Priest', 'Duskwatch Recruiter', 'Skybridge Towers', 'Blur of Blades', 'Sphinx of Foresight', 'Pacifism', 'Phoenix of Ash', 'Master of Death', 'Bloodbraid Elf', 'Changeling Outcast', 'Combine Chrysalis', 'Tomb of Urami', 'Archway Commons', 'Hinterland Harbor', 'Blood Vassal', 'Arcbound Mouser', 'Glorybringer', 'Negate', 'Hunted Witness', 'The Raven''s Warning', 'Diabolic Edict', 'Honor of the Pure', 'Tempest Djinn', 'Hopeful Eidolon', 'Treacherous Blessing', 'Akoum Battlesinger', 'Not of This World', 'The Modern Age', 'Nevinyrral''s Disk', 'Putrid Goblin', 'Festival Crasher', 'Llanowar Tribe', 'Vivid Crag', 'Bronzeplate Boar', 'Inkwell Leviathan', 'Resurgent Belief', 'Security Rhox', 'Martyr''s Soul', 'Spider Umbra', 'Falkenrath Noble', 'Elfhame Palace', 'Coiling Oracle', 'Rally the Ranks', 'Liquimetal Coating', 'Poison the Cup', 'Pariah', 'Figure of Destiny', 'Massacre Girl', 'Thunderclap Wyvern', 'Shatter', 'Goblin Chieftain', 'Wheel of Fate', 'Sygg, River Cutthroat', 'Reckoner''s Bargain', 'Crackling Drake', 'Tendrils of Agony', 'Colossus of Akros', 'Lizard Blades', 'Psychic Possession', 'Big Score', 'Divert', 'Nightmare Shepherd', 'Magister Sphinx', 'Leechridden Swamp', 'Bag of Holding', 'Epochrasite', 'Howl of the Night Pack', 'Wailing Ghoul', 'Porphyry Nodes', 'Old Stickfingers', 'Sunrise Cavalier', 'Dark-Dweller Oracle', 'Gavony Township', 'Goblin Instigator', 'Wayward Guide-Beast', 'Shriekhorn', 'Anticognition', 'Rise from the Tides', 'Darksteel Reactor', 'Primal Command', 'Westvale Abbey', 'Dimir Aqueduct', 'Brave the Elements', 'Caves of Koilos', 'Fieldmist Borderpost', 'Archfiend''s Vessel', 'Floating-Dream Zubera', 'Hero of Iroas', 'Crux of Fate', 'Elves of Deep Shadow', 'Response // Resurgence', 'Elvish Archdruid', 'Moorland Haunt', 'Myr Incubator', 'Metalwork Colossus', 'Void Snare', 'Bladestitched Skaab', 'Golden Wish', 'Ensoul Artifact', 'Claim the Firstborn', 'Dauntless Unity', 'Ravenous Chupacabra', 'Urza''s Factory', 'Magister of Worth', 'Brainstone', 'Delver of Secrets', 'Dripping-Tongue Zubera', 'Mentor of the Meek', 'Day of Judgment', 'Buried Alive', 'Memory Lapse', 'Search for Tomorrow', 'Shred Memory', 'Incendiary Flow', 'Dream Eater', 'Wipe Away', 'Eiganjo Castle', 'Shriekmaw', 'Patch Up', 'Bontu the Glorified', 'Devastating Summons', 'Zabaz, the Glimmerwasp', 'Lodestone Golem', 'Avacyn, Guardian Angel', 'Cloudfin Raptor', 'Panglacial Wurm', 'Farseek', 'Springbloom Druid', 'Verdant Command', 'Dread Fugue', 'Nevermore', 'Fireblade Charger', 'Reality Ripple', 'Woodland Cemetery', 'Growth-Chamber Guardian', 'Moon-Circuit Hacker', 'Tangled Florahedron', 'Tragic Slip', 'Eye of Vecna', 'Mythos of Brokkos', 'Fling', 'Mysterious Tome', 'Harmonious Emergence', 'Foul Orchard', 'Urza''s Ruinous Blast', 'Sungold Sentinel', 'Thassa''s Intervention', 'Open the Armory', 'Grozoth', 'Arch of Orazca', 'Consuming Vapors', 'Champion of the Parish', 'Reap the Past', 'Sephara, Sky''s Blade', 'Sanity Grinding', 'Dread Presence', 'Harsh Mentor', 'Kumano Faces Kakkazan', 'Impostor of the Sixth Pride', 'Tooth and Nail', 'Mistvault Bridge', 'Bloodchief''s Thirst', 'Voldaren Epicure', 'Anticipate', 'Power Conduit', 'Scuttling Doom Engine', 'Sylvan Advocate', 'Hagra Mauling', 'Pride of the Clouds', 'Curse of Exhaustion', 'Skyclave Cleric', 'Mirrorshell Crab', 'Akoum Hellhound', 'Talus Paladin', 'Raise the Alarm', 'Signal Pest', 'Locket of Yesterdays', 'Jungle Shrine', 'Etherium Sculptor', 'Evolving Wilds', 'Maestros Theater', 'Rustvale Bridge', 'Cloudcrest Lake', 'Benevolent Bodyguard', 'Rally the Ancestors', 'Ruin Crab', 'Deprive', 'Kalastria Healer', 'Turnabout', 'Tithe Taker', 'Words of Worship', 'Electrolyze', 'Decree of Justice', 'Scoured Barrens', 'Transguild Promenade', 'Ember-Fist Zubera', 'Trostani''s Summoner', 'Birds of Paradise', 'Nightveil Specter', 'Faerie Miscreant', 'Ritual of Subdual', 'Zurgo Bellstriker', 'Ghostly Flicker', 'Diregraf Ghoul', 'Falkenrath Pit Fighter', 'Oblivion Ring', 'Temple of Deceit', 'Call of the Death-Dweller', 'Sphere of Safety', 'Devastation Tide', 'Fauna Shaman', 'Tyrant''s Scorn', 'Savage Lands', 'Bile Blight', 'Argentum Armor', 'Vryn Wingmare', 'Hanweir Battlements', 'Mausoleum Secrets', 'Honeymoon Hearse', 'Funeral Rites', 'Gadwick, the Wizened', 'Court Homunculus', 'Oracle of Mul Daya', 'Elite Guardmage', 'Hieroglyphic Illumination', 'Vapor Snag', 'Michiko''s Reign of Truth', 'Giant Killer', 'Dimir Machinations', 'Explore', 'Wrench Mind', 'Fire Covenant', 'Crash Through', 'Rootbound Crag', 'Akoum Warrior', 'Faithful Mending', 'Run Amok', 'Elixir of Immortality', 'Tanglepool Bridge', 'Collected Conjuring', 'Ornithopter', 'Annex', 'Greater Gargadon', 'Hypnotic Specter', 'Razortide Bridge', 'Khalni Heart Expedition', 'Crusher Zendikon', 'Clifftop Retreat', 'Maestros Charm', 'Imposing Sovereign', 'Vastwood Zendikon', 'Hunted Horror', 'Slip Out the Back', 'Galvanic Relay', 'Shock', 'Secluded Glen', 'Wildfield Borderpost', 'Memory''s Journey', 'Dragon Tempest', 'Kor Duelist', 'Stormtide Leviathan', 'Dragon Fangs', 'Rotten Reunion', 'Biting-Palm Ninja', 'Honden of Life''s Web', 'Deep Analysis', 'Thornglint Bridge', 'Lonely Sandbar', 'Kick in the Door', 'Norin the Wary', 'Riddleform', 'Putrid Leech', 'The Flame of Keld', 'Patchwork Automaton', 'Fevered Visions', 'Hateful Eidolon', 'Bankrupt in Blood', 'Riptide Laboratory', 'Diamond Lion', 'Refuse // Cooperate', 'Revitalize', 'Angel of Jubilation', 'Rakdos Headliner', 'Shrapnel Blast', 'Legion''s Initiative', 'Lord of the Undead', 'Stave Off', 'Liliana''s Standard Bearer', 'Unflinching Courage', 'Gideon''s Intervention', 'Firemantle Mage', 'Malakir Rebirth', 'Talisman of Impulse', 'Canyon Slough', 'Into the Roil', 'Windcaller Aven', 'Guardian Seraph', 'Ancestral Statue', 'Wild Cantor', 'Desperate Ravings', 'Sandsteppe Citadel', 'Gather the Townsfolk', 'Sign in Blood', 'Drowned Catacomb', 'Battlefield Forge', 'Mortician Beetle', 'Dangerous Wager', 'Glimmerpost', 'Blazing Rootwalla', 'Field of Ruin', 'Vampire''s Kiss', 'Izzet Charm', 'Eye of Nowhere', 'Wastes', 'See the Truth', 'Servo Exhibition', 'Double Vision', 'Oust', 'Mikokoro, Center of the Sea', 'Temple of Malice', 'Temple of Mystery', 'Goblin Cratermaker', 'Gideon Jura', 'Cliffhaven Kitesail', 'Treasure Cruise', 'Dream Twist', 'Dryad Militant', 'Vampiric Fury', 'Sinister Concoction', 'Altar of the Brood', 'Illness in the Ranks', 'Gravebreaker Lamia', 'Revel in Riches', 'Vesperlark', 'Touch the Spirit Realm', 'Ghitu Lavarunner', 'Basalt Ravager', 'Ally Encampment', 'Skyclave Shade', 'Azorius Charm', 'Mishra''s Factory', 'Oran-Rief Ooze', 'Grapeshot', 'Ajani, the Greathearted', 'Addle', 'Vampires'' Vengeance', 'Staff of Domination', 'Bane of Bala Ged', 'Mission Briefing', 'Lead the Stampede', 'Mobilized District', 'Gitaxian Probe', 'Rally the Peasants', 'Eldrazi Mimic', 'Myojin of Seeing Winds', 'Tormentor''s Helm', 'Circuit Mender', 'Oath of Liliana', 'Kodama''s Reach', 'Myr Retriever', 'Bone Splinters', 'Acolyte of Affliction', 'Soul Snare', 'Master of Predicaments', 'Archpriest of Iona', 'Beyeen Veil', 'Upriser Renegade', 'Logic Knot', 'Kami of False Hope', 'Barrin, Tolarian Archmage', 'Windbrisk Heights', 'Life of Toshiro Umezawa', 'Falkenrath Gorger', 'Fiery Temper', 'Secluded Steppe', 'Garrison Cat', 'Rite of Oblivion', 'Bedlam Reveler', 'Watcher for Tomorrow', 'Possibility Storm', 'Viscera Seer', 'Tunnel Ignus', 'Kazandu Blademaster', 'Garruk Wildspeaker', 'Drossforge Bridge', 'Inscription of Ruin', 'Silundi Vision', 'Angel of Sanctions', 'Brittle Effigy', 'Magistrate''s Scepter', 'Infernal Plunge', 'Hedron Alignment', 'Hold for Ransom', 'Stern Dismissal', 'Izzet Boilerworks', 'Zhalfirin Void', 'Altar''s Reap', 'Mana Leak', 'Village Messenger', 'Wind Zendikon', 'Raffine''s Informant', 'Rampant Growth', 'Nephalia Academy', 'Trickbind', 'Mirror Entity', 'Marwyn, the Nurturer', 'Avacyn''s Pilgrim', 'Stoneforge Masterwork', 'Take Inventory', 'Magus of the Candelabra', 'Invigorating Hot Spring', 'Kuldotha Rebirth', 'Olivia''s Dragoon', 'Improbable Alliance', 'Sarkhan, the Dragonspeaker', 'Brokers Hideout', 'Spear of Heliod', 'Arcbound Worker', 'Kaya, Ghost Assassin', 'Orzhov Charm', 'Fatespinner', 'Bontu''s Last Reckoning', 'The Scorpion God', 'Mirrodin''s Core', 'Abbot of Keral Keep', 'Expedition Envoy', 'Drogskol Infantry', 'Seal of Fire', 'Bloodbraid Marauder', 'Detention Sphere', 'Glint Hawk', 'Llanowar Elves', 'Goblin Warchief', 'Dockside Chef', 'Lunarch Veteran', 'Nightshade Stinger', 'Behold the Multiverse', 'Ajani Goldmane', 'Massive Might', 'Pyromancer Ascension', 'Kor Skyfisher', 'Condemn', 'Thunderbreak Regent', 'Grisly Salvage', 'Midnight Clock', 'Azor, the Lawbringer', 'Stormfist Crusader', 'Tatsunari, Toad Rider', 'Favored Hoplite', 'Lifelink', 'Blessed Respite', 'Dreadhorde Invasion', 'Pull from Tomorrow', 'Clarion Spirit', 'Teachings of the Kirin', 'Ball Lightning', 'Dawn of Hope', 'Sojourner''s Companion', 'Runeflare Trap', 'Dovescape', 'Form of the Dragon', 'Fabricate', 'Fyndhorn Elves', 'Halimar Depths', 'Walking Skyscraper', 'Chalice of Life', 'Soulherder', 'Hunted Phantasm', 'Scorched Rusalka', 'Forbid', 'Brain Freeze', 'Bloodhall Priest', 'Kefnet the Mindful', 'Displace', 'Twinblade Geist', 'Etched Champion', 'Reprobation', 'Swarming Goblins', 'Raging Ravine', 'Rishadan Dockhand', 'Qasali Pridemage', 'Furyblade Vampire', 'Fleetwheel Cruiser', 'Blazing Hope', 'Angel of Glory''s Rise', 'Corrupted Zendikon', 'Hada Freeblade', 'Nahiri''s Wrath', 'Containment Construct', 'Voltaic Key', 'Delay', 'Jace, Memory Adept', 'Smallpox', 'Vindicate', 'Diregraf Captain', 'Colossal Skyturtle', 'Dauntless Bodyguard', 'Temple of Enlightenment', 'Arcbound Overseer', 'Akoum Stonewaker', 'Doomed Traveler', 'Fire-Lit Thicket', 'Mire Triton', 'Mesa Enchantress', 'Artisan of Kozilek', 'Moss-Pit Skeleton', 'Triplicate Spirits', 'Expansion // Explosion', 'Kjeldoran Outpost', 'Triskelion', 'Ritual of Soot', 'Tocatli Honor Guard', 'Infernal Grasp', 'Earthshaker Khenra', 'Cruel Ultimatum', 'Spellgorger Weird', 'Fuel for the Cause', 'Dimir Charm', 'Timeless Witness', 'Essence Flux', 'Mouth of Ronom', 'Braids, Cabal Minion', 'Goblin Bombardment', 'Martyr of Sands', 'Talisman of Conviction', 'Thirst for Discovery', 'Bloodsky Berserker', 'Grumgully, the Generous', 'Nomad Outpost', 'Hotshot Mechanic', 'Goblin Bushwhacker', 'Howling Mine', 'Bad River', 'Spiteful Visions', 'Draconic Roar', 'Gadrak, the Crown-Scourge', 'Spirit Mantle', 'Trespasser''s Curse', 'Sylvan Primordial', 'Sandwurm Convergence', 'Glint-Horn Buccaneer', 'Demonic Embrace', 'Flame Rift', 'Solitary Confinement', 'Declaration in Stone', 'Vampire of the Dire Moon', 'Wrath of God', 'Squadron Hawk', 'Coalition Relic', 'Mirage Mirror', 'Goblin Trailblazer', 'Whelming Wave', 'Pillage', 'Song-Mad Treachery', 'Arcbound Stinger', 'Towashi Guide-Bot', 'Thundering Raiju', 'Grindclock', 'Demonic Dread', 'Crackling Doom', 'Chain Lightning', 'Myth Realized', 'Bump in the Night', 'Brain Maggot', 'Sarkhan the Masterless', 'Everflowing Chalice', 'Flametongue Kavu', 'Thaumatic Compass', 'Mogg War Marshal', 'Dark Ritual', 'Blood Fountain', 'Pentarch Ward', 'Soul''s Attendant', 'Myr Servitor', 'Snow-Covered Plains', 'Snow-Covered Forest', 'Kazandu Mammoth', 'Frost Titan', 'Judith, the Scourge Diva', 'Spectral Procession', 'Reckless Impulse', 'Enigmatic Incarnation', 'Built to Smash', 'Thryx, the Sudden Storm', 'Nevermaker', 'Master of the Feast', 'Casualties of War', 'Kessig Flamebreather', 'Exclude', 'Sejiri Shelter', 'Stromkirk Occultist', 'Bogardan Hellkite', 'Hypergenesis', 'Wooded Bastion', 'Gloomshrieker', 'Boomerang', 'Cathartic Pyre', 'Opt', 'General Ferrous Rokiric', 'Joraga Warcaller', 'Balustrade Spy', 'Soulflayer', 'Nicol Bolas, Planeswalker', 'Sea Gate Wreckage', 'Viashino Pyromancer', 'Gorging Vulture', 'Blackblade Reforged', 'Vampire Nighthawk', 'Gaea''s Blessing', 'Slumbering Dragon', 'Endless One', 'Precognition Field', 'Prizefight', 'Lone Rider', 'Cosima, God of the Voyage', 'Chasm Skulker', 'Buried Ruin', 'Dragonskull Summit', 'Azorius Signet', 'Skycat Sovereign', 'Generous Visitor', 'Secluded Courtyard', 'Vengeful Pharaoh', 'Reinforced Ronin', 'Sanguine Statuette', 'Varragoth, Bloodsky Sire', 'Gatekeeper of Malakir', 'Naban, Dean of Iteration', 'Dragon Hatchling', 'Renegade Tactics', 'Basal Sliver', 'Chain Reaction', 'Cleansing Nova', 'Vault of the Archangel', 'Wandering Mind', 'Dragon Turtle', 'Starnheim Courser', 'Engulf the Shore', 'Shardless Agent', 'Hunted Nightmare', 'Magmatic Insight', 'Gladecover Scout', 'Repeal', 'Shrieking Affliction', 'Elvish Pioneer', 'Vivid Creek', 'Nyxathid', 'Vessel of Nascency', 'Fallen Shinobi', 'Goblin Electromancer', 'Korlash, Heir to Blackblade', 'Underworld Dreams', 'Slagwoods Bridge', 'Favorable Winds', 'Stirring Wildwood', 'Phantasmagorian', 'Stone Rain', 'Deathreap Ritual', 'Future Sight', 'Ghitu Encampment', 'Ancestral Blade', 'Hall of the Bandit Lord', 'Spell Burst', 'Frontier Bivouac', 'Doomed Dissenter', 'Ghoulcaller''s Harvest', 'Hushwing Gryff', 'Auriok Steelshaper', 'Cleansing Wildfire', 'Remorseful Cleric', 'Honden of Night''s Reach', 'Windborn Muse', 'Temple of Plenty', 'Sky Terror', 'Witching Well', 'Dream Trawler', 'Stormscape Familiar', 'River Serpent', 'Insolent Neonate', 'Benalish Marshal', 'Keruga, the Macrosage', 'Heartfire Immolator', 'March from the Tomb', 'Everquill Phoenix', 'Mirrodin Besieged', 'Disallow', 'Foreboding Ruins', 'Platinum Angel', 'Tajic, Legion''s Edge', 'Tyrant''s Choice', 'Alms of the Vein', 'Fodder Tosser', 'Fraying Sanity', 'Kitchen Imp', 'Justice Strike', 'Mizzium Mortars', 'Alchemist''s Refuge', 'Kira, Great Glass-Spinner', 'Mesmeric Fiend', 'Flamescroll Celebrant', 'Snowfield Sinkhole', 'Sea''s Claim', 'Experimental Overload', 'Dismal Backwater', 'Smokestack', 'Twinshot Sniper', 'Go-Shintai of Hidden Cruelty', 'Vivid Meadow', 'Dregscape Zombie', 'Dakmor Salvage', 'Loxodon Warhammer', 'Never // Return', 'Goblin Dark-Dwellers', 'Incubation Druid', 'Eternal Dragon', 'Silverbluff Bridge', 'Guardian of Tazeem', 'Dead // Gone', 'Ivory Tower', 'Spirited Companion', 'Gryff''s Boon', 'Blackbloom Rogue', 'Mortuary Mire', 'Selesnya Charm', 'Azami, Lady of Scrolls', 'Glyph Keeper', 'Asylum Visitor', 'Blight Mamba', 'Sacred Fire', 'Obscura Storefront', 'Cloudpost', 'Dennick, Pious Apprentice', 'Cliffside Lookout', 'Cloudblazer', 'Sekki, Seasons'' Guide', 'Gonti, Lord of Luxury', 'Blood for Bones', 'Genesis Wave', 'Lose Focus', 'Stromkirk Noble', 'Go-Shintai of Boundless Vigor', 'Erebos''s Intervention', 'Hostage Taker', 'Diregraf Rebirth', 'Riveteers Overlook', 'Cabal Initiate', 'Faerie Vandal', 'Firespout', 'Saw It Coming', 'Panoptic Mirror', 'Death Baron', 'Orim''s Chant', 'Foundation Breaker', 'Augur of Bolas', 'Flames of the Blood Hand', 'Feed the Swarm', 'Luminarch Ascension', 'Winged Portent', 'Waterfront District', 'Kabira Takedown', 'Joraga Treespeaker', 'Crumbling Necropolis', 'Glen Elendra Archmage', 'Rakdos Pit Dragon', 'Falkenrath Aristocrat', 'Angelic Gift', 'Hissing Quagmire', 'Dead Weight', 'Silver-Fur Master', 'Oni-Cult Anvil', 'Riveteers Requisitioner', 'Painful Truths', 'Invert // Invent', 'Incinerate', 'Blighted Agent', 'An Offer You Can''t Refuse', 'Faithless Salvaging', 'Auramancer', 'Mindslaver', 'Tarfire', 'Nested Shambler', 'Fiery Impulse', 'Putrid Imp', 'All Suns'' Dawn', 'Voltage Surge', 'Dowsing Dagger', 'Honden of Infinite Rage', 'Kuldotha Forgemaster', 'Bygone Bishop', 'Demigod of Revenge', 'Tymaret Calls the Dead', 'Barbarian Ring', 'Hour of Promise', 'Seaside Citadel', 'Sylvan Library', 'Searing Spear', 'Thraben Inspector', 'Jokulhaups', 'Spikefield Hazard', 'Didn''t Say Please', 'Temple of Triumph', 'Kitesail Apprentice', 'Dragon''s Hoard', 'Harrow', 'Ghoultree', 'Game Trail', 'Kjeldoran Dead', 'Pelakka Predation', 'Abiding Grace', 'Temple of Silence', 'Icehide Golem', 'Sleight of Hand', 'Vivid Grove', 'Syncopate', 'Commune with the Gods', 'Advent of the Wurm', 'Riftwing Cloudskate', 'Jack-o''-Lantern', 'Blue Sun''s Zenith', 'Tendo Ice Bridge', 'Hypnox', 'Goldhound', 'Goblin Ringleader', 'Invoke Calamity', 'Feasting Troll King', 'Unesh, Criosphinx Sovereign', 'Glacial Fortress', 'Orb of Dragonkind', 'Heartless Act', 'Tyrant of Discord', 'Grimdancer', 'Burning Inquiry', 'Edric, Spymaster of Trest', 'Barren Moor', 'Iron Apprentice', 'Dragon Mage', 'Mwonvuli Acid-Moss', 'Darkmoss Bridge', 'Arbor Elf', 'Vault Skirge', 'Bala Ged Recovery', 'Runed Halo', 'Rabbit Battery', 'Frantic Search', 'Drowned Secrets', 'Dwarven Reinforcements', 'Putrefy', 'Kitesail Cleric', 'Talisman of Resilience', 'Liesa, Forgotten Archangel', 'Promise of Bunrei', 'Summer Bloom', 'Grim Haruspex', 'Eidolon of Countless Battles', 'Grimoire Thief', 'Tazri, Beacon of Unity', 'Dusk Legion Zealot', 'Astral Cornucopia', 'Abundant Harvest', 'Grenzo, Dungeon Warden', 'Ral, Storm Conduit', 'Kiln Fiend', 'Honden of Seeing Winds', 'The Birth of Meletis', 'Ethereal Armor', 'Goldmire Bridge', 'Chandra''s Phoenix', 'Kambal, Consul of Allocation', 'Discovery // Dispersal', 'Skyline Cascade', 'Lotleth Troll', 'Deathbonnet Sprout', 'Might of Old Krosa', 'Thousand-Faced Shadow', 'Beast Whisperer', 'Creakwood Liege', 'Radha, Heart of Keld', 'Wort, Boggart Auntie', 'Elvish Mystic', 'Gargoyle Castle', 'Oketra the True', 'Sultai Charm', 'Ichorclaw Myr', 'Blood Seeker', 'Armor of Thorns', 'Slaughter Specialist', 'Intangible Virtue', 'Lantern of the Lost', 'Zulaport Cutthroat', 'Cerebral Vortex', 'Cathar Commando', 'Crackling Emergence', 'Ramunap Excavator', 'Thought Scour', 'Firewild Borderpost', 'Mass Hysteria', 'Canopy Cover', 'Karn''s Bastion', 'Armament Master', 'Conduit of Ruin', 'Banefire', 'Undercity Informer', 'Shaile, Dean of Radiance', 'Ranger''s Guile', 'Riveteers Charm', 'Alchemist''s Gambit', 'Gray Merchant of Asphodel', 'Seraph Sanctuary', 'Cloudstone Curio', 'Pelakka Wurm', 'Spatial Contortion', 'Pyroclasm', 'Mystic Monastery', 'Needle Spires', 'Unified Will', 'Sunscorched Desert', 'Pieces of the Puzzle', 'Haven of the Spirit Dragon', 'Avaricious Dragon', 'Leyline of the Meek', 'Ash Zealot', 'Quest for Ula''s Temple', 'Quicken', 'Vigorspore Wurm', 'Temple of Epiphany', 'Go-Shintai of Ancient Wars', 'Sterling Grove', 'Inspiring Overseer', 'Blade Splicer', 'Jwari Disruption', 'Path to the World Tree', 'Ingenious Infiltrator', 'Bojuka Brigand', 'Noxious Dragon', 'Xathrid Necromancer', 'Roil Eruption', 'Thrashing Brontodon', 'Aether Adept', 'Blisterpod', 'Skemfar Avenger', 'Uncage the Menagerie', 'Witch''s Cottage', 'Cathartic Reunion', 'Weapons Trainer', 'Unholy Heat', 'Hymn to Tourach', 'Carnophage', 'Animate Dead', 'Chandra Nalaar', 'Mistvein Borderpost', 'Meteor Golem', 'Tribute Mage', 'Angel of Invention', 'Tallowisp', 'Munda, Ambush Leader', 'Dragonkin Berserker', 'Compulsive Research', 'Zetalpa, Primal Dawn', 'Gruul Turf', 'Folio of Fancies', 'Forgotten Cave', 'Dovin Baan', 'Raven''s Crime', 'Outland Liberator', 'Vexing Shusher', 'Heartless Summoning', 'Lashwrithe', 'Gearseeker Serpent', 'Invade the City', 'Veinfire Borderpost', 'Undead Butler', 'Herald of the Pantheon', 'Dread Return', 'Void Shatter', 'Excavation Mole', 'Distended Mindbender', 'Experimental Synthesizer', 'Fiend Hunter', 'Worship', 'Kher Keep', 'Bedevil', 'Seething Song', 'Soul Warden', 'Clackbridge Troll', 'Blossoming Calm', 'Tribute to Horobi', 'Ethersworn Canonist', 'Queen of Ice', 'Ezuri, Renegade Leader', 'Omen of the Sun', 'Prophetic Prism', 'Liliana Vess', 'Fatigue', 'Vivid Marsh', 'Sundial of the Infinite', 'Seal of Removal', 'Realm Razer', 'Snapback', 'Duskdale Wurm', 'Temple of Abandon', 'Stingscourger', 'It That Betrays', 'Terastodon', 'Swiftwater Cliffs', 'Gilt-Leaf Archdruid', 'Esper Charm', 'Nissa''s Zendikon', 'Jukai Naturalist', 'Mind''s Desire', 'Universal Automaton', 'Scab-Clan Berserker', 'Jace Beleren', 'Cabal Therapist', 'Dragonspark Reactor', 'Shattered Perception', 'Font of Fertility', 'Phyrexian Dreadnought', 'Bident of Thassa', 'Chromatic Lantern', 'Sanctum of Stone Fangs', 'Duress', 'Student of Warfare', 'Serra Avatar', 'Ornithopter of Paradise', 'Scour All Possibilities', 'Stimulus Package', 'Satyr Wayfinder', 'Burst Lightning', 'Snow-Covered Mountain', 'Mire''s Grasp', 'Thrill of Possibility', 'Bone Picker', 'Cultivate', 'Terrarion', 'Thawing Glaciers', 'Shalai, Voice of Plenty', 'Mephidross Vampire', 'Destiny Spinner', 'Midnight Reaper', 'The Bloodsky Massacre', 'Orzhov Signet', 'Flame Slash', 'Hobgoblin Captain', 'Mythos of Nethroi', 'Dusk Mangler', 'Phylactery Lich', 'Arcbound Ravager', 'Ayli, Eternal Pilgrim', 'Ancestral Anger', 'Fact or Fiction', 'Ancient Stirrings', 'Nightscape Familiar', 'Firebrand Archer', 'Genju of the Realm', 'Cartographer''s Survey', 'Doom Foretold', 'Warstorm Surge', 'Ponder', 'Shinka, the Bloodsoaked Keep', 'Strike It Rich', 'Prosperous Thief', 'Ardent Elementalist', 'Abzan Charm', 'Fatal Grudge', 'Jarad''s Orders', 'Weaver of Harmony', 'Perilous Myr', 'Kabira Evangel', 'Phyrexian Revoker', 'Temple of Malady', 'Tymaret, Chosen from Death', 'Fire-Belly Changeling'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 81.0, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (78.1 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Burning Inquiry', 'Kambal, Consul of Allocation', 'Folio of Fancies', 'Flames of the Blood Hand', 'Vivid Marsh', 'Temple of Epiphany', 'Endbringer', 'Stirring Wildwood', 'Thirst for Discovery', 'Thought Scour', 'Malakir Rebirth', 'Ethersworn Canonist', 'Ancestral Anger', 'Kessig Flamebreather', 'Sundial of the Infinite', 'Hostage Taker', 'Crusher Zendikon', 'Jack-o''-Lantern', 'Incubation Druid', 'Munda, Ambush Leader', 'Temporal Fissure', 'Captain''s Claws', 'Gloomshrieker', 'Jadelight Ranger', 'Demonic Dread', 'Vryn Wingmare', 'Yidaro, Wandering Monster', 'Tempest Djinn', 'Void Shatter', 'Heartfire Immolator', 'Zurgo Bellstriker', 'Jace, Memory Adept', 'Containment Construct', 'Sign in Blood', 'Laboratory Maniac', 'Gatekeeper of Malakir', 'Archfiend''s Vessel', 'Rabbit Battery', 'Cloudpost', 'Renegade Tactics', 'Eye Collector', 'Hall of Oracles', 'Akroma''s Memorial', 'Vault Skirge', 'Hanweir Garrison', 'Saw It Coming', 'Lotleth Troll', 'Westvale Abbey', 'Tombstalker', 'Decree of Justice', 'Prizefight', 'Expansion // Explosion', 'Needle Spires', 'Imposing Sovereign', 'Mesa Enchantress', 'Llanowar Wastes', 'Firewild Borderpost', 'Bramble Wurm', 'Hada Freeblade', 'Harmonious Emergence', 'Blossoming Calm', 'Gideon Jura', 'Goldhound', 'Evolving Wilds', 'Howling Mine', 'Favored Hoplite', 'Hymn to Tourach', 'Revel in Riches', 'Wild Cantor', 'Wind Zendikon', 'Shattered Perception', 'Mirrodin Besieged', 'Field of Ruin', 'Day of Judgment', 'Unflinching Courage', 'Big Score', 'Chalice of Life', 'Sungold Sentinel', 'Myr Servitor', 'Sleight of Hand', 'Nezahal, Primal Tide', 'Mystifying Maze', 'Tribute Mage', 'Solitary Confinement', 'Ranger of Eos', 'Vault of the Archangel', 'Archaeomancer', 'Blood Fountain', 'Mysterious Tome', 'Scuttling Doom Engine', 'Impostor of the Sixth Pride', 'Kuldotha Rebirth', 'Snow-Covered Forest', 'Akoum Battlesinger', 'Cosima, God of the Voyage', 'Magister of Worth', 'Invoke Calamity', 'Incinerate', 'Temple of Mystery', 'Gryff''s Boon', 'Wayward Guide-Beast', 'Glacial Fortress', 'Abrade', 'Clifftop Retreat', 'Ponder', 'Approach of the Second Sun', 'Sandsteppe Citadel', 'Dragon Hatchling', 'Rakdos Pit Dragon', 'Secluded Glen', 'Voidmage Prodigy', 'Shigeki, Jukai Visionary', 'Voldaren Epicure', 'Double Vision', 'Sphinx''s Tutelage', 'Mogg War Marshal', 'Desperate Ritual', 'Stubborn Denial', 'Terramorphic Expanse', 'Brittle Effigy', 'Walking Skyscraper', 'Temple of Triumph', 'Animate Dead', 'Voltage Surge', 'Llanowar Elves', 'Hagra Mauling', 'Cathar Commando', 'Uncage the Menagerie', 'Inkwell Leviathan', 'Hypnox', 'Springbloom Druid', 'Wrath of God', 'Slagstorm', 'Goldmire Bridge', 'Moon-Circuit Hacker', 'Skyline Cascade', 'Jokulhaups', 'Touch the Spirit Realm', 'Changeling Outcast', 'Flamescroll Celebrant', 'Fabricate', 'Restore Balance', 'Mortuary Mire', 'Shrapnel Blast', 'Delay', 'Myojin of Seeing Winds', 'Erebos''s Intervention', 'Abundant Harvest', 'Resurgent Belief', 'Glyph Keeper', 'Viscera Seer', 'Skyclave Shade', 'Ivory Tower', 'Temple of Deceit', 'Ghoulcaller''s Harvest', 'Panoptic Mirror', 'Dusk Mangler', 'Sphinx of Foresight', 'Whelming Wave', 'Experimental Frenzy', 'Tempered Steel', 'Nightscape Familiar', 'Mausoleum Secrets', 'Dauntless Unity', 'Tide Shaper', 'Starnheim Courser', 'Eiganjo Castle', 'Terrarion', 'Dragonspark Reactor', 'Cliffside Lookout', 'Spirit Mantle', 'Master of Predicaments', 'Fallen Shinobi', 'Master of Etherium', 'Demigod of Revenge', 'The Raven''s Warning', 'Temple of Malady', 'Thraben Inspector', 'Sojourner''s Companion', 'Search for Tomorrow', 'Hero of Precinct One', 'Lochmere Serpent', 'Turnabout', 'Witch''s Cottage', 'Immortal Servitude', 'Abiding Grace', 'Gadwick, the Wizened', 'Tangled Florahedron', 'Zur''s Weirding', 'Bow of Nylea', 'Snowfield Sinkhole', 'Earthshaker Khenra', 'Tazri, Beacon of Unity', 'Aether Adept', 'Colossal Skyturtle', 'Dread Fugue', 'Lashwrithe', 'Hellrider', 'Reinforced Ronin', 'Mesmeric Fiend', 'Maestros Charm', 'Hedron Alignment', 'Ghoultree', 'Reach Through Mists', 'Inspiring Overseer', 'Phyrexian Revoker', 'Gearseeker Serpent', 'Sea Gate Oracle', 'Duskdale Wurm', 'Rise and Shine', 'Draconic Roar', 'Brainstone', 'Bone Shards', 'Bloodthrone Vampire', 'Talus Paladin', 'Shatter the Sky', 'Howl of the Night Pack', 'Harsh Mentor', 'Darkmoss Bridge', 'Feed the Swarm', 'Tithe Taker', 'Hunted Horror', 'Skyclave Cleric', 'Kjeldoran Dead', 'Blood for Bones', 'Ornithopter of Paradise', 'Shalai, Voice of Plenty', 'Rakdos Cackler', 'Dive Down', 'Pyretic Ritual', 'Tunnel Ignus', 'Dimir Charm', 'Search Party Captain', 'Myr Retriever', 'Silverbluff Bridge', 'Sphere of Safety', 'Vampire''s Kiss', 'Fiery Justice', 'Nested Shambler', 'Ghost Quarter', 'Invigorating Hot Spring', 'Bag of Holding', 'Dawn of Hope', 'Seal of Fire', 'Rotten Reunion', 'Vampire Nighthawk', 'Restoration Angel', 'Glorybringer', 'Reap the Past', 'Fiery Temper', 'Hissing Quagmire', 'Triskelion', 'Metallic Rebuke', 'Stormtide Leviathan', 'Greater Gargadon', 'Kefnet the Mindful', 'Dream Eater', 'Inevitable Betrayal', 'Forgotten Cave', 'Words of Worship', 'Might of Old Krosa', 'Undercity Informer', 'Blue Sun''s Zenith', 'Arcbound Ravager', 'Fact or Fiction', 'Nevinyrral''s Disk', 'Condemn', 'Empty the Warrens', 'Overwhelmed Apprentice', 'Ravenous Chupacabra', 'Windborn Muse', 'Dreadhorde Invasion', 'Tocatli Honor Guard', 'Devastation Tide', 'Mystic Monastery', 'Angel of Glory''s Rise', 'Seething Song', 'Circuit Mender', 'Beyeen Veil', 'Martyr''s Soul', 'Brokers Hideout', 'Discovery // Dispersal', 'Rally the Ancestors', 'Snow-Covered Swamp', 'Dragonkin Berserker', 'Ember-Fist Zubera', 'Gitaxian Probe', 'Ethereal Armor', 'Iron Apprentice', 'Arguel''s Blood Fast', 'Liliana Vess', 'Invigorate', 'Thundering Rebuke', 'Consuming Vapors', 'Scorched Rusalka', 'Blacksmith''s Skill', 'Archpriest of Iona', 'Eye of Nowhere', 'Kazandu Blademaster', 'Pelakka Wurm', 'Cleansing Nova', 'Urza''s Factory', 'Nephalia Academy', 'Runed Halo', 'Oran-Rief Ooze', 'Ranger''s Guile', 'Fauna Shaman', 'Diabolic Edict', 'Spiteful Visions', 'Grozoth', 'Mana Leak', 'Glimmerpost', 'Improbable Alliance', 'Memory Lapse', 'Ash Zealot', 'Oni-Cult Anvil', 'Revitalize', 'Mistvault Bridge', 'Hushwing Gryff', 'Distortion Strike', 'Acidic Slime', 'Sylvan Advocate', 'Temple of Silence', 'Spell Burst', 'Tooth and Nail', 'Banefire', 'Seismic Assault', 'Dangerous Wager', 'Wipe Away', 'Entrancing Melody', 'Wheel of Fate', 'The Birth of Meletis', 'Goblin Bombardment', 'Hunted Witness', 'Hotshot Mechanic', 'Panglacial Wurm', 'Kodama''s Reach', 'Bloodsky Berserker', 'Lodestone Golem', 'Riveteers Requisitioner', 'Arcbound Stinger', 'Archway Commons', 'Orim''s Chant', 'Lavaclaw Reaches', 'Omenspeaker', 'Riptide Laboratory', 'Obscura Storefront', 'Fire-Belly Changeling', 'Kazandu Mammoth', 'Mirari''s Wake', 'Mythos of Brokkos', 'Cultivate', 'Rootbound Crag', 'Sterling Grove', 'Artisan of Kozilek', 'Spirited Companion', 'Heartless Act', 'Bane of Bala Ged', 'See the Truth', 'Spellgorger Weird', 'Snow-Covered Plains', 'Thassa''s Intervention', 'Benevolent Bodyguard', 'Blisterpod', 'Signal Pest', 'Forbid', 'Asylum Visitor', 'Future Sight', 'Gadrak, the Crown-Scourge', 'Ghostly Flicker', 'Judge''s Familiar', 'Hall of the Bandit Lord', 'Novice Occultist', 'Avatar of Woe', 'Unesh, Criosphinx Sovereign', 'Anticipate', 'Shriekmaw', 'Wildfield Borderpost', 'Vampires'' Vengeance', 'Dockside Chef', 'Mishra''s Factory', 'Hinterland Harbor', 'Augur of Bolas', 'Satyr Wayfinder', 'Nissa''s Zendikon', 'Glint-Horn Buccaneer', 'Ornithopter', 'Memory''s Journey', 'Woodland Cemetery', 'Orzhov Charm', 'Summer Bloom', 'Enigmatic Incarnation', 'Lifelink', 'Fevered Visions', 'Take Inventory', 'Mindslaver', 'Lose Focus', 'Phylactery Lich', 'Dead // Gone', 'Dakmor Salvage', 'Clarion Spirit', 'Shard Volley', 'Runeflare Trap', 'Drowned Secrets', 'Genju of the Realm', 'Boomerang', 'Exclude', 'Gather the Townsfolk', 'Weapons Trainer', 'Massive Might', 'Remorseful Cleric', 'Stromkirk Noble', 'Canyon Slough', 'Hero of Iroas', 'Pyroclasm', 'Divert', 'Cleansing Wildfire', 'Sprite Dragon', 'Towashi Guide-Bot', 'Stoneforge Masterwork', 'Upriser Renegade', 'Izzet Charm', 'Lonely Sandbar', 'Court Homunculus', 'Doom Foretold', 'Farseek', 'Icehide Golem', 'Razortide Bridge', 'Chain Reaction', 'Master of Death', 'Kunoros, Hound of Athreos', 'Lizard Blades', 'Etherium Sculptor', 'Stone Haven Outfitter', 'Alchemist''s Refuge', 'Sanguine Statuette', 'Kiln Fiend', 'Inner-Flame Acolyte', 'Lumbering Falls', 'Stern Dismissal', 'Burst Lightning', 'Quicken', 'Blighted Agent', 'Painful Truths', 'Mirrodin''s Core', 'Ghitu Encampment', 'Flame Slash', 'Ajani, the Greathearted', 'Doomed Dissenter', 'River Serpent', 'Haven of the Spirit Dragon', 'Dark-Dweller Oracle', 'Mizzium Mortars', 'Buried Ruin', 'Reckless Waif', 'Spatial Contortion', 'Frontier Bivouac', 'Distended Mindbender', 'Khalni Ambush', 'Halimar Depths', 'Soul''s Attendant', 'Golden Wish', 'Timeless Witness', 'Faerie Vandal', 'Geomancer''s Gambit', 'Crumbling Vestige', 'Molten Vortex', 'Time Wipe', 'Incendiary Flow', 'Research // Development', 'Reality Ripple', 'Become Immense', 'Grim Haruspex', 'Servo Exhibition', 'Ramunap Excavator', 'Battlefield Forge', 'Prosperous Thief', 'Thaumatic Compass', 'Azor, the Lawbringer', 'Oath of Liliana', 'Reckoner''s Bargain', 'Valiant Changeling', 'Cerebral Vortex', 'Dragon''s Hoard', 'Nahiri''s Wrath', 'Ancient Stirrings', 'Displace', 'Mantis Rider', 'Dragon Tempest', 'Hieroglyphic Illumination', 'Caves of Koilos', 'Dread Return', 'Vengeful Pharaoh', 'Akoum Stonewaker', 'Genesis Wave', 'Path to the World Tree', 'Secluded Steppe', 'Ingenious Infiltrator', 'Cloudblazer', 'Sage''s Row Savant', 'Judith, the Scourge Diva', 'Temple of Enlightenment', 'Stormblood Berserker', 'Worship', 'Duskwatch Recruiter', 'Thundering Raiju', 'Kazuul''s Fury', 'Cauldron''s Gift', 'Deathbonnet Sprout', 'Bringer of the Red Dawn', 'Growth-Chamber Guardian', 'Birds of Paradise', 'Endless One', 'Elves of Deep Shadow', 'Tanglepool Bridge', 'Bloodbraid Elf', 'Avacyn''s Pilgrim', 'Maestros Theater', 'Foundation Breaker', 'Spider Umbra', 'Essence Flux', 'Dark Ritual', 'Silver-Fur Master', 'Orb of Dragonkind', 'Vivid Meadow', 'Destiny Spinner', 'Furyblade Vampire', 'Bad River', 'Thousand-Faced Shadow', 'Raffine''s Informant', 'Grimoire Thief', 'Balustrade Spy', 'Stormfist Crusader', 'Kabira Evangel', 'Arcbound Worker', 'Sylvan Scrying', 'Magister Sphinx', 'Dream Trawler', 'Metalwork Colossus', 'Suture Priest', 'Mind''s Desire', 'Swans of Bryn Argoll', 'Fatestitcher', 'Rampant Growth', 'Fieldmist Borderpost', 'Captivating Vampire', 'Chasm Skulker', 'Mass Hysteria', 'Gray Merchant of Asphodel', 'Transguild Promenade', 'Universal Automaton', 'Lullmage Mentor', 'Thornglint Bridge', 'Vampire of the Dire Moon', 'Student of Warfare', 'Bankrupt in Blood', 'Sarkhan, the Dragonspeaker', 'Refuse // Cooperate', 'Familiar''s Ruse', 'Jukai Naturalist', 'Crackling Emergence', 'Explore', 'Anticognition', 'Goblin Bushwhacker', 'Stitch in Time', 'Armor of Thorns', 'Bogardan Hellkite', 'Benalish Marshal', 'Slagwoods Bridge', 'Eye of Vecna', 'Lava Dart', 'Behold the Multiverse', 'Delver of Secrets', 'Crumbling Necropolis', 'Indulgent Aristocrat', 'Esper Charm', 'Glint Hawk', 'Faerie Miscreant', 'Spikefield Hazard', 'Rite of Oblivion', 'Blackbloom Rogue', 'Hunted Nightmare', 'Fling', 'Queen of Ice', 'Vampiric Fury', 'Tectonic Giant', 'Hold for Ransom', 'Frantic Search', 'Ghitu Lavarunner', 'Windcaller Aven', 'Olivia Voldaren', 'Grim Lavamancer', 'New Benalia', 'Treasure Hunt', 'Faithful Mending', 'Mirrorshell Crab', 'Terminus', 'Fiend Hunter', 'Strike It Rich', 'Elixir of Immortality', 'Elvish Pioneer', 'Game Trail', 'Electrolyze', 'Thunderbreak Regent', 'Infernal Grasp', 'Kick in the Door', 'Disallow', 'Swiftwater Cliffs', 'Muddle the Mixture', 'Kami of False Hope', 'Omen of the Sun', 'Phantasmagorian', 'Rally the Peasants', 'Mire Triton', 'Cabal Therapist', 'Go-Shintai of Lost Wisdom', 'Sylvan Library', 'Shreds of Sanity', 'Sacred Fire', 'Goblin Anarchomancer', 'Epochrasite', 'Azorius Signet', 'Eldrazi Mimic', 'Festival Crasher', 'Falkenrath Aristocrat', 'Roil Eruption', 'Leechridden Swamp', 'Timely Reinforcements', 'Xathrid Necromancer', 'Jwari Disruption', 'Temple of Plenty', 'Blight Mamba', 'Champion of the Parish', 'Mobilized District', 'Coiling Oracle', 'Scour All Possibilities', 'Warstorm Surge', 'Tymaret, Chosen from Death', 'Excavation Mole', 'Vapor Snag', 'Mentor of the Meek', 'Honor of the Pure', 'Chain Lightning', 'Azorius Charm', 'Nomad Outpost', 'Qasali Pridemage', 'Treasure Cruise', 'Ally Encampment', 'Norin the Wary', 'Sky Diamond', 'Tarfire', 'Drossforge Bridge', 'Sultai Charm', 'Pieces of the Puzzle', 'Scout''s Warning', 'Foreboding Ruins', 'Lantern of the Lost', 'Oust', 'Blazing Hope', 'Insolent Neonate', 'Spell Pierce', 'Sanctum of Stone Fangs', 'Crash Through', 'Pull from Tomorrow', 'Windbrisk Heights', 'Mirror Entity', 'Midnight Reaper', 'Think Twice', 'Acolyte of Affliction', 'Phyrexian Dreadnought', 'Walk the Aeons', 'Barren Moor', 'Detention Sphere', 'Undead Butler', 'Bident of Thassa', 'Abzan Charm', 'Fatigue', 'It That Betrays', 'Vivid Grove', 'Rustvale Bridge', 'Mortician Beetle', 'Viashino Pyromancer', 'Bloodchief''s Thirst', 'Experimental Synthesizer', 'Vedalken Archmage', 'Garruk Wildspeaker', 'Darigaaz Reincarnated', 'Precognition Field', 'Martyr of Sands', 'Negate', 'Dragonskull Summit', 'Mistvein Borderpost', 'Master of the Feast', 'Patchwork Automaton', 'Deathreap Ritual', 'Early Harvest', 'Doomed Traveler', 'Azami, Lady of Scrolls', 'Bloodbraid Marauder', 'Izzet Boilerworks', 'An Offer You Can''t Refuse', 'Trostani''s Summoner', 'Claim the Firstborn', 'Thrashing Brontodon', 'Stromkirk Occultist', 'Grisly Salvage', 'Gruul Turf', 'Bedlam Reveler', 'Midnight Clock', 'Wall of Omens', 'Duress', 'Jace Beleren', 'Hypergenesis', 'Ancestral Statue', 'Ruin Crab', 'Fraying Sanity', 'Outland Liberator', 'Hour of Promise', 'Fire-Lit Thicket', 'Shardless Agent', 'Vesperlark', 'Shriekhorn', 'Soul Snare', 'Ball Lightning', 'Tragic Slip', 'Ritual of Soot', 'Falkenrath Pit Fighter', 'Ruric Thar, the Unbowed', 'Tyrant''s Scorn', 'Dimir Aqueduct', 'Funeral Rites', 'Treacherous Blessing', 'Dragon Fangs', 'Satoru Umezawa', 'Blanchwood Armor', 'Jarad''s Orders', 'Silundi Vision', 'Witching Well', 'Shock', 'Dregscape Zombie', 'Quest for Ula''s Temple', 'Kabira Takedown', 'Kaya, Ghost Assassin', 'Diregraf Rebirth', 'Seaside Citadel', 'The Bloodsky Massacre', 'Call of the Death-Dweller', 'Flame Rift', 'Jackal Pup', 'Feasting Troll King', 'Conduit of Ruin', 'Blazing Shoal', 'Brave the Elements', 'Sarkhan the Masterless', 'Altar''s Reap', 'Skemfar Avenger', 'Unlucky Witness', 'Noxious Dragon', 'Vindicate', 'Phoenix of Ash', 'Crux of Fate', 'Wailing Ghoul', 'Flame-Kin Zealot', 'Galvanic Relay', 'Fuel for the Cause', 'Primal Command', 'Bala Ged Recovery', 'Not of This World', 'Gladecover Scout', 'The Scorpion God', 'Abbot of Keral Keep', 'Grapeshot', 'Michiko''s Reign of Truth', 'Soul Warden', 'Fast // Furious', 'All Suns'' Dawn', 'Tendrils of Agony', 'Thawing Glaciers', 'Underworld Dreams', 'Corrupted Zendikon', 'Possessed Skaab', 'Declaration in Stone', 'Frost Bite', 'Falkenrath Gorger', 'Shinka, the Bloodsoaked Keep', 'Curiosity', 'Ensoul Artifact', 'Commit // Memory', 'Merfolk Secretkeeper', 'Gaea''s Blessing', 'Dragon Mage', 'Mythos of Nethroi', 'Magmatic Insight', 'Dragon Turtle', 'Vastwood Zendikon', 'Harrow', 'Goro-Goro, Disciple of Ryusei', 'Squadron Hawk', 'Tireless Provisioner', 'Auramancer', 'Tendo Ice Bridge', 'Giant Killer', 'Dokuchi Silencer', 'Dread Presence', 'Old Stickfingers', 'Slumbering Dragon', 'Font of Fertility', 'Vivid Crag', 'Deep Analysis', 'Drowned Catacomb', 'Floating-Dream Zubera', 'Postmortem Lunge', 'Ajani Goldmane', 'Sea Gate Wreckage', 'Khalni Heart Expedition', 'Cursecatcher', 'Patch Up', 'Bloodline Keeper', 'Staff of Domination', 'General Ferrous Rokiric', 'Anax, Hardened in the Forge', 'Prophetic Prism', 'Sekki, Seasons'' Guide', 'Oblivion Ring', 'Etched Champion', 'Serra Avatar', 'Raging Ravine', 'Naban, Dean of Iteration', 'Nicol Bolas, Planeswalker', 'Ichorclaw Myr', 'Gorging Vulture', 'Barbarian Ring', 'Bone Picker', 'Engulf the Shore', 'Scab-Clan Berserker', 'Arch of Orazca', 'Coalition Relic', 'Keruga, the Macrosage', 'Security Rhox', 'Alchemist''s Gambit', 'Glen Elendra Archmage', 'Pelakka Predation', 'Kira, Great Glass-Spinner', 'Haunted Dead', 'Goblin Electromancer', 'Dripping-Tongue Zubera', 'Lunarch Veteran', 'Dovin Baan', 'Opt', 'Goblin Dark-Dwellers', 'Foul Orchard', 'Repeal', 'Mistblade Shinobi', 'Unholy Heat', 'Serrated Scorpion', 'Vigorspore Wurm', 'Slip Out the Back', 'Mouth of Ronom', 'Guardian of Tazeem', 'Mystic Retrieval', 'Trickbind', 'Cruel Ultimatum', 'Secluded Courtyard', 'Kumano Faces Kakkazan', 'Veinfire Borderpost', 'Reckless Impulse', 'Snow-Covered Mountain', 'Varragoth, Bloodsky Sire', 'Vivid Creek', 'Chandra, Pyromaster', 'Kjeldoran Outpost', 'Dryad Militant', 'Crackling Drake', 'Avaricious Dragon', 'Bontu the Glorified', 'Riveteers Overlook', 'Dennick, Pious Apprentice', 'Herald of the Pantheon', 'Wooded Bastion', 'Cordial Vampire', 'Zulaport Cutthroat', 'Stimulus Package', 'Magus of the Candelabra', 'Firebrand Archer'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 78.1, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (66.1 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Shigeki, Jukai Visionary', 'Invigorating Hot Spring', 'Leechridden Swamp', 'Disallow', 'Kaya, Ghost Assassin', 'Mesmeric Fiend', 'Firebolt', 'Shriekhorn', 'Foundation Breaker', 'Serra Avatar', 'Soul Snare', 'Martyr''s Soul', 'Gideon Jura', 'Obscura Storefront', 'Cerebral Vortex', 'Undercity Informer', 'Halimar Depths', 'Insolent Neonate', 'Signal Pest', 'Fabricate', 'Myr Landshaper', 'Witch''s Cottage', 'Llanowar Wastes', 'Blackbloom Rogue', 'Splinter', 'Sylvan Scrying', 'Thrashing Brontodon', 'Gorging Vulture', 'Bankrupt in Blood', 'Memory''s Journey', 'Hall of the Bandit Lord', 'Altar''s Reap', 'Rakdos Pit Dragon', 'Wailing Ghoul', 'Stubborn Denial', 'Jace Beleren', 'Mire Triton', 'Verdant Command', 'Mass Hysteria', 'Diabolic Edict', 'Kabira Evangel', 'Tomb of Urami', 'Temple of Silence', 'Transguild Promenade', 'Dragon Hatchling', 'Lava Dart', 'Raging Ravine', 'Hanweir Garrison', 'Deathbonnet Sprout', 'Silumgar Sorcerer', 'Goblin Dark-Dwellers', 'Conduit of Ruin', 'Dragon Turtle', 'Towashi Guide-Bot', 'Mesa Enchantress', 'Ancestral Statue', 'Kazandu Blademaster', 'Tarfire', 'Munda, Ambush Leader', 'Colossal Skyturtle', 'Scuttling Doom Engine', 'Declaration in Stone', 'Zur''s Weirding', 'Behold the Multiverse', 'Abzan Charm', 'Pull from Tomorrow', 'Balustrade Spy', 'Selesnya Charm', 'Halimar Excavator', 'Wild Cantor', 'Krosan Grip', 'Voldaren Epicure', 'Windcaller Aven', 'Blossoming Sands', 'Revel in Riches', 'Giant Ox', 'Base Camp', 'Captain''s Claws', 'Deathreap Ritual', 'Grapeshot', 'Gadrak, the Crown-Scourge', 'Liquimetal Coating', 'Kin-Tree Invocation', 'Blistercoil Weird', 'Shrapnel Blast', 'Pyroclasm', 'Snow-Covered Forest', 'Old Stickfingers', 'Rise and Shine', 'Golden Wish', 'Liliana Vess', 'Upriser Renegade', 'Metalwork Colossus', 'Yahenni''s Expertise', 'Tendo Ice Bridge', 'Changeling Outcast', 'Hymn to Tourach', 'Fatestitcher', 'Fertile Ground', 'Maestros Charm', 'Tempest Djinn', 'Artisan of Kozilek', 'Vedalken Anatomist', 'Vivid Crag', 'Goblin Electromancer', 'Mogg War Marshal', 'Malakir Rebirth', 'Armor of Thorns', 'Dauntless Unity', 'Judith, the Scourge Diva', 'Vengeful Pharaoh', 'Anticipate', 'Shape the Sands', 'Brokers Hideout', 'Void Shatter', 'Glorybringer', 'Gatekeeper of Malakir', 'Myr Servitor', 'Trickbind', 'Ajani, the Greathearted', 'Crimson Wisps', 'Blisterpod', 'Dovin Baan', 'Asylum Visitor', 'Disowned Ancestor', 'Bala Ged Recovery', 'Timely Reinforcements', 'Mysterious Tome', 'Nirkana Assassin', 'Arcbound Ravager', 'Obsessive Search', 'Containment Construct', 'Assault Formation', 'Jace, Memory Adept', 'Grimoire Thief', 'Walk the Aeons', 'Arbor Elf', 'Crux of Fate', 'Disruptive Pitmage', 'Ghoulcaller''s Harvest', 'Vampires'' Vengeance', 'Akoum Battlesinger', 'Deep Analysis', 'Bag of Holding', 'Kumano Faces Kakkazan', 'Mantis Rider', 'Banefire', 'Gadwick, the Wizened', 'Ruric Thar, the Unbowed', 'Experimental Synthesizer', 'Harmonize', 'Reap the Past', 'Temple of Mystery', 'Expedite', 'Sandsteppe Citadel', 'Hold for Ransom', 'Chain Reaction', 'Viscera Seer', 'Dimir Aqueduct', 'Postmortem Lunge', 'Gryff''s Boon', 'Stern Dismissal', 'Champion of the Parish', 'Spell Burst', 'Cloudblazer', 'Dragon''s Hoard', 'Giant Killer', 'The Birth of Meletis', 'Bad River', 'Hour of Promise', 'Psychatog', 'Chain Lightning', 'Gavony Township', 'Day of Judgment', 'Distended Mindbender', 'Floating-Dream Zubera', 'Servo Exhibition', 'Kjeldoran Dead', 'Mythos of Brokkos', 'See the Truth', 'Jwari Disruption', 'Ajani Goldmane', 'Fast // Furious', 'Nightscape Familiar', 'Ornithopter', 'Hagra Mauling', 'Circular Logic', 'Elves of Deep Shadow', 'Tireless Provisioner', 'Drowned Secrets', 'Alchemist''s Refuge', 'Grisly Salvage', 'Prophet of Kruphix', 'Essence Flux', 'Refuse // Cooperate', 'Galvanic Relay', 'Myojin of Seeing Winds', 'Edric, Spymaster of Trest', 'Tithe Taker', 'Dennick, Pious Apprentice', 'Scab-Clan Berserker', 'Varragoth, Bloodsky Sire', 'Curse of Thirst', 'Restoration Angel', 'Mindslaver', 'Codie, Vociferous Codex', 'Brainstone', 'Bloodsky Berserker', 'Sojourner''s Companion', 'Fiend Hunter', 'Seething Song', 'Opulent Palace', 'Abbot of Keral Keep', 'Cliffside Lookout', 'Norin the Wary', 'Ghitu Lavarunner', 'Jukai Naturalist', 'Mystic Monastery', 'Negate', 'Sacred Fire', 'Garruk Wildspeaker', 'Vivid Grove', 'Gaea''s Blessing', 'Stormblood Berserker', 'Shard Volley', 'Arcbound Worker', 'Infernal Grasp', 'Cathar Commando', 'Decree of Justice', 'Hissing Quagmire', 'Goblin Bushwhacker', 'Raise the Alarm', 'Jokulhaups', 'Hostage Taker', 'Vivid Marsh', 'Weapons Trainer', 'Thawing Glaciers', 'Foul Orchard', 'Razortide Bridge', 'Electrolyze', 'Talus Paladin', 'Lotleth Troll', 'Blue Sun''s Zenith', 'Wind Zendikon', 'Birds of Paradise', 'General Ferrous Rokiric', 'Fieldmist Borderpost', 'Westvale Abbey', 'Slaughter Specialist', 'Not of This World', 'Mirari''s Wake', 'Bloodthrone Vampire', 'Secluded Steppe', 'Fire-Lit Thicket', 'Ethereal Armor', 'Animate Dead', 'Hotshot Mechanic', 'Dawn of Hope', 'Wildfield Borderpost', 'Mouth of Ronom', 'Yoked Ox', 'Coalition Relic', 'Tooth and Nail', 'Hero of Iroas', 'Empty the Warrens', 'Dragonspark Reactor', 'Ember-Fist Zubera', 'Eiganjo Castle', 'Bloodbraid Marauder', 'Fling', 'Revitalize', 'Endless One', 'Mystifying Maze', 'Glint Hawk', 'Goblin Bombardment', 'Michiko''s Reign of Truth', 'Wooded Bastion', 'Memory Plunder', 'Bane of Bala Ged', 'Mirrorshell Crab', 'Frantic Search', 'Terminus', 'Char', 'Rustvale Bridge', 'Gloomshrieker', 'Field of Ruin', 'Graypelt Refuge', 'Painful Truths', 'Mirrodin''s Core', 'Glimmerpost', 'Grozoth', 'Kjeldoran Outpost', 'Doran, the Siege Tower', 'Strike It Rich', 'Azorius Charm', 'Riveteers Overlook', 'Anticognition', 'Vampire Nighthawk', 'Dripping-Tongue Zubera', 'Stromkirk Noble', 'Master of Etherium', 'Claim the Firstborn', 'Bone Shards', 'Thunderbreak Regent', 'Reality Ripple', 'Falkenrath Gorger', 'Silundi Vision', 'The Scorpion God', 'Dusk Mangler', 'Cloudpost', 'Spell Pierce', 'Faithful Mending', 'Impostor of the Sixth Pride', 'Doomed Traveler', 'Dark Ritual', 'Noxious Dragon', 'Eldrazi Mimic', 'Vryn Wingmare', 'Tazri, Beacon of Unity', 'Icehide Golem', 'Esper Charm', 'Slip Out the Back', 'Snow-Covered Plains', 'Deprive', 'Corrupted Zendikon', 'Thassa''s Intervention', 'Dangerous Wager', 'Akroan Crusader', 'Doomed Dissenter', 'Vedalken Aethermage', 'Mirrodin Besieged', 'Etched Champion', 'Farseek', 'Ensoul Artifact', 'Elixir of Immortality', 'Foreboding Ruins', 'Curse of Death''s Hold', 'Ghost Quarter', 'Barren Moor', 'Bloodbraid Elf', 'Magister of Worth', 'Flames of the Blood Hand', 'Phyrexian Dreadnought', 'Abundant Harvest', 'Vedalken Archmage', 'Tangled Florahedron', 'Brave the Elements', 'Endbringer', 'Ghostly Flicker', 'Khalni Ambush', 'Boomerang', 'Experimental Overload', 'Ajani''s Pridemate', 'Explore', 'Take Inventory', 'Big Score', 'Crumbling Necropolis', 'Blanchwood Armor', 'Glen Elendra Archmage', 'Haze of Rage', 'Thraben Inspector', 'Drowned Catacomb', 'Excavation Mole', 'Suture Priest', 'Drossforge Bridge', 'Pieces of the Puzzle', 'Fraying Sanity', 'Stromkirk Occultist', 'Devastation Tide', 'Fire-Belly Changeling', 'Fevered Visions', 'River Serpent', 'Myr Retriever', 'Heartless Act', 'Divert', 'Expansion // Explosion', 'Unified Will', 'Tragic Slip', 'Security Rhox', 'Eye Collector', 'Inevitable Betrayal', 'Prodigal Sorcerer', 'Wrath of God', 'Haven of the Spirit Dragon', 'Lunarch Veteran', 'Unflinching Courage', 'Stormfist Crusader', 'Zulaport Cutthroat', 'Mirror Entity', 'Izzet Charm', 'Dragonkin Berserker', 'Ravenous Chupacabra', 'Flame Slash', 'Duress', 'Temple of Malady', 'Circuit Mender', 'Patch Up', 'Nested Shambler', 'Vampire Envoy', 'Etherium Sculptor', 'Silverbluff Bridge', 'Woodland Cemetery', 'Fatigue', 'Magmatic Insight', 'Nissa''s Zendikon', 'Ivory Tower', 'Cleansing Wildfire', 'Kodama''s Reach', 'Abrade', 'Sower of Temptation', 'Bloodchief''s Thirst', 'Soul''s Attendant', 'Hunted Nightmare', 'Kefnet the Mindful', 'Azorius Signet', 'It That Betrays', 'Ball Lightning', 'Fauna Shaman', 'All Suns'' Dawn', 'Lifelink', 'Spellgorger Weird', 'Liquimetal Torque', 'Words of Worship', 'Destiny Spinner', 'Tendrils of Agony', 'Barrin, Tolarian Archmage', 'Universal Automaton', 'Quicken', 'Prophetic Prism', 'Dregscape Zombie', 'Ornithopter of Paradise', 'Oblivion Ring', 'Mistvein Borderpost', 'Glacial Fortress', 'Turnabout', 'Unexpected Results', 'Jadelight Ranger', 'Night of Souls'' Betrayal', 'Intangible Virtue', 'Condemn', 'Stitch in Time', 'Flamescroll Celebrant', 'Earthshaker Khenra', 'Cultivate', 'Crowd''s Favor', 'Mwonvuli Acid-Moss', 'Hero of Precinct One', 'Ancient Lumberknot', 'Riveteers Requisitioner', 'Master of Predicaments', 'Sorin''s Vengeance', 'Archpriest of Iona', 'Clifftop Retreat', 'Gitaxian Probe', 'Reckoner''s Bargain', 'Sleight of Hand', 'Dread Return', 'Sarkhan, the Dragonspeaker', 'Lavaclaw Reaches', 'Needle Spires', 'Garth One-Eye', 'Sultai Charm', 'Chandra, Pyromaster', 'Gladecover Scout', 'Midnight Guard', 'Midnight Reaper', 'Incubation Druid', 'Outland Liberator', 'Sphere of Safety', 'Goblin Anarchomancer', 'Niv-Mizzet, the Firemind', 'Repeal', 'Underworld Dreams', 'Valiant Changeling', 'Dragon Mage', 'Enigmatic Incarnation', 'Zurgo Bellstriker', 'Ancestral Anger', 'Inkwell Leviathan', 'Dragon Fangs', 'Avatar of Woe', 'Pyretic Ritual', 'Tunnel Ignus', 'Pelakka Predation', 'Clackbridge Troll', 'Nicol Bolas, Planeswalker', 'Nephalia Academy', 'Walking Skyscraper', 'Precognition Field', 'Queen of Ice', 'Sign in Blood', 'Trespasser''s Curse', 'Hinterland Harbor', 'Immortal Servitude', 'Possessed Skaab', 'Master of the Feast', 'Apprentice Wizard', 'Phoenix of Ash', 'Beyeen Veil', 'Exclude', 'Timeless Witness', 'Rotten Reunion', 'Mishra''s Factory', 'Wayward Guide-Beast', 'Falkenrath Aristocrat', 'Ethersworn Canonist', 'Unesh, Criosphinx Sovereign', 'Seaside Citadel', 'Riptide Laboratory', 'Grizzled Leotau', 'Step Through', 'Stormtide Leviathan', 'Saw It Coming', 'Squadron Hawk', 'Dream Trawler', 'Storm Entity', 'Mystic Retrieval', 'The Raven''s Warning', 'Genju of the Realm', 'Roil Eruption', 'Delver of Secrets', 'Fuel for the Cause', 'Guardian of Tazeem', 'Erebos''s Intervention', 'Displace', 'Uncage the Menagerie', 'Bramble Wurm', 'Thundering Raiju', 'Ritual of Soot', 'Harrow', 'Heartfire Immolator', 'Akoum Stonewaker', 'Thirst for Discovery', 'Eye of Nowhere', 'Inspiring Overseer', 'Arcbound Stinger', 'Slumbering Dragon', 'Double Vision', 'Sage''s Dousing', 'Incendiary Flow', 'Glint-Horn Buccaneer', 'Funeral Rites', 'Nevinyrral''s Disk', 'Panoptic Mirror', 'Cruel Reality', 'Archway Commons', 'Sea Gate Wreckage', 'Entrancing Melody', 'Bojuka Brigand', 'Voltage Surge', 'Nahiri''s Wrath', 'Unlucky Witness', 'Hada Freeblade', 'Bone Picker', 'Future Sight', 'Stimulus Package', 'Frontier Bivouac', 'Fact or Fiction', 'Solitary Confinement', 'Wall of Omens', 'Famished Paladin', 'Jarad''s Orders', 'Reinforced Ronin', 'Blood for Bones', 'Avacyn''s Pilgrim', 'Secluded Courtyard', 'Sea Gate Oracle', 'Temple of Epiphany', 'Lumbering Falls', 'Favored Hoplite', 'Dragon Tempest', 'Izzet Boilerworks', 'Dreadhorde Invasion', 'Sundial of the Infinite', 'Darkmoss Bridge', 'Augur of Bolas', 'Vastwood Zendikon', 'Rally the Peasants', 'Ingot Chewer', 'Mentor of the Meek', 'Brain Freeze', 'Gearseeker Serpent', 'Springbloom Druid', 'Demigod of Revenge', 'Harsh Mentor', 'Lodestone Golem', 'Scout''s Warning', 'Burning Inquiry', 'Soul Warden', 'Crash Through', 'Staff of Domination', 'Opt', 'Vampire''s Kiss', 'Folio of Fancies', 'Stirring Wildwood', 'Search Party Captain', 'Tanglepool Bridge', 'Shreds of Sanity', 'Illness in the Ranks', 'Thornglint Bridge', 'Xathrid Necromancer', 'Time Wipe', 'An Offer You Can''t Refuse', 'Kazuul''s Fury', 'Blazing Hope', 'Draconic Roar', 'Watcher for Tomorrow', 'Brittle Effigy', 'Trostani''s Summoner', 'Runeflare Trap', 'Spider Umbra', 'Dockside Chef', 'Invoke Calamity', 'Olivia Voldaren', 'Slagstorm', 'Call of the Death-Dweller', 'Stone Haven Outfitter', 'Turn Aside', 'Tymaret, Chosen from Death', 'Epochrasite', 'Stoneforge Masterwork', 'Battlefield Forge', 'Chalice of Life', 'Vampire of the Dire Moon', 'Spikefield Hazard', 'Howling Mine', 'Snow-Covered Mountain', 'Kazandu Mammoth', 'Terrarion', 'Shardless Agent', 'Magus of the Candelabra', 'Hedron Alignment', 'Blossoming Calm', 'Archfiend''s Vessel', 'Greater Gargadon', 'Laboratory Maniac', 'Llanowar Elves', 'Serrated Scorpion', 'Tyrant''s Scorn', 'Shadowmage Infiltrator', 'Temple of Triumph', 'Skyclave Shade', 'Iron Apprentice', 'Path to the World Tree', 'Oni-Cult Anvil', 'Duskwatch Recruiter', 'Goldhound', 'Sarkhan the Masterless', 'Dread Fugue', 'Spatial Contortion', 'Wipe Away', 'Runed Halo', 'Evolving Wilds', 'Bubbling Cauldron', 'Patchwork Automaton', 'Skyline Cascade', 'Sylvan Advocate', 'Umara Raptor', 'Novice Occultist', 'Vapor Snag', 'Acolyte of Affliction', 'Sylvan Library', 'Incinerate', 'Curse of Misfortunes', 'Slagwoods Bridge', 'Furyblade Vampire', 'Dread Presence', 'Sky Diamond', 'Sphinx of Foresight', 'Acidic Slime', 'Phylactery Lich', 'Resurgent Belief', 'Mana Leak', 'Temple of Deceit', 'Haunted Dead', 'Mythos of Nethroi', 'Hypnox', 'Avaricious Dragon', 'Ally Encampment', 'Triskelion', 'Spirit Mantle', 'Desperate Ritual', 'Reckless Impulse', 'Falkenrath Pit Fighter', 'Touch the Spirit Realm', 'Undead Butler', 'Rally the Ancestors', 'Spiteful Visions', 'Burst Lightning', 'Tempered Steel', 'Temmet, Vizier of Naktamun', 'Think Twice', 'Gruul Turf', 'Zulaport Chainmage', 'Bident of Thassa', 'Orb of Dragonkind', 'Duskdale Wurm', 'Oran-Rief Ooze', 'Curiosity', 'Nezahal, Primal Tide', 'Thaumatic Compass', 'Rootbound Crag', 'Keruga, the Macrosage', 'Ponder', 'Shock', 'Fiery Justice', 'Ancient Stirrings', 'Engulf the Shore', 'Master of Death', 'Crackling Emergence', 'Cauldron''s Gift', 'Kick in the Door', 'Jack-o''-Lantern', 'Clarion Spirit', 'Glyph Keeper', 'Metallic Rebuke', 'Ghoultree', 'Urza''s Factory', 'Rabbit Battery', 'Forbid', 'Wheel of Fate', 'Advent of the Wurm', 'Cosima, God of the Voyage', 'Mizzium Mortars', 'Dryad Militant', 'Bontu the Glorified', 'Mausoleum Secrets', 'Raffine''s Informant', 'Sanguine Statuette', 'Shattered Perception', 'Honor of the Pure', 'Blood Fountain', 'Buried Ruin', 'Restore Balance', 'Vivid Meadow', 'Combine Chrysalis', 'Kalastria Healer', 'Temple of Plenty', 'Dimir Charm', 'Caves of Koilos', 'Harmonious Emergence', 'Temple of Enlightenment', 'Midnight Clock', 'Sterling Grove', 'Pillage', 'Mind''s Desire', 'Chasm Skulker', 'Phantasmagorian', 'Qasali Pridemage', 'Delay', 'Lonely Sandbar', 'Dragonskull Summit', 'Mortuary Mire', 'Vindicate', 'Summer Bloom', 'Tribute Mage', 'Hieroglyphic Illumination', 'Veinfire Borderpost', 'Spirited Companion', 'Bedlam Reveler', 'Gray Merchant of Asphodel', 'Dead // Gone', 'Prizefight', 'Mistvault Bridge', 'Lose Focus', 'Primal Command', 'Consuming Vapors', 'Vampiric Fury', 'Scour All Possibilities', 'Viashino Pyromancer', 'Memory Lapse', 'Kuldotha Rebirth', 'Sekki, Seasons'' Guide', 'Temporal Fissure', 'Flame-Kin Zealot', 'Kira, Great Glass-Spinner', 'Alchemist''s Gambit', 'Seal of Fire', 'Presence of Gond', 'Fiery Temper', 'Orzhov Charm', 'Cruel Ultimatum', 'Vault Skirge', 'Umara Entangler', 'Feed the Swarm', 'Treasure Cruise', 'Canyon Slough', 'Grim Haruspex', 'Genesis Wave', 'Cabal Therapist', 'Ash Zealot', 'Thought Scour', 'Game Trail', 'Demonic Dread', 'Azor, the Lawbringer', 'Witching Well', 'Diregraf Rebirth', 'Skemfar Avenger', 'Shriekmaw', 'Vesperlark', 'Vigorspore Wurm', 'Archaeomancer', 'Arch of Orazca', 'Dream Eater', 'Discovery // Dispersal', 'Vivid Creek', 'Satyr Wayfinder', 'The Bloodsky Massacre', 'Kaervek, the Spiteful', 'Bogbrew Witch', 'Maestros Theater', 'Tectonic Giant', 'Lizard Blades', 'Unholy Heat', 'Firewild Borderpost', 'Herald of the Pantheon', 'Barbarian Ring', 'Ramunap Excavator', 'Snow-Covered Swamp', 'Willbender', 'Whelming Wave', 'Crusher Zendikon', 'Obliterate', 'Court Homunculus', 'Oust', 'Coiling Oracle', 'Starnheim Courser', 'Voidmage Prodigy', 'Growth-Chamber Guardian', 'Inner-Flame Acolyte', 'Detention Sphere', 'Quest for Ula''s Temple', 'Faerie Vandal', 'Cleansing Nova', 'Search for Tomorrow', 'Festering Newt'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 66.1, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (70.9 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Blisterpod', 'Nameless Inversion', 'Sleep', 'Jokulhaups', 'Snowfield Sinkhole', 'Obscura Charm', 'Whispering Specter', 'Condemn', 'Bitterheart Witch', 'Teferi, Mage of Zhalfir', 'Dauntless Bodyguard', 'Sticky Fingers', 'Forgotten Cave', 'Trading Post', 'Winds of Rebuke', 'Glacial Ray', 'Seal of Fire', 'Bladestitched Skaab', 'Clarion Spirit', 'Drossforge Bridge', 'Gather the Townsfolk', 'Deliberate', 'Shriekmaw', 'Beastcaller Savant', 'Mind Funeral', 'Yahenni''s Expertise', 'Sephara, Sky''s Blade', 'Mass Hysteria', 'Vendetta', 'Reveillark', 'Sunset Revelry', 'Boomerang', 'Flame Slash', 'Secrets of the Key', 'Zulaport Chainmage', 'Gitaxian Probe', 'Mirran Crusader', 'Mind''s Desire', 'Curse of Misfortunes', 'Ancient Stirrings', 'Sokenzan Smelter', 'Ingenious Infiltrator', 'Cruel Reality', 'Rustvale Bridge', 'Karmic Guide', 'Foreboding Ruins', 'Oni-Cult Anvil', 'Fauna Shaman', 'Timeless Witness', 'Selesnya Charm', 'Demonic Dread', 'Infernal Plunge', 'Josu Vess, Lich Knight', 'Varragoth, Bloodsky Sire', 'Dream Trawler', 'Prophet of Kruphix', 'Arcbound Slith', 'Famished Paladin', 'Coiling Oracle', 'Greater Gargadon', 'Jace Beleren', 'Ponder', 'Serrated Scorpion', 'Moonsnare Prototype', 'Bedevil', 'Ghost Quarter', 'Night Market Lookout', 'Ondu Cleric', 'Crib Swap', 'Pride of the Clouds', 'Spell Pierce', 'Claim the Firstborn', 'Bone Saw', 'Gavony Township', 'Reverse Engineer', 'Harmless Offering', 'Karn''s Bastion', 'Sea-Dasher Octopus', 'Goblin Bombardment', 'Blossoming Sands', 'Tyrant''s Scorn', 'Of One Mind', 'Demonic Embrace', 'Birds of Paradise', 'Riveteers Charm', 'Cathar Commando', 'Arcbound Stinger', 'Duress', 'Nether Traitor', 'Kor Blademaster', 'Mikokoro, Center of the Sea', 'Sign in Blood', 'Temple of Deceit', 'Stirring Wildwood', 'Dokuchi Silencer', 'Deep Analysis', 'Nuisance Engine', 'Volt Charge', 'Chamber Sentry', 'Smallpox', 'Arcbound Mouser', 'Whip of Erebos', 'Glen Elendra Archmage', 'Rootborn Defenses', 'Blackbloom Rogue', 'Drowned Catacomb', 'Cleansing Wildfire', 'Glorybringer', 'Disallow', 'Mana Leak', 'Become Immense', 'Choking Sands', 'Fevered Visions', 'Oust', 'Frontier Bivouac', 'Funeral Longboat', 'Coalition Relic', 'Sphinx''s Tutelage', 'Eaten Alive', 'Hapatra, Vizier of Poisons', 'Ranger''s Guile', 'Izzet Boilerworks', 'Thought Scour', 'Laboratory Maniac', 'Diregraf Ghoul', 'Thryx, the Sudden Storm', 'Dark Ritual', 'Orcish Vandal', 'Pyretic Ritual', 'Strike It Rich', 'Seal of Removal', 'Brave the Elements', 'Kor Duelist', 'Hypnotic Sprite', 'Sylvan Library', 'Out of Time', 'Jhoira of the Ghitu', 'Logic Knot', 'Needle Spires', 'Soul Warden', 'Noose Constrictor', 'Tangled Florahedron', 'Viscera Seer', 'Ajani''s Pridemate', 'Hand of the Praetors', 'Verdant Command', 'Barbarian Ring', 'Power Depot', 'Merrow Reejerey', 'Lord of the Undead', 'Vampire Nighthawk', 'Stormblood Berserker', 'Drana''s Emissary', 'Dragon Turtle', 'Hypnotic Specter', 'Foundry Street Denizen', 'Hissing Quagmire', 'Argentum Armor', 'Midnight Reaper', 'Psychic Strike', 'Eiganjo Castle', 'Inevitable Betrayal', 'Vicious Conquistador', 'Rise and Shine', 'Woodland Cemetery', 'Spectral Procession', 'Witching Well', 'Invoke Calamity', 'Feed the Swarm', 'Think Twice', 'Briber''s Purse', 'Time Stretch', 'Traumatize', 'Barren Moor', 'Lose Focus', 'Seasoned Hallowblade', 'Ravenous Chupacabra', 'Scrapyard Recombiner', 'Hythonia the Cruel', 'Flourishing Fox', 'Kargan Intimidator', 'Cloudpost', 'Sandwurm Convergence', 'Triskelion', 'Urza''s Factory', 'Zenith Flare', 'Throne of Geth', 'Rakdos Cackler', 'Kami of the Crescent Moon', 'Voidmage Prodigy', 'Lashwrithe', 'Delay', 'Sprite Dragon', 'Icehide Golem', 'Crackling Drake', 'Fabricate', 'Fatestitcher', 'Jace, Memory Adept', 'Jack-o''-Lantern', 'Infernal Grasp', 'Diregraf Captain', 'Barrin, Tolarian Archmage', 'Awakening Zone', 'Blighted Agent', 'Advent of the Wurm', 'Into the Story', 'Secluded Glen', 'Walk the Aeons', 'Snow-Covered Forest', 'Padeem, Consul of Innovation', 'Song-Mad Treachery', 'Obscura Storefront', 'Shrapnel Blast', 'Combine Chrysalis', 'Volcanic Salvo', 'Double Vision', 'Honor of the Pure', 'Grapeshot', 'Gray Merchant of Asphodel', 'Brokers Hideout', 'Goblin Dark-Dwellers', 'Coralhelm Commander', 'Electrolyze', 'Geomancer''s Gambit', 'Hot Soup', 'Fblthp, the Lost', 'Grim Lavamancer', 'Valiant Knight', 'Captain''s Claws', 'Riptide Laboratory', 'Raging Ravine', 'Hinterland Harbor', 'Frantic Search', 'Seaside Citadel', 'Firebolt', 'Pieces of the Puzzle', 'Disciple of the Vault', 'Mangara of Corondor', 'Field of Ruin', 'Temple of Epiphany', 'Upriser Renegade', 'Watcher for Tomorrow', 'Skyshroud Forest', 'Eye of Nowhere', 'Incubation Druid', 'Fire-Lit Thicket', 'Crumbling Necropolis', 'Okina, Temple to the Grandfathers', 'Falkenrath Gorger', 'Circular Logic', 'Kumano Faces Kakkazan', 'Reality Heist', 'Heartwood Storyteller', 'Curiosity', 'Jeskai Ascendancy', 'Blowfly Infestation', 'Scout''s Warning', 'Opulent Palace', 'Zabaz, the Glimmerwasp', 'Jhoira''s Timebug', 'Inspiring Statuary', 'Animation Module', 'Kaya, Ghost Assassin', 'Tectonic Reformation', 'Mouth of Ronom', 'Stubborn Denial', 'Prosperous Thief', 'Hotshot Mechanic', 'Spikefield Hazard', 'Vapor Snag', 'Orochi Merge-Keeper', 'Ash Zealot', 'Lizard Blades', 'Raise the Draugr', 'Prodigal Sorcerer', 'Sigrid, God-Favored', 'Mystic Monastery', 'Sacred Fire', 'Zada''s Commando', 'Bedlam Reveler', 'Buried Ruin', 'Death Baron', 'Sower of Temptation', 'Paradoxical Outcome', 'Thirst for Discovery', 'Champion of the Parish', 'Contagion Engine', 'Vedalken Aethermage', 'Mirrodin Besieged', 'Ramunap Excavator', 'Worldgorger Dragon', 'Razortide Bridge', 'Shard Volley', 'Bump in the Night', 'Duskwatch Recruiter', 'Firedrinker Satyr', 'Gatekeeper of Malakir', 'Sanguine Statuette', 'Rootbound Crag', 'Earthshaker Khenra', 'Benevolent Bodyguard', 'Search Party Captain', 'Golgari Grave-Troll', 'Cabal Stronghold', 'Westvale Abbey', 'Burst Lightning', 'Clifftop Retreat', 'Nivmagus Elemental', 'Vivid Grove', 'Harbinger of the Tides', 'Abundant Harvest', 'Moorland Haunt', 'Day of Judgment', 'Reliquary Tower', 'Swiftblade Vindicator', 'Ondu Inversion', 'Basking Rootwalla', 'Engulf the Shore', 'Battlefield Forge', 'Walking Skyscraper', 'Vault Skirge', 'Sleight of Hand', 'Shatter the Sky', 'Hour of Promise', 'Improbable Alliance', 'Tectonic Giant', 'Dust of Moments', 'Tymaret, Chosen from Death', 'Bogardan Hellkite', 'Revitalize', 'Acclaimed Contender', 'Conclave Mentor', 'Tanglepool Bridge', 'Unified Will', 'Keeper of the Dead', 'Knight Exemplar', 'Banefire', 'Kitchen Imp', 'Angel of Glory''s Rise', 'Cathartic Pyre', 'Searing Spear', 'Ruin Crab', 'Celestial Crusader', 'Kinsbaile Cavalier', 'Kabira Takedown', 'Heartless Act', 'Never // Return', 'Ghitu Lavarunner', 'Servo Exhibition', 'Snow-Covered Mountain', 'Mistvault Bridge', 'Korlash, Heir to Blackblade', 'Lava Dart', 'Ornithopter', 'Ritual of Soot', 'Phyrexian Dreadnought', 'Honored Hydra', 'Experimental Synthesizer', 'Secluded Courtyard', 'Arcane Sanctum', 'Wonder', 'Ensoul Artifact', 'Giant Killer', 'Tendrils of Agony', 'Shalai, Voice of Plenty', 'Blood Fountain', 'Lantern of the Lost', 'Stern Dismissal', 'Exhaustion', 'Putrid Imp', 'Venerated Loxodon', 'Lumbering Falls', 'Hypergenesis', 'Balustrade Spy', 'Disfigure', 'Garth One-Eye', 'Adorned Pouncer', 'Irencrag Pyromancer', 'Mindslaver', 'Tome Scour', 'Faerie Vandal', 'Glimmerpost', 'Game Trail', 'Intangible Virtue', 'Muddle the Mixture', 'Inspiring Veteran', 'Chain Lightning', 'Outland Liberator', 'Goblin Electromancer', 'Falkenrath Pit Fighter', 'Runeflare Trap', 'Contagion Clasp', 'Blade Splicer', 'Deathcap Cultivator', 'Cloudfin Raptor', 'Soulherder', 'Prowling Serpopard', 'Crumbling Vestige', 'Talrand, Sky Summoner', 'Forked Bolt', 'Temple of Enlightenment', 'Hieroglyphic Illumination', 'General Ferrous Rokiric', 'Malakir Rebirth', 'Phoenix of Ash', 'Startled Awake', 'Gigadrowse', 'Isareth the Awakener', 'Dawn of Hope', 'Planar Portal', 'Lich Lord of Unx', 'Benalish Marshal', 'Terminus', 'Erebos''s Intervention', 'Disruptive Pitmage', 'Destiny Spinner', 'Darigaaz Reincarnated', 'Sage''s Dousing', 'Abbot of Keral Keep', 'Thousand-Faced Shadow', 'Skyclave Cleric', 'Vivid Marsh', 'Raise the Alarm', 'Carnophage', 'Vedalken Anatomist', 'Slagwoods Bridge', 'Ethereal Absolution', 'Nightshade Stinger', 'Bazaar Trader', 'Sky Terror', 'Tragic Slip', 'Hellrider', 'Lightning Rift', 'Glaze Fiend', 'Mistblade Shinobi', 'Arrogant Wurm', 'Epochrasite', 'Chandra''s Phoenix', 'Fiery Temper', 'Codie, Vociferous Codex', 'Niv-Mizzet, the Firemind', 'Arcbound Ravager', 'Kunoros, Hound of Athreos', 'Glacial Fortress', 'Dimir Aqueduct', 'Fire Covenant', 'Shaile, Dean of Radiance', 'Tajic, Legion''s Edge', 'Oviya Pashiri, Sage Lifecrafter', 'Dakmor Salvage', 'Sungold Sentinel', 'Dire Fleet Hoarder', 'Satyr Wayfinder', 'Goldhound', 'Merfolk Secretkeeper', 'Ogre-Head Helm', 'Temmet, Vizier of Naktamun', 'Seething Song', 'Snow-Covered Plains', 'Porcelain Legionnaire', 'Runed Halo', 'Vision Skeins', 'Venerable Knight', 'Unexpected Results', 'Mogg War Marshal', 'Benthic Biomancer', 'Blazing Rootwalla', 'Master of the Pearl Trident', 'Silver-Fur Master', 'Elemental Mastery', 'Massive Might', 'Quest for the Holy Relic', 'Commit // Memory', 'Jackal Pup', 'Jace, the Living Guildpact', 'Saffi Eriksdotter', 'Bala Ged Thief', 'Fraying Sanity', 'Trickbind', 'Trinket Mage', 'Incendiary Flow', 'Cabal Interrogator', 'Wooded Bastion', 'Shardless Agent', 'Midnight Clock', 'Wayward Guide-Beast', 'Dizzy Spell', 'Centaur Garden', 'Swiftwater Cliffs', 'Tendo Ice Bridge', 'Hostage Taker', 'Reckless Impulse', 'Suspend', 'Mission Briefing', 'Sorin''s Vengeance', 'Necropede', 'Court Homunculus', 'Drowned Secrets', 'Plague Myr', 'Distortion Strike', 'Vampire''s Kiss', 'Valiant Rescuer', 'Invigorating Hot Spring', 'Entrancing Melody', 'Spiraling Embers', 'Dryad Militant', 'Knighted Myr', 'Llanowar Elves', 'Midnight Guard', 'Warstorm Surge', 'Lost Auramancers', 'Evolving Wilds', 'Dusk Legion Zealot', 'Behold the Multiverse', 'Karn''s Temporal Sundering', 'Knight of the Reliquary', 'Jwari Disruption', 'Kor Skyfisher', 'Shredded Sails', 'Fury Charm', 'Erayo, Soratami Ascendant', 'Foundation Breaker', 'Student of Warfare', 'Silverbluff Bridge', 'Gadwick, the Wizened', 'Cruel Ultimatum', 'Bastion of Remembrance', 'Vampire Lacerator', 'Silundi Vision', 'Didn''t Say Please', 'Vampire Envoy', 'Hero of Precinct One', 'Evolving Door', 'Scrabbling Claws', 'Oracle of Mul Daya', 'Faerie Impostor', 'See the Truth', 'Canyon Slough', 'Beacon of Tomorrows', 'Arch of Orazca', 'Kazandu Mammoth', 'Banisher Priest', 'Secluded Steppe', 'Azami, Lady of Scrolls', 'Kessig Flamebreather', 'Azorius Charm', 'Metallic Rebuke', 'Scrapheap Scrounger', 'Restoration Angel', 'Michiko''s Reign of Truth', 'Obliterate', 'Dictate of Kruphix', 'Bala Ged Recovery', 'Howling Mine', 'Drannith Stinger', 'Ichorclaw Myr', 'Might of Old Krosa', 'Tide Shaper', 'Voldaren Epicure', 'Dread Return', 'Alms of the Vein', 'Akoum Warrior', 'Bloodchief''s Thirst', 'Edric, Spymaster of Trest', 'Char', 'Wild Mongrel', 'Talisman of Curiosity', 'Marshmist Titan', 'Fading Hope', 'Dread Fugue', 'Cabal Therapist', 'Cursecatcher', 'Cauldron Haze', 'Zulaport Duelist', 'Overwhelming Splendor', 'Aquitect''s Will', 'Zurgo Bellstriker', 'Caves of Koilos', 'Glint Hawk', 'Shadowmage Infiltrator', 'Moon-Circuit Hacker', 'Nested Shambler', 'Ravenous Squirrel', 'Drannith Healer', 'Familiar''s Ruse', 'Ondu War Cleric', 'Cyclone Summoner', 'Unravel the Aether', 'Hagra Mauling', 'Deprive', 'Bontu''s Last Reckoning', 'Thundering Raiju', 'Tempered Steel', 'Spark Spray', 'Biting-Palm Ninja', 'Champion of Wits', 'Faithless Salvaging', 'Undercity Informer', 'Tezzeret''s Gambit', 'Augur of Bolas', 'Prophetic Prism', 'Dragonskull Summit', 'Sidisi, Brood Tyrant', 'Mayor of Avabruck', 'Everflowing Chalice', 'Lotleth Giant', 'Grimdancer', 'Wrath of God', 'Worthy Knight', 'Satoru Umezawa', 'Garruk Wildspeaker', 'Desperate Ritual', 'Riveteers Requisitioner', 'Basal Sliver', 'Triskaidekaphile', 'Treasure Cruise', 'Dimir Charm', 'Tempest Djinn', 'Quicken', 'Bloodthrone Vampire', 'Decree of Justice', 'Repeal', 'Wild Cantor', 'Sidisi, Undead Vizier', 'Rune Snag', 'Fanatical Firebrand', 'Altar of the Brood', 'Slip Out the Back', 'Darkmoss Bridge', 'Base Camp', 'Rishadan Dockhand', 'Mizzium Skin', 'Nullpriest of Oblivion', 'Touch the Spirit Realm', 'Mishra''s Factory', 'Memory Lapse', 'Wall of Omens', 'Peer Through Depths', 'Bygone Bishop', 'Tithe Taker', 'Viashino Pyromancer', 'Judith, the Scourge Diva', 'Primal Command', 'Hymn to Tourach', 'Nirkana Assassin', 'Curse of Death''s Hold', 'Opt', 'Signal Pest', 'Arcbound Worker', 'Zulaport Cutthroat', 'Leyline of the Meek', 'Falkenrath Aristocrat', 'Unlucky Witness', 'Weapons Trainer', 'Immortal Coil', 'Forbid', 'Shreds of Sanity', 'Magus of the Abyss', 'Simic Charm', 'Lonely Sandbar', 'Magister Sphinx', 'Reality Ripple', 'Pelakka Predation', 'Vivid Crag', 'Dream Twist', 'Phantasmagorian', 'The Flame of Keld', 'Faerie Miscreant', 'Silvergill Adept', 'Remorseful Cleric', 'The Raven''s Warning', 'Hada Freeblade', 'Llanowar Wastes', 'Sylvan Advocate', 'Martyr''s Soul', 'Eater of Virtue', 'Sorin Markov', 'Graf Harvest', 'Lightning Strike', 'Pack Rat', 'Bone Shards', 'Mistcaller', 'Temple of Malady', 'Delver of Secrets', 'Mire Triton', 'Gaze of Adamaro', 'Invigorate', 'Banshee''s Blade', 'Judge''s Familiar', 'Demigod of Revenge', 'Firebrand Archer', 'Curse of Stalked Prey', 'Mirrodin''s Core', 'Favorable Winds', 'Izzet Charm', 'Frantic Inventory', 'Archaeomancer', 'Stromkirk Noble', 'Experimental Overload', 'Essence Flux', 'Braids, Cabal Minion', 'Mercurial Chemister', 'Vivid Creek', 'Akroma''s Memorial', 'Apex of Power', 'Village Messenger', 'Ethersworn Canonist', 'Graveshifter', 'Battle Screech', 'Kira, Great Glass-Spinner', 'Zhalfirin Void', 'Rakdos Headliner', 'Squadron Hawk', 'Piranha Marsh', 'Incinerate', 'Cerodon Yearling', 'Winged Portent', 'Mirror Entity', 'Cathar''s Shield', 'Raze the Effigy', 'Underworld Connections', 'Magus of the Disk', 'Animate Dead', 'Oran-Rief Ooze', 'Tarfire', 'Negate', 'Blight Mamba', 'Brain Freeze', 'Faithful Mending', 'Bloodbraid Elf', 'Sylvan Scrying', 'Memory''s Journey', 'Temple of Plenty', 'Skyclave Shade', 'Step Through', 'Rabbit Battery', 'Goldmire Bridge', 'Blazing Shoal', 'Renegade Map', 'Stonybrook Angler', 'Grisly Salvage', 'Soul''s Attendant', 'Stormscape Familiar', 'Discovery // Dispersal', 'Mystifying Maze', 'Skycat Sovereign', 'Elixir of Immortality', 'Grim Affliction', 'Orim''s Chant', 'Nimble Larcenist', 'Plunge into Darkness', 'Thunderclap Wyvern', 'Arguel''s Blood Fast', 'Fallen Shinobi', 'Changeling Outcast', 'Unsubstantiate', 'Shock', 'Kazuul''s Fury', 'Detention Sphere', 'Vindicate', 'Yidaro, Wandering Monster', 'It That Betrays', 'Snow-Covered Swamp', 'Thraben Inspector'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 70.9, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (70.5 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Mishra''s Factory', 'Temur Charm', 'Wonder', 'Balustrade Spy', 'Double Vision', 'Tymaret, Chosen from Death', 'Hypnotic Specter', 'Champion of Lambholt', 'Lumbering Falls', 'Josu Vess, Lich Knight', 'Sidisi, Undead Vizier', 'Malakir Rebirth', 'Dead // Gone', 'Viscera Seer', 'Flourishing Fox', 'Hero of Precinct One', 'Urza''s Factory', 'Kira, Great Glass-Spinner', 'Glassdust Hulk', 'Simic Charm', 'Spikefield Hazard', 'Grumgully, the Generous', 'Merfolk Secretkeeper', 'Fallen Shinobi', 'Orcish Vandal', 'Mind''s Desire', 'Tide Shaper', 'Martyr of Sands', 'Game Trail', 'Watcher for Tomorrow', 'Midnight Clock', 'Karmic Guide', 'Murderous Redcap', 'Crumbling Necropolis', 'Slagstorm', 'Putrid Imp', 'Vindicate', 'Sylvan Library', 'Vedalken Aethermage', 'Barren Moor', 'Day of Judgment', 'Hinterland Harbor', 'Disciple of the Vault', 'Vivid Crag', 'Unravel the Aether', 'Animate Dead', 'Tendrils of Agony', 'Stingscourger', 'Earthshaker Khenra', 'Gavony Township', 'Obliterate', 'Vampire Lacerator', 'Clarion Spirit', 'Mikokoro, Center of the Sea', 'Selesnya Charm', 'Raging Ravine', 'Secluded Courtyard', 'Remorseful Cleric', 'Cabal Therapist', 'Tyrant''s Choice', 'Shadowmage Infiltrator', 'Dark Ritual', 'Reveillark', 'Faerie Impostor', 'Temple of Mystery', 'Splinterfright', 'Rustvale Bridge', 'Bastion of Remembrance', 'Caves of Koilos', 'Trinket Mage', 'Harmless Offering', 'Glacial Ray', 'Gitaxian Probe', 'Negate', 'Eater of Virtue', 'Sky Terror', 'Reckless Impulse', 'Snow-Covered Forest', 'Fire Covenant', 'Joraga Treespeaker', 'Dive Down', 'Lantern of the Lost', 'Rabbit Battery', 'Blazing Shoal', 'Mindslaver', 'Dream Twist', 'Faerie Vandal', 'Brave the Elements', 'Sygg, River Cutthroat', 'Martyr''s Soul', 'Tajic, Legion''s Edge', 'Deep Analysis', 'Coralhelm Commander', 'Frogtosser Banneret', 'Mangara of Corondor', 'Scrapheap Scrounger', 'Lava Dart', 'Shaile, Dean of Radiance', 'Colossal Skyturtle', 'Desert Cerodon', 'Frantic Search', 'Dust of Moments', 'Changeling Outcast', 'Vapor Snag', 'Chancellor of the Dross', 'Goblin Ringleader', 'Hapatra, Vizier of Poisons', 'Needle Spires', 'Rakdos Headliner', 'Glint Hawk', 'Glaze Fiend', 'Silver-Fur Master', 'Tyrant of Discord', 'Phantasmagorian', 'Nuisance Engine', 'Rishadan Dockhand', 'Izzet Boilerworks', 'Lashwrithe', 'Demonic Dread', 'Timely Reinforcements', 'Lightning Rift', 'Shreds of Sanity', 'Bloodbraid Elf', 'Valiant Rescuer', 'Zulaport Duelist', 'Lonely Sandbar', 'Drossforge Bridge', 'Magus of the Abyss', 'Disfigure', 'Abundant Harvest', 'Stirring Wildwood', 'Invigorating Hot Spring', 'Bone Shards', 'Goblin Trashmaster', 'Prophet of Kruphix', 'Gideon Jura', 'Asylum Visitor', 'Goblin Anarchomancer', 'Kor Blademaster', 'Memory''s Journey', 'Zulaport Cutthroat', 'Kor Skyfisher', 'Dragonskull Summit', 'Ingenious Infiltrator', 'Bala Ged Thief', 'Oran-Rief Ooze', 'Zabaz, the Glimmerwasp', 'Drana''s Emissary', 'Fire-Lit Thicket', 'Unified Will', 'Rootbound Crag', 'Ezuri, Renegade Leader', 'Merrow Reejerey', 'Glorybringer', 'Seething Song', 'Walking Skyscraper', 'Call the Bloodline', 'Temple of Abandon', 'Triskaidekaphile', 'Niv-Mizzet, the Firemind', 'Oni-Cult Anvil', 'Improbable Alliance', 'Scurry Oak', 'Krosan Tusker', 'Grimdancer', 'Coalition Relic', 'Elvish Mystic', 'Goblin Cratermaker', 'Doom Foretold', 'Hada Freeblade', 'Llanowar Wastes', 'Archfiend of Ifnir', 'Keeper of the Dead', 'Thundering Raiju', 'Unexpected Results', 'Tempest Djinn', 'Temple of Plenty', 'Angel of Glory''s Rise', 'Slip Out the Back', 'Char', 'Nirkana Assassin', 'Ranger of Eos', 'Necropolis Fiend', 'Sleight of Hand', 'Jwari Disruption', 'Cauldron Haze', 'Stromkirk Noble', 'Azami, Lady of Scrolls', 'Mirrodin''s Core', 'Lord of the Undead', 'Repeal', 'Bogardan Hellkite', 'Llanowar Elves', 'Swiftwater Cliffs', 'Battlefield Forge', 'Ancient Stirrings', 'Ash Zealot', 'Timeless Witness', 'Invoke Calamity', 'Advent of the Wurm', 'Magus of the Disk', 'Arch of Orazca', 'Sarkhan the Masterless', 'Kunoros, Hound of Athreos', 'Reliquary Tower', 'Sanguine Statuette', 'Unpredictable Cyclone', 'Dictate of Kruphix', 'Silvergill Adept', 'Temple of Deceit', 'Bloodchief''s Thirst', 'Prodigal Sorcerer', 'Assault Strobe', 'Foreboding Ruins', 'Soul Spike', 'Psychic Strike', 'Shriekmaw', 'Spirited Companion', 'Crash Through', 'Captain of the Watch', 'Eaten Alive', 'Mistblade Shinobi', 'Ethereal Absolution', 'Eiganjo Castle', 'Scrabbling Claws', 'Secluded Glen', 'Erebos''s Intervention', 'Mirari''s Wake', 'Lizard Blades', 'Sigrid, God-Favored', 'Shard Volley', 'Destiny Spinner', 'Phoenix of Ash', 'Jace, the Living Guildpact', 'Runeflare Trap', 'Glimmerpost', 'Realm Razer', 'Talisman of Curiosity', 'Zenith Flare', 'Planar Portal', 'Silverbluff Bridge', 'Muddle the Mixture', 'Golgari Brownscale', 'Joraga Warcaller', 'Lightning Strike', 'Outland Liberator', 'Isareth the Awakener', 'Tooth and Nail', 'Laboratory Maniac', 'Oath of Liliana', 'Combine Chrysalis', 'Winds of Rebuke', 'Fatestitcher', 'Kitchen Imp', 'Beastcaller Savant', 'Razortide Bridge', 'Scryb Ranger', 'Evolving Door', 'Kessig Flamebreather', 'Quicken', 'Birds of Paradise', 'Graveshifter', 'Runed Halo', 'Yahenni''s Expertise', 'Akroma''s Memorial', 'Raze the Effigy', 'Shalai, Voice of Plenty', 'Kor Duelist', 'Smallpox', 'Crackling Drake', 'Arcbound Worker', 'Kefnet the Mindful', 'Marwyn, the Nurturer', 'Adorned Pouncer', 'Shrapnel Blast', 'Suspend', 'Dream Trawler', 'Moon-Circuit Hacker', 'Nyxathid', 'Despoiler of Souls', 'Goblin Instigator', 'Banefire', 'Preeminent Captain', 'Venerated Loxodon', 'Sorin''s Vengeance', 'Ondu War Cleric', 'It That Betrays', 'Talisman of Impulse', 'Gilt-Leaf Archdruid', 'Snow-Covered Mountain', 'Peer Through Depths', 'Satoru Umezawa', 'Clifftop Retreat', 'Pyretic Ritual', 'Slagwoods Bridge', 'Crumbling Vestige', 'Blistercoil Weird', 'Darkmoss Bridge', 'Seal of Fire', 'Verdant Command', 'Startled Awake', 'Eye of Nowhere', 'Ritual of Soot', 'Hedron Alignment', 'Skirk Prospector', 'Hissing Quagmire', 'Bloodtithe Harvester', 'Fyndhorn Elves', 'Apex of Power', 'Viashino Pyromancer', 'Captain''s Claws', 'Bygone Bishop', 'Reality Ripple', 'Mind Funeral', 'Thraben Inspector', 'Immortal Coil', 'Elvish Aberration', 'Ornithopter', 'Voldaren Epicure', 'Discovery // Dispersal', 'Deathcap Cultivator', 'Experimental Synthesizer', 'Sign in Blood', 'Seaside Citadel', 'Piranha Marsh', 'Death Baron', 'Mephidross Vampire', 'Cerodon Yearling', 'Mistcutter Hydra', 'Llanowar Tribe', 'Intangible Virtue', 'Kabira Takedown', 'Saffi Eriksdotter', 'Drowned Secrets', 'Gallia of the Endless Dance', 'Decree of Justice', 'Mogg War Marshal', 'Dimir Charm', 'Oviya Pashiri, Sage Lifecrafter', 'Dawn of Hope', 'Wayward Guide-Beast', 'Restoration Angel', 'Ondu Cleric', 'Terminus', 'Temple of Malady', 'Logic Knot', 'Barbarian Ring', 'Varragoth, Bloodsky Sire', 'Faerie Miscreant', 'Magister Sphinx', 'Sidisi, Brood Tyrant', 'Growth-Chamber Guardian', 'Vedalken Anatomist', 'Yidaro, Wandering Monster', 'Champion of Wits', 'Fevered Visions', 'Temple of Epiphany', 'Sungold Sentinel', 'Honor of the Pure', 'Blowfly Infestation', 'Pelakka Predation', 'Forgotten Cave', 'Firebolt', 'Signal Pest', 'Ethersworn Sphinx', 'Opulent Palace', 'Chamber Sentry', 'Dread Fugue', 'Raise the Alarm', 'Go for Blood', 'Worldgorger Dragon', 'Fabricate', 'Ravenous Squirrel', 'Scout''s Warning', 'Kaya, Ghost Assassin', 'Benalish Marshal', 'Garruk Wildspeaker', 'Radical Idea', 'Delver of Secrets', 'Valiant Changeling', 'Hythonia the Cruel', 'Didn''t Say Please', 'Soul Warden', 'Deadshot Minotaur', 'Okina, Temple to the Grandfathers', 'Champion of the Parish', 'Greenbelt Rampager', 'Opt', 'Carnophage', 'Master of the Pearl Trident', 'Lead the Stampede', 'Fiery Temper', 'Temple of Silence', 'Voltage Surge', 'Dark-Dweller Oracle', 'Blighted Agent', 'Goblin Chieftain', 'Augur of Bolas', 'Behold the Multiverse', 'Judge''s Familiar', 'Electrolyze', 'Necromancer''s Covenant', 'Elvish Archdruid', 'Chain Lightning', 'Step Through', 'Gray Merchant of Asphodel', 'Vivid Marsh', 'Demigod of Revenge', 'Mistvault Bridge', 'Voidmage Prodigy', 'Mystic Monastery', 'Igneous Pouncer', 'Alms of the Vein', 'Wooded Bastion', 'Basking Rootwalla', 'Thousand-Faced Shadow', 'Erayo, Soratami Ascendant', 'Epochrasite', 'Think Twice', 'Kopala, Warden of Waves', 'Exhaustion', 'Sacred Fire', 'Condemn', 'Circular Logic', 'Blood Fountain', 'Out of Time', 'Dread Return', 'Knight of the Reliquary', 'Faithful Mending', 'Fact or Fiction', 'Izzet Charm', 'Ghitu Lavarunner', 'Padeem, Consul of Innovation', 'Firebrand Archer', 'Icehide Golem', 'Blazing Rootwalla', 'Sea Gate Wreckage', 'Familiar''s Ruse', 'Heartless Act', 'Tome Scour', 'Famished Paladin', 'Blackmail', 'Noose Constrictor', 'Monstrous Carabid', 'Primal Command', 'Glacial Fortress', 'Edric, Spymaster of Trest', 'Grisly Salvage', 'Mercurial Chemister', 'Dryad Militant', 'Elixir of Immortality', 'Cabal Stronghold', 'Wrath of God', 'Fading Hope', 'Twinshot Sniper', 'Barrin, Tolarian Archmage', 'Spell Pierce', 'Delay', 'Song-Mad Treachery', 'Trade Secrets', 'Skyshroud Forest', 'Mire Triton', 'Sylvan Scrying', 'Goldmire Bridge', 'Buried Ruin', 'Sage''s Dousing', 'Mirror Entity', 'Thirst for Discovery', 'Mana Leak', 'Riptide Laboratory', 'Gravebreaker Lamia', 'Disruptive Pitmage', 'Never // Return', 'Sower of Temptation', 'Brain Freeze', 'Boomerang', 'Darigaaz Reincarnated', 'Ajani''s Pridemate', 'Bedevil', 'Gatekeeper of Malakir', 'Tectonic Reformation', 'Weapons Trainer', 'Nameless Inversion', 'Lich Lord of Unx', 'Warstorm Surge', 'Ravenous Chupacabra', 'Hagra Mauling', 'Jund Panorama', 'Hanweir Garrison', 'Howling Mine', 'Goblin Electromancer', 'Goblin Dark-Dwellers', 'Kiln Fiend', 'Tarfire', 'Snow-Covered Plains', 'Inevitable Betrayal', 'Golgari Grave-Troll', 'Lose Focus', 'Spiraling Embers', 'Duress', 'Infernal Grasp', 'Deliberate', 'Ghost Quarter', 'Hieroglyphic Illumination', 'Falkenrath Pit Fighter', 'Snow-Covered Swamp', 'Burst Lightning', 'Okiba Reckoner Raid', 'Midnight Guard', 'Sticky Fingers', 'Thought Scour', 'Shardless Agent', 'Bazaar Trader', 'Ondu Inversion', 'Shock', 'Bala Ged Recovery', 'Cloudpost', 'Jhoira''s Timebug', 'Foundry Street Denizen', 'Diregraf Ghoul', 'The Modern Age', 'Cleansing Wildfire', 'Mystifying Maze', 'Banisher Priest', 'Kumano Faces Kakkazan', 'Bladestitched Skaab', 'Centaur Garden', 'Silundi Vision', 'Braids, Cabal Minion', 'Base Camp', 'Vampire Envoy', 'Gaze of Adamaro', 'Frontier Bivouac', 'Mouth of Ronom', 'Mayor of Avabruck', 'Tanglepool Bridge', 'Ivy Lane Denizen', 'Ponder', 'Cabal Interrogator', 'Cyclone Summoner', 'Murderous Cut', 'Phyrexian Dreadnought', 'Stonybrook Angler', 'Drannith Stinger', 'Touch the Spirit Realm', 'General Ferrous Rokiric', 'Dimir Aqueduct', 'Unsubstantiate', 'Treacherous Blessing', 'Vision Skeins', 'Vampire Nighthawk', 'Diregraf Captain', 'Graf Harvest', 'Grenzo, Dungeon Warden', 'Banshee''s Blade', 'Arcbound Ravager', 'Honored Hydra', 'Fruit of Tizerus', 'Jokulhaups', 'Thornglint Bridge', 'Swiftblade Vindicator', 'Jhoira of the Ghitu', 'Forbid', 'Brokers Hideout', 'Incinerate', 'Coiling Oracle', 'Codie, Vociferous Codex', 'Search Party Captain', 'Obscura Storefront', 'Enlistment Officer', 'Curiosity', 'Impostor of the Sixth Pride', 'Crib Swap', 'Triskelion', 'Drannith Healer', 'Mirran Crusader', 'Canyon Slough', 'Fury Charm', 'Blade Splicer', 'Tithe Taker', 'Foundation Breaker', 'Zada''s Commando', 'Fauna Shaman', 'Lost Auramancers', 'Teferi, Mage of Zhalfir', 'Aphemia, the Cacophony', 'Jack-o''-Lantern', 'Skybridge Towers', 'The Biblioplex', 'Ramunap Excavator', 'Cruel Reality', 'Elemental Mastery', 'Midnight Reaper', 'Vendetta', 'Trickbind', 'Feed the Swarm', 'Siege-Gang Commander', 'Upriser Renegade', 'Vedalken Shackles', 'Hour of Promise', 'Field Marshal', 'Orochi Merge-Keeper', 'Volcanic Salvo', 'Bedlam Reveler', 'Duskwatch Recruiter', 'Goblin Matron', 'Into the Story', 'Arbor Elf', 'Ancestral Anger', 'Desperate Ritual', 'Goblin Bombardment', 'Terastodon', 'Cathar Commando', 'Drowned Catacomb', 'Curse of Stalked Prey', 'Akoum Warrior', 'Dokuchi Silencer', 'Experimental Overload', 'Riveteers Requisitioner', 'Abrade', 'Ruin Crab', 'Kazandu Blademaster', 'See the Truth', 'Cathartic Pyre', 'Soul''s Attendant', 'Wicked Akuba', 'Cursecatcher', 'Temmet, Vizier of Naktamun', 'Nether Traitor', 'Sokenzan Smelter', 'Arrogant Wurm', 'Raise the Draugr', 'Blackbloom Rogue', 'Prophetic Prism', 'Smokestack', 'Arcbound Stinger', 'Tectonic Giant', 'Hymn to Tourach', 'Shredded Sails', 'Revitalize', 'Stern Dismissal', 'Sprite Dragon', 'Skyclave Cleric', 'Prosperous Thief', 'Falkenrath Aristocrat', 'Quest for the Holy Relic', 'Strike It Rich', 'Syr Faren, the Hengehammer', 'Prowling Serpopard', 'Snowfield Sinkhole', 'Hotshot Mechanic', 'Gadwick, the Wizened', 'Blisterpod', 'Chandra, Pyromaster', 'Merfolk Mistbinder', 'Benevolent Bodyguard', 'Traumatize', 'Goldhound', 'Memory Lapse', 'Vivid Grove', 'Vivid Creek', 'Sylvan Advocate', 'Earwig Squad', 'Awakening Zone', 'Footfall Crater', 'Bump in the Night', 'Sovereign''s Bite', 'Daru Warchief', 'Tendo Ice Bridge', 'Goblin Warchief', 'Universal Automaton', 'Wild Mongrel', 'Overwhelming Splendor', 'Undercity Informer', 'Disallow', 'The Flame of Keld', 'Treasure Cruise', 'Dauntless Bodyguard', 'Oust', 'Flame Rift', 'Detention Sphere', 'Stubborn Denial', 'Sandwurm Convergence', 'Fraying Sanity', 'Forked Bolt', 'Secluded Steppe', 'Time Stretch', 'Trading Post', 'Wall of Omens', 'Oracle of Mul Daya', 'Beast Whisperer', 'Heartwood Storyteller', 'Spark Spray', 'Garth One-Eye', 'Elvish Rejuvenator', 'Horror of the Broken Lands', 'Woodland Cemetery', 'Incubation Druid', 'Dennick, Pious Apprentice', 'Dakmor Salvage', 'Temple of Enlightenment', 'Arcane Sanctum', 'Glen Elendra Archmage', 'Nullpriest of Oblivion', 'Argentum Armor', 'Geomancer''s Gambit', 'Hypergenesis', 'Whip of Erebos', 'The Raven''s Warning', 'Sleep', 'Tidal Warrior', 'Evolving Wilds', 'Pack Rat', 'Korlash, Heir to Blackblade', 'Sorin Markov', 'Arguel''s Blood Fast', 'Squadron Hawk', 'Ethersworn Canonist', 'Orim''s Chant', 'Kjeldoran Outpost', 'Zulaport Chainmage', 'Faithless Salvaging', 'Giant Killer', 'Westvale Abbey', 'Cruel Ultimatum', 'Vampire''s Kiss', 'Satyr Wayfinder'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 70.5, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (64.7 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Mayor of Avabruck', 'Vendetta', 'Arcbound Stinger', 'Champion of Wits', 'Logic Knot', 'Kefnet the Mindful', 'Banshee''s Blade', 'Nirkana Assassin', 'Duress', 'Lantern of the Lost', 'Teferi''s Ageless Insight', 'Teferi, Mage of Zhalfir', 'Raging Ravine', 'Darkmoss Bridge', 'Tajic, Legion''s Edge', 'Restore Balance', 'Deep Forest Hermit', 'Foundry Street Denizen', 'Oviya Pashiri, Sage Lifecrafter', 'Snow-Covered Plains', 'Faithless Salvaging', 'Woodland Cemetery', 'Jwari Disruption', 'Adorned Pouncer', 'Tithe Taker', 'Satyr Wayfinder', 'Lonely Sandbar', 'See the Truth', 'Touch the Spirit Realm', 'Fraying Sanity', 'Midnight Clock', 'Zulaport Chainmage', 'Putrid Imp', 'Temmet, Vizier of Naktamun', 'Dimir Charm', 'Outland Liberator', 'Didn''t Say Please', 'Bygone Bishop', 'Feed the Swarm', 'Night of Souls'' Betrayal', 'Magus of the Abyss', 'Raise the Alarm', 'Invoke Calamity', 'Glorybringer', 'Oni-Cult Anvil', 'Rakdos Headliner', 'Vedalken Anatomist', 'Snowfield Sinkhole', 'Frantic Search', 'Remorseful Cleric', 'Blowfly Infestation', 'Mistvault Bridge', 'Faithful Mending', 'Bala Ged Recovery', 'Vault of the Archangel', 'Cabal Interrogator', 'Zulaport Duelist', 'Arcbound Ravager', 'Nameless Inversion', 'Sage''s Dousing', 'Birds of Paradise', 'Favored Hoplite', 'Voltage Surge', 'Lizard Blades', 'Temple of Plenty', 'Mind''s Desire', 'Viscera Seer', 'Demigod of Revenge', 'Curse of Death''s Hold', 'Honor of the Pure', 'Kumano Faces Kakkazan', 'Thornglint Bridge', 'Terminus', 'Fieldmist Borderpost', 'Drowned Secrets', 'Incubation Druid', 'Shadowmage Infiltrator', 'Tanglepool Bridge', 'Prophet of Kruphix', 'Sylvan Scrying', 'Jhoira''s Timebug', 'Death Baron', 'Temple of Epiphany', 'Scoured Barrens', 'Hanweir Garrison', 'Firebolt', 'Empty the Warrens', 'Intangible Virtue', 'Erebos''s Intervention', 'Blighted Agent', 'Desperate Ritual', 'Geomancer''s Gambit', 'Tectonic Giant', 'Mire Triton', 'Ancient Stirrings', 'Illness in the Ranks', 'Unlucky Witness', 'Slagwoods Bridge', 'Saffi Eriksdotter', 'Bloodchief''s Thirst', 'Reality Ripple', 'Out of Time', 'Isareth the Awakener', 'Caves of Koilos', 'Glimmerpost', 'Yahenni''s Expertise', 'Splinterfright', 'Tocatli Honor Guard', 'Bump in the Night', 'Snow-Covered Forest', 'Explore', 'Quicken', 'Opt', 'Ondu Cleric', 'Snow-Covered Mountain', 'Dream Trawler', 'Coiling Oracle', 'Diregraf Ghoul', 'Benalish Marshal', 'Auramancer', 'Blossoming Sands', 'Barrin, Tolarian Archmage', 'Forgotten Cave', 'Kambal, Consul of Allocation', 'Glaze Fiend', 'Game Trail', 'Selesnya Charm', 'Mishra''s Factory', 'Orochi Merge-Keeper', 'Benevolent Bodyguard', 'Secluded Courtyard', 'Startled Awake', 'Base Camp', 'Wonder', 'Condemn', 'Sovereign''s Bite', 'Scrabbling Claws', 'Seaside Citadel', 'Awakening Zone', 'Overwhelming Splendor', 'Sidisi, Brood Tyrant', 'Gitaxian Probe', 'Flame Slash', 'Foreboding Ruins', 'Prodigal Sorcerer', 'Nuisance Engine', 'Llanowar Elves', 'Glacial Fortress', 'Gods Willing', 'Invigorating Hot Spring', 'Okina, Temple to the Grandfathers', 'Walking Skyscraper', 'Sokenzan Smelter', 'Experimental Synthesizer', 'Search Party Captain', 'Niv-Mizzet, the Firemind', 'Mystifying Maze', 'Feat of Resistance', 'Day of Judgment', 'Unified Will', 'Thundering Raiju', 'Memory Lapse', 'Dragonskull Summit', 'Midnight Reaper', 'Diregraf Captain', 'Unsubstantiate', 'Swiftblade Vindicator', 'Ominous Seas', 'Spell Pierce', 'Elvish Mystic', 'Honored Hydra', 'Spikefield Hazard', 'Gather the Townsfolk', 'Verdant Command', 'Destiny Spinner', 'Hushwing Gryff', 'Disfigure', 'Wooded Bastion', 'Restoration Angel', 'Reckless Rage', 'Jhoira of the Ghitu', 'Goblin Electromancer', 'Vindicate', 'Banisher Priest', 'Heartless Act', 'Homestead Courage', 'Psychosis Crawler', 'Ondu Inversion', 'Drossforge Bridge', 'Timeless Witness', 'Soul Warden', 'Izzet Charm', 'Orcish Vandal', 'Decree of Justice', 'Mindslaver', 'Chain Lightning', 'Lord of the Undead', 'Gird for Battle', 'Eiganjo Castle', 'Raze the Effigy', 'Lost Auramancers', 'Canyon Slough', 'Keeper of the Dead', 'Chancellor of the Dross', 'Pyroclasm', 'Sylvan Library', 'Silverbluff Bridge', 'Heartwood Storyteller', 'Carnophage', 'Lose Focus', 'Slagstorm', 'Vedalken Aethermage', 'Soul Spike', 'Animate Dead', 'Temple of Triumph', 'Colossal Skyturtle', 'Ancestral Anger', 'Slip Out the Back', 'Frantic Inventory', 'Merfolk Secretkeeper', 'Kitchen Imp', 'Dryad Militant', 'Sejiri Shelter', 'Mirari''s Wake', 'Demonic Embrace', 'Goblin Bombardment', 'Worldgorger Dragon', 'Champion of the Parish', 'Kaervek, the Spiteful', 'Secluded Steppe', 'Hero of Precinct One', 'Metalwork Colossus', 'Mouth of Ronom', 'Curse of Thirst', 'Coalition Relic', 'Shreds of Sanity', 'Upriser Renegade', 'Heliod''s Pilgrim', 'Kunoros, Hound of Athreos', 'Mirrorshell Crab', 'Advent of the Wurm', 'Golgari Brownscale', 'Experimental Overload', 'Greater Gargadon', 'Never // Return', 'Shaile, Dean of Radiance', 'Nested Shambler', 'Skyshroud Forest', 'Double Vision', 'Immortal Coil', 'Brain Freeze', 'Planar Portal', 'Repeal', 'Bedlam Reveler', 'Beastcaller Savant', 'Ethersworn Canonist', 'Demonic Dread', 'Sigrid, God-Favored', 'Temple of Enlightenment', 'Kiln Fiend', 'Ethereal Absolution', 'Curse of Misfortunes', 'Vampire Nighthawk', 'Sanguine Statuette', 'Dark Ritual', 'Sleeper Agent', 'Temple of Malady', 'Step Through', 'Sign in Blood', 'Reckless Charge', 'Tome Scour', 'Wildfield Borderpost', 'Obliterate', 'Crash Through', 'Muddle the Mixture', 'Pack Rat', 'Elixir of Immortality', 'Evolving Wilds', 'Sandwurm Convergence', 'General Ferrous Rokiric', 'Banefire', 'Alms of the Vein', 'Hagra Mauling', 'Winds of Rebuke', 'Weapons Trainer', 'Shalai, Voice of Plenty', 'Suspend', 'Gadwick, the Wizened', 'Tendrils of Agony', 'Zabaz, the Glimmerwasp', 'Goldmire Bridge', 'Padeem, Consul of Innovation', 'Bala Ged Thief', 'Ethersworn Sphinx', 'Astral Slide', 'Rune-Scarred Demon', 'Golgari Grave-Troll', 'Prophetic Prism', 'Vampire''s Kiss', 'Lumbering Falls', 'Shardless Agent', 'Garth One-Eye', 'Apex of Power', 'Bloodbraid Elf', 'Unexpected Results', 'Blood Fountain', 'Lich Lord of Unx', 'Silundi Vision', 'Mystic Monastery', 'Sower of Temptation', 'Foundation Breaker', 'Clifftop Retreat', 'Trading Post', 'Urza''s Factory', 'Epochrasite', 'Gideon Jura', 'Time Stretch', 'Disruptive Pitmage', 'Kor Blademaster', 'Delay', 'Grimdancer', 'Hapatra, Vizier of Poisons', 'Blistercoil Weird', 'Orim''s Chant', 'Dimir Aqueduct', 'Prowling Serpopard', 'Glen Elendra Archmage', 'The Raven''s Warning', 'Behold the Multiverse', 'Judith, the Scourge Diva', 'Kor Duelist', 'Sleight of Hand', 'Rootbound Crag', 'Augur of Bolas', 'Harmless Offering', 'Eternal Dragon', 'Fire-Lit Thicket', 'Okiba Reckoner Raid', 'Butcher Ghoul', 'Curiosity', 'Buried Ruin', 'Judge''s Familiar', 'Sleep', 'Dauntless Bodyguard', 'Barren Moor', 'Shriekmaw', 'Deathcap Cultivator', 'Traumatize', 'Izzet Boilerworks', 'Rustvale Bridge', 'Sylvan Advocate', 'Reveillark', 'Cruel Ultimatum', 'Bone Shards', 'Oran-Rief Ooze', 'Hada Freeblade', 'Stirring Wildwood', 'Falkenrath Aristocrat', 'Mercurial Chemister', 'Ramunap Excavator', 'Crumbling Necropolis', 'Magus of the Disk', 'Knight of the Reliquary', 'Sorin''s Vengeance', 'Nezahal, Primal Tide', 'Bladestitched Skaab', 'Primal Command', 'Oracle of Mul Daya', 'Unburial Rites', 'Chandra, Pyromaster', 'Peer Through Depths', 'Pieces of the Puzzle', 'Cloudpost', 'Incinerate', 'Battlefield Forge', 'Trespasser''s Curse', 'Hour of Promise', 'Slaughter Specialist', 'Nether Traitor', 'Think Twice', 'Lavaclaw Reaches', 'Seething Song', 'Brokers Hideout', 'Dispel', 'Eaten Alive', 'Blisterpod', 'Psychic Strike', 'Fire Covenant', 'Veinfire Borderpost', 'Goldhound', 'Defiant Strike', 'Braids, Cabal Minion', 'Underworld Dreams', 'Blood for Bones', 'Eater of Virtue', 'Shrapnel Blast', 'Drana''s Emissary', 'Goblin Dark-Dwellers', 'Akroma''s Blessing', 'Codie, Vociferous Codex', 'Char', 'Graf Harvest', 'Astral Drift', 'Obscura Storefront', 'Illuminator Virtuoso', 'Jolrael, Mwonvuli Recluse', 'Temple of Deceit', 'Cabal Therapist', 'Renewed Faith', 'Grisly Salvage', 'Dead // Gone', 'Riptide Laboratory', 'Wall of Omens', 'Zulaport Cutthroat', 'Fiery Temper', 'Earthshaker Khenra', 'Sky Terror', 'Ruin Crab', 'Ondu War Cleric', 'Mistvein Borderpost', 'Combine Chrysalis', 'Duskwatch Recruiter', 'Murderous Cut', 'Disciple of the Vault', 'Jace, the Living Guildpact', 'Elemental Mastery', 'Volcanic Salvo', 'Sticky Fingers', 'Temple of Silence', 'Cruel Reality', 'Westvale Abbey', 'Sacred Fire', 'Electrolyze', 'Stonybrook Angler', 'Inevitable Betrayal', 'Cleansing Wildfire', 'Mirran Crusader', 'Deep Analysis', 'Bastion of Remembrance', 'Fauna Shaman', 'Ajani''s Pridemate', 'Stern Dismissal', 'Into the Story', 'Dream Twist', 'Midnight Guard', 'Brave the Elements', 'Infernal Grasp', 'Firewild Borderpost', 'Ravenous Squirrel', 'Clackbridge Troll', 'Curse of Stalked Prey', 'Frontier Bivouac', 'Mana Leak', 'Ghost Quarter', 'Needle Spires', 'Blazing Rootwalla', 'Revitalize', 'Messenger''s Speed', 'Edric, Spymaster of Trest', 'Sungold Sentinel', 'Dakmor Salvage', 'Temple of Mystery', 'Mistcutter Hydra', 'Fabricate', 'Oust', 'Triskaidekaphile', 'Mesmeric Fiend', 'Timely Reinforcements', 'Zada''s Commando', 'Negate', 'Giant Killer', 'It That Betrays', 'Hissing Quagmire', 'Treasure Cruise', 'Hinterland Harbor', 'Gatekeeper of Malakir', 'Deliberate', 'Kaya, Ghost Assassin', 'Piranha Marsh', 'Arch of Orazca', 'Blazing Shoal', 'Improbable Alliance', 'Sidisi, Undead Vizier', 'Cauldron Haze', 'Snow-Covered Swamp', 'Voldaren Epicure', 'Hymn to Tourach', 'Soul''s Attendant', 'Ponder', 'Magister of Worth', 'Tyrant''s Choice', 'Skyclave Cleric', 'Wrath of God', 'Razortide Bridge', 'Scout''s Warning', 'Arcbound Worker', 'Reckless Impulse', 'Abbot of Keral Keep', 'Jokulhaups', 'Song-Mad Treachery', 'Thought Scour', 'Dread Fugue', 'Blade Splicer', 'Famished Paladin', 'Tomb of Urami', 'Faerie Vandal', 'Dust of Moments', 'Voidmage Prodigy', 'Austere Command', 'Evolving Door', 'Chasm Skulker', 'Cerodon Yearling', 'Raise the Draugr', 'Gigadrowse', 'Gavony Township', 'Graveshifter', 'Captain''s Claws', 'Drowned Catacomb', 'Kabira Takedown', 'Arcane Sanctum', 'Mangara of Corondor', 'Opulent Palace', 'Cyclone Summoner', 'Bazaar Trader', 'Sygg, River Cutthroat', 'Watcher for Tomorrow', 'Garruk Wildspeaker', 'Llanowar Wastes', 'Cathar Commando', 'Abrade', 'Crib Swap', 'Mirror Entity', 'Ritual of Soot', 'Burst Lightning', 'Vampire Envoy', 'Buried Alive', 'Skyclave Shade', 'Hunted Horror', 'Tranquil Thicket', 'Phyrexian Dreadnought', 'Fury Charm', 'Mind Funeral', 'Alesha, Who Smiles at Death', 'Karmic Guide'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 64.7, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (96.0 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Chemister''s Insight', 'Thornglint Bridge', 'Seaside Citadel', 'Jolrael, Mwonvuli Recluse', 'Temple of Plenty', 'Journeyer''s Kite', 'Trostani''s Summoner', 'Lich Lord of Unx', 'Verduran Enchantress', 'Tendrils of Agony', 'Barrin, Tolarian Archmage', 'Crib Swap', 'Ezuri, Renegade Leader', 'Gitaxian Probe', 'Ondu Cleric', 'Sandwurm Convergence', 'Blazing Rootwalla', 'Braids, Cabal Minion', 'Saffi Eriksdotter', 'Sanguine Statuette', 'Stinkdrinker Bandit', 'Arguel''s Blood Fast', 'Death Baron', 'Raise the Alarm', 'Bloodbraid Elf', 'Nevermore', 'Snow-Covered Plains', 'Hapatra, Vizier of Poisons', 'Drowned Secrets', 'Jaya Ballard', 'Ravenous Squirrel', 'Fyndhorn Elves', 'Muddle the Mixture', 'Evolving Door', 'Fauna Shaman', 'Vampire''s Kiss', 'Rustvale Bridge', 'Sungold Sentinel', 'Deliberate', 'Gods Willing', 'Temple of Malady', 'Zhalfirin Void', 'Snowfield Sinkhole', 'Song-Mad Treachery', 'Stonybrook Angler', 'Suspend', 'Fleecemane Lion', 'Hour of Promise', 'Dokuchi Silencer', 'Cabal Interrogator', 'Nameless Inversion', 'General Ferrous Rokiric', 'Spikefield Hazard', 'Chancellor of the Dross', 'Never // Return', 'Eiganjo Castle', 'Jukai Naturalist', 'Slagwoods Bridge', 'Quicksilver Fountain', 'Soul Spike', 'Medomai''s Prophecy', 'Elves of Deep Shadow', 'Hada Freeblade', 'Seal of Removal', 'Cleansing Wildfire', 'Fodder Launch', 'Strionic Resonator', 'Banefire', 'Evolving Wilds', 'Primal Command', 'Jack-o''-Lantern', 'Eaten Alive', 'Coalition Relic', 'Grimdancer', 'Rule of Law', 'Startled Awake', 'Judge''s Familiar', 'Mystifying Maze', 'Earwig Squad', 'Goblin Assault', 'Temple of Triumph', 'Shreds of Sanity', 'Merfolk Secretkeeper', 'Unified Will', 'Disfigure', 'Unlucky Witness', 'Adorned Pouncer', 'Goblin Dark-Dwellers', 'Tyrant''s Choice', 'Incubation Druid', 'Cruel Reality', 'Secluded Glen', 'Korlash, Heir to Blackblade', 'Razortide Bridge', 'Goblin Bombardment', 'Burst Lightning', 'Jadelight Ranger', 'Last Breath', 'Llanowar Elves', 'Memory Lapse', 'Mikokoro, Center of the Sea', 'Watcher for Tomorrow', 'Wonder', 'Izzet Charm', 'Tribute Mage', 'Nuisance Engine', 'Battlefield Forge', 'Experimental Synthesizer', 'Foundry Street Denizen', 'Opt', 'Disruptive Pitmage', 'Duress', 'Fire-Lit Thicket', 'Goblin Electromancer', 'Cumber Stone', 'Arcbound Ravager', 'Fallen Shinobi', 'Bone Shards', 'Volcanic Salvo', 'Mesmeric Fiend', 'Thundering Raiju', 'Canyon Slough', 'Sign in Blood', 'Feed the Swarm', 'Vindicate', 'Soul''s Attendant', 'Bedlam Reveler', 'Mana Leak', 'Reckless Impulse', 'Mistvein Borderpost', 'Demigod of Revenge', 'Viashino Pyromancer', 'Epochrasite', 'Izzet Boilerworks', 'Step Through', 'Nullpriest of Oblivion', 'Gideon''s Intervention', 'Prophetic Prism', 'Snow-Covered Mountain', 'Wildfield Borderpost', 'Shielding Plax', 'Chandra, Pyromaster', 'Apex of Power', 'Blighted Agent', 'Commit // Memory', 'Search Party Captain', 'Elvish Mystic', 'Dimir Charm', 'Bronzehide Lion', 'Ajani''s Pridemate', 'Orim''s Chant', 'Faerie Vandal', 'Swiftblade Vindicator', 'Unexpected Results', 'Bump in the Night', 'Midnight Guard', 'Kazuul''s Fury', 'Cerodon Yearling', 'Erebos''s Intervention', 'Foreboding Ruins', 'Stromkirk Noble', 'Psychosis Crawler', 'Bramblewood Paragon', 'Mangara of Corondor', 'Changeling Outcast', 'Ethereal Haze', 'Clifftop Retreat', 'Think Twice', 'Selesnya Charm', 'Sokenzan Smelter', 'Oviya Pashiri, Sage Lifecrafter', 'Quicken', 'Tithe Taker', 'Mistblade Shinobi', 'Keeper of the Dead', 'Vendetta', 'Wild Cantor', 'Snow-Covered Swamp', 'Zabaz, the Glimmerwasp', 'Ruin Crab', 'Fieldmist Borderpost', 'Elemental Mastery', 'Nirkana Assassin', 'Barren Moor', 'Jace, the Living Guildpact', 'Improbable Alliance', 'Heartwood Storyteller', 'Grisly Salvage', 'Dissipate', 'Putrid Imp', 'Blood Fountain', 'Bankrupt in Blood', 'Blowfly Infestation', 'Abbot of Keral Keep', 'Stirring Wildwood', 'Hieroglyphic Illumination', 'Silver-Fur Master', 'Dakmor Salvage', 'Peer Through Depths', 'Mouth of Ronom', 'Glacial Fortress', 'Silence', 'Tangle', 'Sigrid, God-Favored', 'Arcbound Worker', 'Lose Focus', 'Sidisi, Brood Tyrant', 'Midnight Reaper', 'Temple Bell', 'Lumbering Falls', 'Ritual of Soot', 'Fire Covenant', 'Dread Fugue', 'Earthshaker Khenra', 'Game Trail', 'Disciple of the Vault', 'Darkmoss Bridge', 'Deathcap Cultivator', 'Reckless Rage', 'Worldgorger Dragon', 'Shalai, Voice of Plenty', 'Murmuring Mystic', 'Ethersworn Sphinx', 'Urza''s Factory', 'Cathar Commando', 'Rabbit Battery', 'Runed Halo', 'Cold-Eyed Selkie', 'Thopter Spy Network', 'Skyshroud Forest', 'Timeless Witness', 'Kaya, Ghost Assassin', 'Reveillark', 'Demonic Dread', 'Hero of Iroas', 'Logic Knot', 'Sleep', 'Intangible Virtue', 'Joraga Warcaller', 'Karmic Guide', 'Dragonskull Summit', 'Nightshade Stinger', 'Dread Return', 'Rites of Flourishing', 'Mystic Monastery', 'Kitchen Imp', 'Coiling Oracle', 'Firewild Borderpost', 'Gray Merchant of Asphodel', 'Neutralize', 'Dryad Militant', 'Raging Ravine', 'Oran-Rief Ooze', 'Graf Harvest', 'Firebolt', 'Ominous Seas', 'Dead // Gone', 'Sovereign''s Bite', 'Riptide Laboratory', 'Frostwalk Bastion', 'Woodland Cemetery', 'Messenger''s Speed', 'Obscura Storefront', 'Eater of Virtue', 'Fabricate', 'Whip of Erebos', 'Elvish Archdruid', 'Ethereal Absolution', 'Ingenious Infiltrator', 'Secluded Courtyard', 'Mirror Entity', 'Grave Strength', 'Blazing Shoal', 'Pulse of the Fields', 'Fling', 'Gavony Township', 'Viscera Seer', 'Hythonia the Cruel', 'Mistvault Bridge', 'Invigorating Hot Spring', 'Hinterland Harbor', 'Rune of Sustenance', 'Aetherspouts', 'Ojutai''s Command', 'Out of Time', 'Fiery Temper', 'Temple of Deceit', 'Pia and Kiran Nalaar', 'Familiar''s Ruse', 'Sylvan Scrying', 'Dream Trawler', 'Into the Story', 'Judith, the Scourge Diva', 'Weapons Trainer', 'Voidmage Prodigy', 'Foundation Breaker', 'Wooded Bastion', 'Padeem, Consul of Innovation', 'Mirran Crusader', 'Wall of Omens', 'Tranquil Cove', 'Triskaidekaphile', 'Feat of Resistance', 'Garruk Wildspeaker', 'Phantasmagorian', 'Blistercoil Weird', 'Chasm Skulker', 'Electrolyze', 'Defiant Strike', 'Howling Mine', 'Raze the Effigy', 'Spell Pierce', 'Traumatize', 'Faithless Salvaging', 'Verdant Command', 'Favored Hoplite', 'Temmet, Vizier of Naktamun', 'Glimmerpost', 'Loxodon Smiter', 'Sower of Temptation', 'Zulaport Duelist', 'Beast Whisperer', 'Ethersworn Canonist', 'Dust of Moments', 'Terminus', 'Pyroclasm', 'Bladestitched Skaab', 'Lotleth Giant', 'Kor Duelist', 'Arch of Orazca', 'Oblivion Ring', 'Crumbling Necropolis', 'Goldhound', 'Thought Scour', 'Illuminator Virtuoso', 'Treasure Cruise', 'Silverbluff Bridge', 'Barbarian Ring', 'Prodigal Sorcerer', 'Edric, Spymaster of Trest', 'Killing Wave', 'Kefnet the Mindful', 'Decree of Justice', 'Faerie Miscreant', 'Bastion of Remembrance', 'Brokers Charm', 'Pentarch Ward', 'Eldrazi Conscription', 'Zulaport Chainmage', 'Glen Elendra Archmage', 'Captain''s Claws', 'Dwynen''s Elite', 'Ancestral Anger', 'Needle Spires', 'Voltage Surge', 'Hero of Precinct One', 'Mistveil Plains', 'Niv-Mizzet, the Firemind', 'Disallow', 'Kunoros, Hound of Athreos', 'Ondu Inversion', 'Vedalken Anatomist', 'Mistcutter Hydra', 'Planar Portal', 'Verdurous Gearhulk', 'Faithful Mending', 'Prism Ring', 'Strike It Rich', 'Veinfire Borderpost', 'Lonely Sandbar', 'Mind''s Desire', 'Fatestitcher', 'Gravitational Shift', 'Explore', 'Nether Traitor', 'Garth One-Eye', 'Lead the Stampede', 'Frontier Bivouac', 'Elspeth Conquers Death', 'Frantic Inventory', 'Sea Gate Wreckage', 'Jokulhaups', 'Engulf the Shore', 'Champion of Wits', 'It That Betrays', 'Pack Rat', 'Golgari Brownscale', 'Char', 'Dissolve', 'Drowned Catacomb', 'Midnight Clock', 'Frantic Search', 'Stern Dismissal', 'Tymaret, Chosen from Death', 'Shigeki, Jukai Visionary', 'Yahenni''s Expertise', 'Spatial Contortion', 'Advent of the Wurm', 'Tectonic Giant', 'Deep Analysis', 'Homestead Courage', 'Birds of Paradise', 'Magus of the Abyss', 'Blade Splicer', 'Tamiyo''s Safekeeping', 'Oni-Cult Anvil', 'Experimental Overload', 'Walking Skyscraper', 'Prismatic Lens', 'Goldmire Bridge', 'Reckless Charge', 'Mirrorshell Crab', 'Shriekmaw', 'See the Truth', 'Mire Triton', 'Desperate Ritual', 'Time Stretch', 'Temple of Mystery', 'Phoenix of Ash', 'Tome Scour', 'Voldaren Epicure', 'Hissing Quagmire', 'Kumano Faces Kakkazan', 'Cabal Stronghold', 'Teferi, Mage of Zhalfir', 'Lord of the Undead', 'Dream Twist', 'Gatekeeper of Malakir', 'Fierce Retribution', 'Balustrade Spy', 'Purify the Grave', 'Brain Freeze', 'Sage''s Dousing', 'Detention Sphere', 'Touch the Spirit Realm', 'Oracle of Mul Daya', 'Bazaar Trader', 'Ondu War Cleric', 'Soul Warden', 'Opulent Palace', 'Carnophage', 'Growth-Chamber Guardian', 'Lavaclaw Reaches', 'Oust', 'Tajic, Legion''s Edge', 'Caves of Koilos', 'Awakening Zone', 'Dimir Aqueduct', 'Combine Chrysalis', 'Rootbound Crag', 'Shaile, Dean of Radiance', 'Herald of the Pantheon', 'Sky Terror', 'Buried Ruin', 'Time of Ice', 'Fury Charm', 'Seething Song', 'Codie, Vociferous Codex', 'Fraying Sanity', 'Frogtosser Banneret', 'Jhoira of the Ghitu', 'Master of Death', 'Field of Ruin', 'Repeal', 'Varragoth, Bloodsky Sire', 'Base Camp', 'Josu Vess, Lich Knight', 'Duskwatch Recruiter', 'Skyclave Shade', 'Remorseful Cleric', 'Murderous Cut', 'Satoru Umezawa', 'Dennick, Pious Apprentice', 'Blisterpod', 'Skyclave Cleric', 'Akoum Warrior', 'Pyrite Spellbomb', 'Chain Lightning', 'Forgotten Cave', 'The Raven''s Warning', 'Ramunap Excavator', 'Famished Paladin', 'Bala Ged Recovery', 'Knucklebone Witch', 'Mindslaver', 'Karametra''s Favor', 'Bala Ged Thief', 'Immortal Coil', 'Lantern of the Lost', 'Cabal Therapist', 'Phyrexian Dreadnought', 'Westvale Abbey', 'Sticky Fingers', 'Thousand-Faced Shadow', 'Gadwick, the Wizened', 'Hymn to Tourach', 'Inevitable Betrayal', 'Magus of the Disk', 'Ancient Stirrings', 'Jace, Memory Adept', 'Beastcaller Savant', 'Nested Shambler', 'Colossal Skyturtle', 'Psychic Strike', 'Pyretic Ritual', 'Lys Alana Huntmaster', 'Overwhelming Splendor', 'Hagra Mauling', 'Cauldron Haze', 'Teferi''s Ageless Insight', 'Sterling Grove', 'Sorin''s Vengeance', 'Harmless Offering', 'Sleight of Hand', 'Raise the Draugr', 'Day of Judgment', 'Upriser Renegade', 'Cloudpost', 'Auntie''s Snitch', 'Mercurial Chemister', 'Tyrant''s Scorn', 'Incinerate', 'Arcane Sanctum', 'Jwari Disruption', 'Kiln Fiend', 'Didn''t Say Please', 'Austere Command', 'Sacred Fire', 'Winds of Rebuke', 'Condemn', 'Prickly Boggart', 'Bygone Bishop', 'Slagstorm', 'Curse of Stalked Prey', 'Vampire Nighthawk', 'Graveshifter', 'Prowling Serpopard', 'Mind Funeral', 'Timely Reinforcements', 'Diregraf Captain', 'Delay', 'Infernal Plunge', 'Linvala, Shield of Sea Gate', 'Outland Liberator', 'Alms of the Vein', 'Splinterfright', 'Slip Out the Back', 'Temple of Enlightenment', 'Gideon Jura', 'Rakdos Headliner', 'Restore Balance', 'Skybridge Towers', 'Forbid', 'Revitalize', 'Glorybringer', 'Malakir Rebirth', 'Drossforge Bridge', 'Hanweir Garrison', 'Drana''s Emissary', 'Sylvan Library', 'Falkenrath Aristocrat', 'Satyr Wayfinder', 'Dark Ritual', 'Golgari Grave-Troll', 'Destiny Spinner', 'Gird for Battle', 'Kor Blademaster', 'Vedalken Aethermage', 'Qasali Pridemage', 'Okiba Reckoner Raid', 'Memory''s Journey', 'Moon-Circuit Hacker', 'Orcish Vandal', 'Sejiri Shelter', 'Shrapnel Blast', 'Animate Dead', 'Sylvan Advocate', 'Sidisi, Undead Vizier', 'Reality Ripple', 'Lochmere Serpent', 'Silundi Vision', 'Banshee''s Blade', 'Double Vision', 'Metalwork Colossus', 'Elixir of Immortality', 'Abrade', 'Shardless Agent', 'Tanglepool Bridge', 'Power Conduit', 'Arcbound Stinger', 'Ponder', 'Wrath of God', 'Heartless Act', 'Blackbloom Rogue', 'Ornithopter', 'Shadowmage Infiltrator', 'Lost Auramancers', 'Mishra''s Factory', 'Jhoira''s Timebug', 'Honored Hydra', 'Glaze Fiend', 'Lizard Blades', 'Augur of Bolas', 'Geomancer''s Gambit', 'Curiosity', 'Okina, Temple to the Grandfathers', 'Sorin Markov', 'Zada''s Commando', 'Llanowar Wastes', 'Sarkhan, the Dragonspeaker', 'Piranha Marsh', 'Restoration Angel', 'Invoke Calamity', 'Diregraf Ghoul', 'Prosperous Thief', 'Snow-Covered Forest', 'Obliterate', 'Greater Gargadon', 'Zulaport Cutthroat', 'Knight of the Reliquary', 'Crash Through', 'Orochi Merge-Keeper', 'Banisher Priest', 'Mirari''s Wake', 'Isareth the Awakener', 'Warren Weirding', 'Solitary Confinement', 'Secluded Steppe', 'Cyclone Summoner', 'Prophet of Kruphix', 'Trading Post', 'Scrabbling Claws', 'Vampire Envoy', 'Mayor of Avabruck', 'Bloodchief''s Thirst', 'Brokers Hideout', 'Behold the Multiverse', 'Temur Charm', 'Temple of Epiphany', 'Undercity Informer', 'Scout''s Warning', 'Cruel Ultimatum', 'Ravenous Chupacabra', 'Ghost Quarter', 'Negate'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 96.0, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (60.5 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Diregraf Ghoul', 'Ghost Quarter', 'Nirkana Assassin', 'Ethersworn Sphinx', 'Adorned Pouncer', 'Thought Scour', 'Champion of Wits', 'Kitchen Imp', 'Invoke Calamity', 'Swiftblade Vindicator', 'Greater Gargadon', 'Hanweir Garrison', 'Voidmage Prodigy', 'Dream Twist', 'Kor Blademaster', 'Sleep', 'Oni-Cult Anvil', 'Scout''s Warning', 'Chaplain of Alms', 'Advent of the Wurm', 'Dimir Aqueduct', 'Wonder', 'Dennick, Pious Apprentice', 'Vedalken Aethermage', 'Kaya, Ghost Assassin', 'Fiery Temper', 'Midnight Clock', 'Midnight Reaper', 'Forgotten Cave', 'Frogtosser Banneret', 'Feed the Swarm', 'Sage''s Dousing', 'Rootbound Crag', 'Incinerate', 'Bramblewood Paragon', 'Brokers Hideout', 'Zabaz, the Glimmerwasp', 'Spatial Contortion', 'Glen Elendra Archmage', 'Goldmire Bridge', 'Last Breath', 'Cleansing Wildfire', 'Jhoira of the Ghitu', 'Deep Analysis', 'Journeyer''s Kite', 'Bloodtithe Harvester', 'Timeless Witness', 'Tithe Taker', 'Snow-Covered Mountain', 'Detention Sphere', 'Pia and Kiran Nalaar', 'Firebolt', 'Jace, the Living Guildpact', 'Fling', 'Kunoros, Hound of Athreos', 'Dakmor Salvage', 'Eaten Alive', 'Lich Lord of Unx', 'Blood Fountain', 'Goblin Assault', 'Combine Chrysalis', 'Sylvan Advocate', 'Logic Knot', 'Invigorating Hot Spring', 'Cruel Ultimatum', 'Snow-Covered Forest', 'Mind Funeral', 'Firewild Borderpost', 'Demonic Dread', 'Elves of Deep Shadow', 'Mystic Monastery', 'Blighted Agent', 'Thundering Raiju', 'Splinterfright', 'Snow-Covered Swamp', 'Timely Reinforcements', 'Hieroglyphic Illumination', 'Sandwurm Convergence', 'Lonely Sandbar', 'Elixir of Immortality', 'Jokulhaups', 'Disciple of the Vault', 'Trading Post', 'Power Conduit', 'See the Truth', 'Phyrexian Dreadnought', 'Bronzehide Lion', 'Sidisi, Undead Vizier', 'Awakening Zone', 'Epochrasite', 'Bloodchief''s Thirst', 'Ezuri, Renegade Leader', 'Fraying Sanity', 'Jolrael, Mwonvuli Recluse', 'Battlefield Forge', 'Jace, Memory Adept', 'Zurgo Bellstriker', 'Needle Spires', 'Ravenous Squirrel', 'Zulaport Chainmage', 'Duskwatch Recruiter', 'Frostwalk Bastion', 'Pyrite Spellbomb', 'Murderous Cut', 'Padeem, Consul of Innovation', 'Medomai''s Prophecy', 'Diregraf Captain', 'Slip Out the Back', 'Banisher Priest', 'Feat of Resistance', 'Isareth the Awakener', 'Memory Lapse', 'Zhalfirin Void', 'Niv-Mizzet, the Firemind', 'Sower of Temptation', 'Silverbluff Bridge', 'Brokers Charm', 'Dissolve', 'Raging Ravine', 'Jukai Naturalist', 'Graf Harvest', 'Goblin Dark-Dwellers', 'Satyr Wayfinder', 'Teferi''s Ageless Insight', 'Goblin Electromancer', 'Step Through', 'Goblin Bombardment', 'Golgari Grave-Troll', 'Vedalken Anatomist', 'General Ferrous Rokiric', 'Chain Lightning', 'Jwari Disruption', 'Edric, Spymaster of Trest', 'Oran-Rief Ooze', 'Electrolyze', 'Rakdos Headliner', 'Putrid Imp', 'Search Party Captain', 'Fauna Shaman', 'Faerie Vandal', 'Dauntless Bodyguard', 'Izzet Boilerworks', 'Dead // Gone', 'Muddle the Mixture', 'Illuminator Virtuoso', 'Arcbound Ravager', 'Lumbering Falls', 'Bedlam Reveler', 'Fodder Launch', 'Terminus', 'Orcish Vandal', 'Desperate Ritual', 'Arcbound Worker', 'Ondu Inversion', 'Sylvan Scrying', 'Tajic, Legion''s Edge', 'Riptide Laboratory', 'Oviya Pashiri, Sage Lifecrafter', 'Braids, Cabal Minion', 'Intangible Virtue', 'Kumano Faces Kakkazan', 'Think Twice', 'Hero of Iroas', 'Jadelight Ranger', 'Planar Portal', 'Gatekeeper of Malakir', 'Midnight Guard', 'Frantic Search', 'Tendrils of Agony', 'Arcane Sanctum', 'Startled Awake', 'Bankrupt in Blood', 'Fire-Lit Thicket', 'Temple of Triumph', 'Raise the Alarm', 'Warren Weirding', 'Hissing Quagmire', 'Bygone Bishop', 'Crumbling Necropolis', 'Slagwoods Bridge', 'Spikefield Hazard', 'Rakdos Cackler', 'Giant Killer', 'Magus of the Abyss', 'Winds of Rebuke', 'Improbable Alliance', 'Reckless Charge', 'Spell Pierce', 'Bloodbraid Elf', 'Mirror Entity', 'Day of Judgment', 'Elemental Mastery', 'Figure of Destiny', 'Mana Leak', 'Grisly Salvage', 'Ritual of Soot', 'Wooded Bastion', 'Jhoira''s Timebug', 'Chandra, Pyromaster', 'Beast Whisperer', 'Kabira Takedown', 'Nether Traitor', 'Fleecemane Lion', 'Secluded Courtyard', 'Ponder', 'Gideon Jura', 'Canyon Slough', 'Blisterpod', 'General''s Enforcer', 'Drana''s Emissary', 'Vendetta', 'Walking Skyscraper', 'Oust', 'Phoenix of Ash', 'Disallow', 'Hero of Precinct One', 'Bladestitched Skaab', 'Knucklebone Witch', 'Yahenni''s Expertise', 'Sanguine Statuette', 'Sidisi, Brood Tyrant', 'Fabricate', 'Razortide Bridge', 'Judith, the Scourge Diva', 'Captain Lannery Storm', 'Sorin''s Vengeance', 'Ash Zealot', 'Cloudpost', 'Double Vision', 'Elvish Mystic', 'Knight of the Reliquary', 'Frontier Bivouac', 'Obscura Storefront', 'Time of Ice', 'Crash Through', 'Nested Shambler', 'Ondu Cleric', 'Pentarch Ward', 'Blazing Shoal', 'Stinkdrinker Bandit', 'Quicksilver Fountain', 'Heartwood Storyteller', 'Blazing Rootwalla', 'Sejiri Shelter', 'Immortal Coil', 'Soul''s Attendant', 'Sarkhan, the Dragonspeaker', 'Piranha Marsh', 'Foundation Breaker', 'Kor Duelist', 'Austere Command', 'Curse of Stalked Prey', 'Viscera Seer', 'Mangara of Corondor', 'Bala Ged Recovery', 'Barren Moor', 'Wall of Omens', 'Mayor of Avabruck', 'Selesnya Charm', 'Lys Alana Huntmaster', 'Lose Focus', 'Bump in the Night', 'Slagstorm', 'Linvala, Shield of Sea Gate', 'Earthshaker Khenra', 'Disruptive Pitmage', 'Obliterate', 'Lizard Blades', 'Triskaidekaphile', 'Lavaclaw Reaches', 'Behold the Multiverse', 'Dissipate', 'Wayward Guide-Beast', 'Keeper of the Dead', 'Raze the Effigy', 'Hinterland Harbor', 'Forbid', 'Thopter Spy Network', 'Eldrazi Conscription', 'Urza''s Factory', 'Chemister''s Insight', 'Blade Splicer', 'Frantic Inventory', 'Shrapnel Blast', 'Apex of Power', 'Darkmoss Bridge', 'Experimental Overload', 'Mouth of Ronom', 'Metalwork Colossus', 'Defiant Strike', 'Oracle of Mul Daya', 'Mistveil Plains', 'Gird for Battle', 'Mistcutter Hydra', 'Cerodon Yearling', 'Sign in Blood', 'Dimir Charm', 'Dire Tactics', 'Growth-Chamber Guardian', 'Dragonskull Summit', 'Woodland Cemetery', 'Weapons Trainer', 'Gods Willing', 'Duress', 'Sleight of Hand', 'Banefire', 'Restoration Angel', 'Zulaport Duelist', 'Watcher for Tomorrow', 'Barrin, Tolarian Archmage', 'Alms of the Vein', 'Sungold Sentinel', 'Destiny Spinner', 'Orim''s Chant', 'Nuisance Engine', 'Experimental Synthesizer', 'Captain''s Claws', 'Fire Covenant', 'Hymn to Tourach', 'Reality Ripple', 'Slaughter Games', 'Ominous Seas', 'Wrath of God', 'Skybridge Towers', 'Trostani''s Summoner', 'Stonybrook Angler', 'Cauldron Haze', 'Shielding Plax', 'Sigrid, God-Favored', 'Revitalize', 'Worldgorger Dragon', 'Favored Hoplite', 'Bazaar Trader', 'Lost Auramancers', 'Vindicate', 'Pack Rat', 'Famished Paladin', 'Decree of Justice', 'Foreboding Ruins', 'Mystifying Maze', 'Veinfire Borderpost', 'Strionic Resonator', 'Gravitational Shift', 'Ancestral Anger', 'Secluded Steppe', 'Prophetic Prism', 'Lord of the Undead', 'Prickly Boggart', 'Mirari''s Wake', 'Shardless Agent', 'Joraga Warcaller', 'Skyclave Shade', 'Death Baron', 'Inevitable Betrayal', 'Temple of Malady', 'Unlucky Witness', 'Plargg, Dean of Chaos', 'Seething Song', 'Prismatic Lens', 'Suspend', 'Commit // Memory', 'Field of Ruin', 'Snow-Covered Plains', 'Tranquil Cove', 'Char', 'Curiosity', 'Verdant Command', 'Ajani''s Pridemate', 'Prophet of Kruphix', 'Falkenrath Aristocrat', 'Shreds of Sanity', 'The Raven''s Warning', 'Garth One-Eye', 'Temple of Mystery', 'Never // Return', 'Gavony Township', 'Eiganjo Castle', 'Mirran Crusader', 'Ondu War Cleric', 'Foundry Street Denizen', 'Golgari Brownscale', 'Crib Swap', 'Tribute Mage', 'Coalition Relic', 'Caves of Koilos', 'Glacial Fortress', 'Rune of Sustenance', 'Izzet Charm', 'Lantern of the Lost', 'Blistercoil Weird', 'Drowned Secrets', 'Didn''t Say Please', 'Temple of Plenty', 'Game Trail', 'Grimdancer', 'Mistvein Borderpost', 'Hour of Promise', 'Condemn', 'Arch of Orazca', 'Mind''s Desire', 'Jaya Ballard', 'Snowfield Sinkhole', 'Ethereal Absolution', 'Ojutai''s Command', 'Saffi Eriksdotter', 'Harmless Offering', 'Lead the Stampede', 'Glimmerpost', 'Ramunap Excavator', 'Eater of Virtue', 'Verduran Enchantress', 'Cold-Eyed Selkie', 'Kefnet the Mindful', 'Evolving Door', 'Psychosis Crawler', 'Loxodon Smiter', 'Birds of Paradise', 'Fanatical Firebrand', 'Song-Mad Treachery', 'Primal Command', 'Ethersworn Canonist', 'Teferi, Mage of Zhalfir', 'Drossforge Bridge', 'Treasure Cruise', 'Touch the Spirit Realm', 'Upriser Renegade', 'Prowling Serpopard', 'Tome Scour', 'Murmuring Mystic', 'Voldaren Epicure', 'Banshee''s Blade', 'Sea Gate Wreckage', 'Zada''s Commando', 'Westvale Abbey', 'Overwhelming Splendor', 'Herald of the Pantheon', 'Engulf the Shore', 'Traumatize', 'Merfolk Secretkeeper', 'Honored Hydra', 'Buried Ruin', 'Incubation Druid', 'Sokenzan Smelter', 'Reckless Impulse', 'Glaze Fiend', 'Shadowmage Infiltrator', 'Arcbound Stinger', 'Out of Time', 'Sylvan Library', 'Karametra''s Favor', 'Auntie''s Snitch', 'Voltage Surge', 'Explore', 'Mistvault Bridge', 'Graveshifter', 'Temple of Epiphany', 'Judge''s Familiar', 'Ancient Stirrings', 'Deliberate', 'Haktos the Unscarred', 'Nameless Inversion', 'Bone Shards', 'Negate', 'Faithful Mending', 'Llanowar Wastes', 'Cyclone Summoner', 'Stirring Wildwood', 'Gitaxian Probe', 'Prodigal Sorcerer', 'Repeal', 'Unified Will', 'Base Camp', 'Outland Liberator', 'Orochi Merge-Keeper', 'Verdurous Gearhulk', 'Flame Slash', 'Codie, Vociferous Codex', 'Brave the Elements', 'Scrabbling Claws', 'Beastcaller Savant', 'Demigod of Revenge', 'Karmic Guide', 'Grave Strength', 'Cabal Therapist', 'Abrade', 'Garruk Wildspeaker', 'Unexpected Results', 'Llanowar Elves', 'Messenger''s Speed', 'Gadwick, the Wizened', 'Coiling Oracle', 'Manic Scribe', 'Hapatra, Vizier of Poisons', 'Sticky Fingers', 'Shriekmaw', 'Animate Dead', 'Chasm Skulker', 'Fury Charm', 'Thornglint Bridge', 'Opt', 'Heartless Act', 'Skyclave Cleric', 'Fieldmist Borderpost', 'Vampire''s Kiss', 'Reveillark', 'Dwynen''s Elite', 'Hagra Mauling', 'Abbot of Keral Keep', 'Bastion of Remembrance', 'Glorybringer', 'Temple of Deceit', 'Prism Ring', 'Kiln Fiend', 'Seaside Citadel', 'Elvish Archdruid', 'Augur of Bolas', 'Aetherspouts', 'Restore Balance', 'Mirrorshell Crab', 'Time Stretch', 'Earwig Squad', 'Into the Story', 'Pyroclasm', 'Temple of Enlightenment', 'Temmet, Vizier of Naktamun', 'Reckless Rage', 'Mindslaver', 'Raise the Draugr', 'Mire Triton', 'Fyndhorn Elves', 'Dream Trawler', 'Blowfly Infestation', 'Cruel Reality', 'Deathcap Cultivator', 'Cabal Interrogator', 'Colossal Skyturtle', 'Burst Lightning', 'Bala Ged Thief', 'Psychic Strike', 'Drowned Catacomb', 'Remorseful Cleric', 'Vampire Nighthawk', 'Zulaport Cutthroat', 'Disfigure', 'Delay', 'Skyshroud Forest', 'Magus of the Disk', 'Benevolent Bodyguard', 'Silundi Vision', 'Evolving Wilds', 'Homestead Courage', 'Dread Fugue', 'Wildfield Borderpost', 'Volcanic Salvo', 'Dark Ritual', 'Shalai, Voice of Plenty', 'Sacred Fire', 'Ruin Crab', 'Mercurial Chemister', 'Cathar Commando', 'Sky Terror', 'Opulent Palace', 'It That Betrays', 'Dust of Moments', 'Cumber Stone', 'Hada Freeblade', 'Okina, Temple to the Grandfathers', 'Vampire Envoy', 'Shaile, Dean of Radiance', 'Mesmeric Fiend', 'Dryad Militant', 'Peer Through Depths', 'Geomancer''s Gambit', 'Erebos''s Intervention', 'Quicken', 'Faithless Salvaging', 'Rustvale Bridge', 'Clifftop Retreat', 'Carnophage', 'Goldhound', 'Soul Warden', 'Tanglepool Bridge', 'Qasali Pridemage', 'Tectonic Giant', 'Fierce Retribution'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 60.5, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (65.4 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Force of Rage', 'Abzan Guide', 'Didn''t Say Please', 'Advent of the Wurm', 'Braids, Cabal Minion', 'Simic Signet', 'Destiny Spinner', 'Hanweir Garrison', 'Renegade Tactics', 'Jace, the Living Guildpact', 'Birds of Paradise', 'Tooth and Nail', 'Timeless Witness', 'Base Camp', 'General Ferrous Rokiric', 'Thopter Spy Network', 'Swiftwater Cliffs', 'Enlistment Officer', 'Tajic, Legion''s Edge', 'Fatestitcher', 'Blistercoil Weird', 'Famished Paladin', 'Goblin Electromancer', 'Fires of Yavimaya', 'Bramblewood Paragon', 'Tome Scour', 'Kiln Fiend', 'Faerie Miscreant', 'Drowned Secrets', 'Cumber Stone', 'Ornithopter', 'Gideon Jura', 'Medomai''s Prophecy', 'Grumgully, the Generous', 'Disallow', 'Memory''s Journey', 'Strike It Rich', 'Graf Harvest', 'Reckless Rage', 'Prickly Boggart', 'Drana''s Emissary', 'Voltage Surge', 'Fieldmist Borderpost', 'Mayor of Avabruck', 'Murderous Redcap', 'Fact or Fiction', 'Deliberate', 'Wilt-Leaf Liege', 'Rites of Flourishing', 'Ethereal Haze', 'Hieroglyphic Illumination', 'Jokulhaups', 'Hada Freeblade', 'Sokenzan Smelter', 'Cruel Reality', 'Faithful Mending', 'Vision Skeins', 'Sungold Sentinel', 'Proclamation of Rebirth', 'Mirran Crusader', 'Hymn to Tourach', 'Seal of Removal', 'Combine Chrysalis', 'Restore Balance', 'Temple of Malady', 'Jhoira''s Timebug', 'Earthshaker Khenra', 'Silverbluff Bridge', 'Gadwick, the Wizened', 'Fierce Retribution', 'Apex of Power', 'Bladestitched Skaab', 'Sterling Grove', 'Falkenrath Aristocrat', 'Rune of Sustenance', 'Arc Trail', 'Zada''s Commando', 'Suspend', 'Doubling Cube', 'Sanguine Statuette', 'Boomerang', 'Mesmeric Fiend', 'Garruk Wildspeaker', 'Azami, Lady of Scrolls', 'Champion of Wits', 'Mirrorshell Crab', 'Nameless Inversion', 'Michiko''s Reign of Truth', 'Crumbling Necropolis', 'Renewed Faith', 'Rally for the Throne', 'Mana Leak', 'Mephidross Vampire', 'Reckless Impulse', 'Saffi Eriksdotter', 'Fabricate', 'Viscera Seer', 'The Raven''s Warning', 'Zulaport Cutthroat', 'Fleecemane Lion', 'Daru Warchief', 'Glen Elendra Archmage', 'Aetherspouts', 'Satyr Wayfinder', 'Time Stretch', 'Honored Hydra', 'Trading Post', 'Hero of Precinct One', 'Battlefield Forge', 'Padeem, Consul of Innovation', 'Stern Dismissal', 'Mishra''s Factory', 'Shriekmaw', 'Temur Charm', 'Banisher Priest', 'Eiganjo Castle', 'Fire Covenant', 'Kor Blademaster', 'Disfigure', 'Snow-Covered Plains', 'Tendrils of Agony', 'Temple Bell', 'Prophet of Kruphix', 'Urza''s Factory', 'Song-Mad Treachery', 'Skyclave Cleric', 'Llanowar Elves', 'Adorned Pouncer', 'Fury Charm', 'Tangle', 'Search Party Captain', 'Jhoira of the Ghitu', 'Animate Dead', 'Sacred Fire', 'Changeling Outcast', 'Vault Skirge', 'Ondu War Cleric', 'Gitaxian Probe', 'Patchwork Automaton', 'Yusri, Fortune''s Flame', 'Goblin Anarchomancer', 'Firebrand Archer', 'Qasali Pridemage', 'Fiery Justice', 'Tamiyo''s Safekeeping', 'Glacial Fortress', 'Gird for Battle', 'Glaze Fiend', 'Alms of the Vein', 'Balustrade Spy', 'Temple of Epiphany', 'Kaya, Ghost Assassin', 'Hinterland Harbor', 'Out of Time', 'Incubation Druid', 'Merfolk Secretkeeper', 'Mercurial Chemister', 'Dissolve', 'Cold-Eyed Selkie', 'Ondu Cleric', 'Champion of the Parish', 'Bedlam Reveler', 'Gaze of Adamaro', 'Overwhelming Splendor', 'Cleansing Wildfire', 'Riveteers Charm', 'Disruptive Pitmage', 'Never // Return', 'Fyndhorn Elves', 'Glacial Ray', 'Vampire Envoy', 'Kitchen Imp', 'Quicken', 'Sidisi, Undead Vizier', 'Runeflare Trap', 'Sign in Blood', 'Logic Knot', 'Lead the Stampede', 'Dark Ritual', 'Arcbound Ravager', 'Bronzehide Lion', 'Teferi''s Ageless Insight', 'Tectonic Giant', 'Sylvan Library', 'Eternal Dragon', 'Pyrite Spellbomb', 'Arcbound Javelineer', 'Zabaz, the Glimmerwasp', 'Soul''s Attendant', 'Moon-Circuit Hacker', 'Dead // Gone', 'Grave Strength', 'Dispel', 'Nirkana Assassin', 'Valiant Changeling', 'Izzet Boilerworks', 'Pyretic Ritual', 'Talisman of Impulse', 'Barbarian Ring', 'Lys Alana Huntmaster', 'Sage''s Dousing', 'Mindslaver', 'Mogg War Marshal', 'Ranger of Eos', 'Chain Lightning', 'Ondu Inversion', 'Stirring Wildwood', 'Commit // Memory', 'Voldaren Epicure', 'Curse of Thirst', 'Stubborn Denial', 'Clarion Spirit', 'Sorcerous Spyglass', 'Dawn of Hope', 'Martyr''s Soul', 'Of One Mind', 'Steel Overseer', 'Grapeshot', 'Goblin Bushwhacker', 'Guttersnipe', 'Thought Erasure', 'Knucklebone Witch', 'Golgari Grave-Troll', 'Viashino Pyromancer', 'Rabbit Battery', 'Inevitable Betrayal', 'Engulf the Shore', 'Revitalize', 'Shrine of Burning Rage', 'Mind''s Desire', 'Thornglint Bridge', 'Ancestral Anger', 'Ral, Storm Conduit', 'Midnight Reaper', 'Spark Spray', 'Remorseful Cleric', 'Codie, Vociferous Codex', 'Secluded Glen', 'Dakmor Salvage', 'Foundry Street Denizen', 'Voidmage Prodigy', 'Woodland Cemetery', 'Raging Ravine', 'Silver-Fur Master', 'Joraga Warcaller', 'Duskwatch Recruiter', 'Curse of Death''s Hold', 'Powerstone Shard', 'Snow-Covered Swamp', 'Shock', 'Winds of Rebuke', 'Prismatic Lens', 'Temple of Mystery', 'Heartwood Storyteller', 'Verdurous Gearhulk', 'Rite of Oblivion', 'Planar Portal', 'Kunoros, Hound of Athreos', 'Infernal Grasp', 'Goblin Cratermaker', 'Abrade', 'Nested Shambler', 'Deathcap Cultivator', 'Metalwork Colossus', 'Ramunap Excavator', 'Touch the Spirit Realm', 'Tyrant''s Scorn', 'Fire-Lit Thicket', 'Colossal Skyturtle', 'Flametongue Kavu', 'Disciple of the Vault', 'Cruel Ultimatum', 'Loxodon Smiter', 'Teferi, Mage of Zhalfir', 'Trespasser''s Curse', 'Izzet Charm', 'Oran-Rief Ooze', 'Plargg, Dean of Chaos', 'Lochmere Serpent', 'Hotshot Mechanic', 'Linvala, Shield of Sea Gate', 'Ethereal Absolution', 'Ojutai''s Command', 'Rootbound Crag', 'Dragonskull Summit', 'Shalai, Voice of Plenty', 'Chance Encounter', 'Oracle of Mul Daya', 'Hour of Promise', 'Delay', 'Repeal', 'Reverent Hoplite', 'Jaya Ballard', 'Dream Trawler', 'Temmet, Vizier of Naktamun', 'Jadelight Ranger', 'Quest for the Holy Relic', 'Dissipate', 'Brokers Hideout', 'Duress', 'Secluded Courtyard', 'Geomancer''s Gambit', 'Ravenous Squirrel', 'Thraben Inspector', 'Entrancing Melody', 'Midnight Clock', 'Favored Hoplite', 'Temple of Deceit', 'Nightshade Stinger', 'Wooded Bastion', 'Dimir Charm', 'Dust of Moments', 'Field of Ruin', 'Figure of Destiny', 'Deep Analysis', 'Illuminator Virtuoso', 'Arcbound Mouser', 'Ritual of Soot', 'Cabal Interrogator', 'Experimental Synthesizer', 'Lich Lord of Unx', 'Bastion of Remembrance', 'Forgotten Cave', 'Opt', 'Hero of Iroas', 'Blisterpod', 'Phyrexian Dreadnought', 'Bump in the Night', 'Ghor-Clan Rampager', 'Okina, Temple to the Grandfathers', 'Curiosity', 'Smiting Helix', 'Invigorating Hot Spring', 'Heliod''s Pilgrim', 'Thirst for Discovery', 'Hostage Taker', 'Vault of the Archangel', 'Chain Reaction', 'Varragoth, Bloodsky Sire', 'Frontier Bivouac', 'Sky Terror', 'Prowling Serpopard', 'Launch the Fleet', 'Vedalken Aethermage', 'Sea Gate Wreckage', 'Riptide Laboratory', 'Beast Whisperer', 'Ezuri, Renegade Leader', 'Homestead Courage', 'Intangible Virtue', 'Tyrant''s Choice', 'Improbable Alliance', 'Jolrael, Mwonvuli Recluse', 'Sleep', 'Splinterfright', 'Dread Return', 'Karametra''s Favor', 'Firebolt', 'Sidisi, Brood Tyrant', 'Grenzo, Dungeon Warden', 'Dictate of Kruphix', 'Last Breath', 'Icehide Golem', 'Cathar Commando', 'Death Baron', 'Tarfire', 'Goblin Assault', 'Glorybringer', 'Trostani''s Summoner', 'Oviya Pashiri, Sage Lifecrafter', 'Spikefield Hazard', 'Radha, Heart of Keld', 'One with the Machine', 'Thought Scour', 'Agonizing Remorse', 'Oblivion Ring', 'Blade Splicer', 'Sleight of Hand', 'Ajani''s Pridemate', 'Mistvault Bridge', 'Behold the Multiverse', 'Upheaval', 'Sigrid, God-Favored', 'Howling Mine', 'Prism Ring', 'Neutralize', 'Gravitational Shift', 'Thundering Raiju', 'Epochrasite', 'Peer Through Depths', 'Trinket Mage', 'Gavony Township', 'Sylvan Primordial', 'Greater Gargadon', 'Akroma, Angel of Fury', 'Quicksilver Fountain', 'Shigeki, Jukai Visionary', 'Immortal Coil', 'Temple of Triumph', 'Triskaidekaphile', 'Razortide Bridge', 'Vampire''s Kiss', 'Heartless Act', 'Gods Willing', 'Zurgo Bellstriker', 'Fiery Gambit', 'Cauldron Haze', 'Kor Duelist', 'Raise the Draugr', 'Restoration Angel', 'Ghost Quarter', 'Into the Story', 'Judith, the Scourge Diva', 'Walking Skyscraper', 'Psychic Strike', 'Experimental Overload', 'Mikokoro, Center of the Sea', 'Reveillark', 'Lavaclaw Reaches', 'Drowned Catacomb', 'Mirari''s Wake', 'Augur of Bolas', 'Mutilate', 'Forked Bolt', 'Galvanic Relay', 'Goldmire Bridge', 'General''s Enforcer', 'Dire Tactics', 'Vendetta', 'Drossforge Bridge', 'Dimir Aqueduct', 'Awakening Zone', 'Volcanic Salvo', 'Bone Shards', 'Midnight Guard', 'Bloodchief''s Thirst', 'Dream Twist', 'Arcane Sanctum', 'Golgari Brownscale', 'Odds // Ends', 'Erebos''s Intervention', 'Kazandu Blademaster', 'Undercity Informer', 'Primal Command', 'Swiftblade Vindicator', 'Knight of the Reliquary', 'Scout''s Warning', 'Mirror Entity', 'Piranha Marsh', 'Arcbound Worker', 'Herald of the Pantheon', 'Abiding Grace', 'Faerie Vandal', 'Blood Fountain', 'Argentum Armor', 'Coalition Relic', 'Diregraf Captain', 'Stinkdrinker Bandit', 'Blightning', 'Pyroclasm', 'Slagwoods Bridge', 'Double Vision', 'Thaumatic Compass', 'Explore', 'Think Twice', 'Saproling Burst', 'Triskelion', 'Captain of the Watch', 'Frostwalk Bastion', 'Castigate', 'Outland Liberator', 'Hissing Quagmire', 'Silence', 'Malakir Rebirth', 'Blastoderm', 'Reckless Charge', 'Prophetic Prism', 'Weapons Trainer', 'Exhaustion', 'Orim''s Chant', 'Elvish Archdruid', 'Haktos the Unscarred', 'Nether Traitor', 'Electrolyze', 'Ghitu Lavarunner', 'Kor Skyfisher', 'Chaplain of Alms', 'Abbot of Keral Keep', 'Feed the Swarm', 'Ominous Seas', 'Lantern of the Lost', 'Firewild Borderpost', 'Keeper of the Dead', 'Traumatize', 'Eldrazi Conscription', 'Tomb of Urami', 'Selesnya Charm', 'Forbid', 'Defiant Strike', 'Shivan Wurm', 'Unexpected Results', 'Stone Rain', 'Ponder', 'Slip Out the Back', 'Dauntless Bodyguard', 'Judge''s Familiar', 'Reliquary Tower', 'Tribute Mage', 'Blighted Agent', 'Thousand-Faced Shadow', 'Mistvein Borderpost', 'Vedalken Anatomist', 'Mogg Fanatic', 'Bala Ged Thief', 'Fire Urchin', 'Signal Pest', 'Tymaret, Chosen from Death', 'Sejiri Shelter', 'Lose Focus', 'Jack-o''-Lantern', 'Hapatra, Vizier of Poisons', 'Tithe Taker', 'Tanglepool Bridge', 'Verdant Command', 'Evolving Wilds', 'Zhalfirin Void', 'Martyr of Sands', 'Needle Spires', 'Mikaeus, the Lunarch', 'Kazandu Mammoth', 'Dauntless Escort', 'Bygone Bishop', 'Festival Crasher', 'Unsubstantiate', 'Murmuring Mystic', 'Foundation Breaker', 'Bloodtithe Harvester', 'Spatial Contortion', 'Preeminent Captain', 'Kami of False Hope', 'Decree of Justice', 'Arcbound Stinger', 'Grim Lavamancer', 'Demigod of Revenge', 'Step Through', 'Rustvale Bridge', 'Tyrant of Discord', 'Master of Death', 'Carnophage', 'Auntie''s Snitch', 'Frantic Inventory', 'Seaside Citadel', 'Slagstorm', 'Game Trail', 'Curse of Misfortunes', 'Orcish Vandal', 'Burst Lightning', 'Scrabbling Claws', 'Sky Hussar', 'See the Truth', 'Liliana Vess', 'Memory Lapse', 'Sarkhan, the Dragonspeaker', 'Tavern Scoundrel', 'Orochi Merge-Keeper', 'Elves of Deep Shadow', 'Giant Killer', 'Manic Scribe', 'Navigator''s Compass', 'Shaile, Dean of Radiance', 'Day of Judgment', 'Fevered Visions', 'Pack Rat', 'The Birth of Meletis', 'Eater of Virtue', 'Cabal Therapist', 'Terastodon', 'Lord of the Undead', 'Ethersworn Canonist', 'Distended Mindbender', 'Edric, Spymaster of Trest', 'Magus of the Disk', 'Jwari Disruption', 'Char', 'Coiling Oracle', 'Eaten Alive', 'Fanatical Firebrand', 'Evolving Door', 'Warren Weirding', 'Doomed Traveler', 'Throne of Geth', 'Throes of Chaos', 'Graveshifter', 'Cerodon Yearling', 'Veinfire Borderpost', 'Animation Module', 'Blazing Rootwalla', 'Temple of Silence', 'Llanowar Wastes', 'Westvale Abbey', 'Growth-Chamber Guardian', 'Sticky Fingers', 'Strionic Resonator', 'Dramatic Finale', 'Trade Secrets', 'Ancient Stirrings', 'Oust', 'Fodder Launch', 'Phoenix of Ash', 'Fiery Temper', 'Sower of Temptation', 'Isareth the Awakener', 'Sandwurm Convergence', 'Krark''s Thumb', 'Chandra, Pyromaster', 'Sylvan Scrying', 'Dive Down', 'Buried Ruin', 'Prodigal Sorcerer', 'Universal Automaton', 'Upriser Renegade', 'Goblin Instigator', 'Lizard Blades', 'Pelakka Predation', 'Goldhound', 'Caves of Koilos', 'Brave the Elements', 'It That Betrays', 'Reality Ripple', 'Journeyer''s Kite', 'Angel of Glory''s Rise', 'Kira, Great Glass-Spinner', 'Beastcaller Savant', 'Faithless Salvaging', 'Worldgorger Dragon', 'Akroma''s Blessing', 'Detention Sphere', 'Glimmerpost', 'Snowfield Sinkhole', 'Secluded Steppe', 'Vampire Nighthawk', 'Shreds of Sanity', 'Hedron Archive', 'Kefnet the Mindful', 'Shardless Agent', 'Prosperous Thief', 'Glint Hawk', 'Phantasmagorian', 'Ash Zealot', 'Nyx Lotus', 'Skyshroud Forest', 'Blossoming Sands', 'Frantic Search', 'Lava Dart', 'Fauna Shaman', 'Goblin Matron', 'Elvish Mystic', 'Karmic Guide', 'Elixir of Immortality', 'Slaughter Games', 'Pentarch Ward', 'Treasure Cruise', 'Keldon Marauders', 'Solitary Confinement', 'Crash Through', 'Archfiend''s Vessel', 'Terminus', 'Primal Forcemage', 'Skyclave Shade', 'Pillage', 'Vesperlark', 'Verduran Enchantress', 'Curse of Stalked Prey', 'Compulsive Research', 'Power Conduit', 'Bloodbraid Elf', 'Captain''s Claws', 'Wonder', 'Dizzy Spell', 'Lashwrithe', 'Laboratory Maniac', 'Alesha, Who Smiles at Death', 'Stromkirk Noble', 'Watcher for Tomorrow', 'Flickerform', 'Captain Lannery Storm', 'Benevolent Bodyguard', 'Bala Ged Recovery', 'Zulaport Chainmage', 'Wayward Guide-Beast', 'Ethersworn Sphinx', 'Void Snare', 'Time of Ice', 'Murderous Cut', 'Startled Awake', 'Ruin Crab', 'Soul Warden', 'Clifftop Retreat', 'Wrath of God', 'Jukai Naturalist', 'Mire Triton', 'Avacyn''s Pilgrim', 'Hagra Mauling', 'Cloudpost', 'Phyrexian Revoker', 'Goblin Bombardment', 'Sylvan Advocate', 'Silundi Vision', 'Niv-Mizzet, the Firemind', 'Lonely Sandbar', 'Lost Auramancers', 'Banshee''s Blade', 'Delver of Secrets', 'Astral Drift', 'Kjeldoran Outpost', 'Flame Slash', 'Demonic Embrace', 'Ingenious Infiltrator', 'Kick in the Door', 'Temple of Enlightenment', 'Dryad Militant', 'Stingscourger', 'Seething Song', 'Negate', 'Ral Zarek', 'Feat of Resistance', 'Maestros Theater', 'Blackbloom Rogue', 'Unlucky Witness', 'Servo Exhibition', 'Mouth of Ronom', 'Wildfield Borderpost', 'Evangel of Heliod', 'Lapse of Certainty', 'Astral Slide', 'Runed Halo', 'Unified Will', 'Barren Moor', 'Spell Pierce', 'Demonic Dread', 'Goblin Chieftain', 'Nuisance Engine', 'Rix Maadi Reveler', 'Trickbind', 'Diregraf Ghoul', 'Raise the Alarm', 'Blowfly Infestation', 'Fallen Shinobi', 'Darkmoss Bridge', 'Stonybrook Angler', 'Temple of Plenty', 'Blazing Shoal', 'Open the Armory', 'Dennick, Pious Apprentice', 'Grimdancer', 'Banefire', 'Harmless Offering', 'Incinerate', 'Mistveil Plains', 'Snow-Covered Mountain', 'Putrid Imp', 'Magus of the Abyss', 'Shadowmage Infiltrator', 'Fling', 'Eye of Nowhere', 'Elemental Mastery', 'Skybridge Towers', 'Presence of Gond', 'Obliterate', 'Fraying Sanity', 'Mantis Rider', 'Dwynen''s Elite', 'Mistcutter Hydra', 'Chasm Skulker', 'Gatekeeper of Malakir', 'Sorin''s Vengeance', 'Rakdos Cackler', 'Arch of Orazca', 'Opulent Palace', 'Frogtosser Banneret', 'Invoke Calamity', 'Jace, Memory Adept', 'Wall of Omens', 'Benalish Marshal', 'Kumano Faces Kakkazan', 'Mystifying Maze', 'Nomad Outpost', 'Cyclone Summoner', 'Deprive', 'Mind Funeral', 'Muddle the Mixture', 'Messenger''s Speed', 'Impostor of the Sixth Pride', 'Earwig Squad', 'Bankrupt in Blood', 'Cloudshift', 'Garth One-Eye', 'Lumbering Falls', 'Canyon Slough', 'Timely Reinforcements', 'Mangara of Corondor', 'Pia and Kiran Nalaar', 'Chemister''s Insight', 'Goblin Dark-Dwellers', 'Shielding Plax', 'Snow-Covered Forest', 'Field Marshal', 'Vindicate', 'Austere Command', 'Psychosis Crawler', 'Desperate Ritual', 'Crib Swap', 'Brokers Charm', 'Rakdos Headliner', 'Realm Razer', 'Obscura Storefront', 'Cosmos Elixir', 'Tangled Florahedron', 'Skirk Prospector', 'Tranquil Cove', 'Oni-Cult Anvil', 'Hypnotic Specter', 'Condemn', 'Kessig Flamebreather', 'Kabira Takedown', 'Raze the Effigy', 'Foreboding Ruins', 'Barrin, Tolarian Archmage', 'Dread Fugue', 'Shrapnel Blast', 'Nevermore', 'Yahenni''s Expertise', 'Goblin Ringleader', 'Spiraling Embers', 'Caged Sun', 'Mystic Monastery', 'Bazaar Trader', 'Zulaport Duelist', 'Batterbone', 'Tempered Steel', 'Scab-Clan Berserker', 'Grisly Salvage', 'Court Homunculus', 'Collateral Damage'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 65.4, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (73.1 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Preeminent Captain', 'Goblin Instigator', 'Hagra Mauling', 'Arcbound Stinger', 'Viscera Seer', 'Champion of the Parish', 'Growing Rites of Itlimoc', 'Firewild Borderpost', 'Dimir Aqueduct', 'Compulsive Research', 'Shardless Agent', 'Zulaport Cutthroat', 'Sidisi, Undead Vizier', 'Heartless Act', 'Vicious Rumors', 'Hanweir Garrison', 'Golgari Brownscale', 'Forked Bolt', 'Cryptolith Rite', 'Earwig Squad', 'Captain Lannery Storm', 'Jungle Hollow', 'Earthshaker Khenra', 'Ethereal Absolution', 'Fevered Visions', 'Universal Automaton', 'Jack-o''-Lantern', 'Crash Through', 'Plargg, Dean of Chaos', 'Ondu Cleric', 'Kessig Flamebreather', 'Midnight Guard', 'Didn''t Say Please', 'Satyr Wayfinder', 'Tome Scour', 'Into the Story', 'Dwynen''s Elite', 'Stern Dismissal', 'Dragonskull Summit', 'Hymn to Tourach', 'Ruin Crab', 'Prophetic Prism', 'Firebrand Archer', 'Brokers Hideout', 'Grave Pact', 'Peer Through Depths', 'Intangible Virtue', 'Mantis Rider', 'Skyclave Shade', 'Rakdos Cackler', 'Nether Traitor', 'Nightshade Stinger', 'Chain Reaction', 'Stingscourger', 'Hypnotic Specter', 'Oran-Rief Ooze', 'Chandra, Fire Artisan', 'Undead Butler', 'Cerodon Yearling', 'Banisher Priest', 'Jwari Disruption', 'Biting-Palm Ninja', 'Crumbling Necropolis', 'Curse of Misfortunes', 'Drana''s Emissary', 'Vampire of the Dire Moon', 'Fiery Temper', 'Hostage Taker', 'Woodland Cemetery', 'Frostwalk Bastion', 'Dimir Charm', 'Spikefield Hazard', 'Greater Gargadon', 'Sandwurm Convergence', 'Walking Skyscraper', 'Ancestral Anger', 'Pelakka Predation', 'Memory Lapse', 'Flame Rift', 'Worldgorger Dragon', 'Angel of Grace', 'Drossforge Bridge', 'Blackbloom Rogue', 'Goblin Cratermaker', 'Famished Paladin', 'Thirst for Discovery', 'Game Trail', 'Mogg Fanatic', 'Archaeomancer', 'Kazandu Mammoth', 'Buried Alive', 'Open the Armory', 'Think Twice', 'Elvish Mystic', 'Cleansing Nova', 'Goblin Bombardment', 'Harmless Offering', 'Temple of Mystery', 'Verduran Enchantress', 'Mystifying Maze', 'Sower of Temptation', 'Slaughter Specialist', 'Rakdos Headliner', 'Pack Rat', 'Lapse of Certainty', 'Riptide Laboratory', 'Catacomb Sifter', 'Goblin Bushwhacker', 'Nameless Inversion', 'Demigod of Revenge', 'Mire Triton', 'Forgotten Cave', 'Keeper of the Dead', 'Ondu War Cleric', 'Drowned Catacomb', 'Megrim', 'Planar Portal', 'Thornglint Bridge', 'Dissipate', 'Frantic Inventory', 'Harrow', 'Wonder', 'Seal of Removal', 'Hieroglyphic Illumination', 'Zulaport Chainmage', 'Sleep', 'Fodder Launch', 'Brain Freeze', 'Ghostly Flicker', 'Lavaclaw Reaches', 'Fire-Lit Thicket', 'Primal Command', 'Late to Dinner', 'Upriser Renegade', 'Silundi Vision', 'Tyrant''s Scorn', 'Kabira Takedown', 'Bedlam Reveler', 'Spatial Contortion', 'The Flame of Keld', 'The Raven''s Warning', 'Vryn Wingmare', 'Secluded Courtyard', 'Evolving Wilds', 'Mistvein Borderpost', 'Lord of the Undead', 'Barrin, Tolarian Archmage', 'Adorned Pouncer', 'Foundation Breaker', 'Bala Ged Recovery', 'Orcish Vandal', 'Disallow', 'Destiny Spinner', 'Dramatic Finale', 'Last Breath', 'Anguished Unmaking', 'Benevolent Bodyguard', 'Teferi, Mage of Zhalfir', 'Battlefield Forge', 'Drowned Secrets', 'Impostor of the Sixth Pride', 'Nuisance Engine', 'Cabal Therapist', 'Clackbridge Troll', 'Hinterland Harbor', 'Dauntless Bodyguard', 'Agonizing Remorse', 'Jace, Memory Adept', 'Time Stretch', 'Barren Moor', 'Primal Forcemage', 'Isareth the Awakener', 'Judith, the Scourge Diva', 'Ghitu Lavarunner', 'Bazaar Trader', 'Cruel Reality', 'Goblin Ringleader', 'Chandra, Pyromaster', 'Mirran Crusader', 'Bone Shards', 'Kitchen Imp', 'Fleecemane Lion', 'Snow-Covered Swamp', 'Izzet Charm', 'Condemn', 'Foreboding Ruins', 'Thaumatic Compass', 'Splinterfright', 'Disruptive Pitmage', 'Bladestitched Skaab', 'The Scorpion God', 'Woodfall Primus', 'Eater of Virtue', 'Tribute Mage', 'Secluded Steppe', 'Skyclave Cleric', 'Shrapnel Blast', 'Reverent Hoplite', 'Dakmor Salvage', 'Kor Duelist', 'Suspend', 'Field of Ruin', 'Rootbound Crag', 'Sarkhan, the Dragonspeaker', 'Aetherspouts', 'Jhoira of the Ghitu', 'Delver of Secrets', 'Acolyte of Affliction', 'Akoum Warrior', 'Tendrils of Agony', 'Ash Zealot', 'Decree of Justice', 'Edric, Spymaster of Trest', 'Ethersworn Sphinx', 'Hour of Promise', 'Faerie Vandal', 'Faithful Mending', 'Logic Knot', 'Base Camp', 'Crib Swap', 'Jukai Naturalist', 'Blood Fountain', 'Kefnet the Mindful', 'Overwhelming Splendor', 'Ramunap Excavator', 'Dennick, Pious Apprentice', 'Fling', 'Entrancing Melody', 'Arcane Sanctum', 'Grenzo, Dungeon Warden', 'Barbarian Ring', 'Kazandu Blademaster', 'Gadwick, the Wizened', 'Sigrid, God-Favored', 'Soul''s Attendant', 'Orochi Merge-Keeper', 'Mistcutter Hydra', 'Brokers Charm', 'Eldrazi Conscription', 'Timely Reinforcements', 'Fires of Yavimaya', 'Knight Exemplar', 'Magus of the Disk', 'Elemental Mastery', 'Cyclone Summoner', 'Birds of Paradise', 'Liliana Vess', 'Fatestitcher', 'It That Betrays', 'Foundry Street Denizen', 'Never // Return', 'Prowling Serpopard', 'Kor Blademaster', 'Temple of Silence', 'Autumn''s Veil', 'Coiling Oracle', 'Vedalken Aethermage', 'Ingenious Infiltrator', 'Karmic Guide', 'Behold the Multiverse', 'Zurgo Bellstriker', 'Rune of Sustenance', 'Cruel Ultimatum', 'Alms of the Vein', 'Ponder', 'Revitalize', 'Raise the Alarm', 'Cloudshift', 'Infernal Grasp', 'Mangara of Corondor', 'Fauna Shaman', 'Elvish Archdruid', 'Demonic Dread', 'Cold-Eyed Selkie', 'Experimental Overload', 'Urza''s Factory', 'Detention Sphere', 'Day of Judgment', 'Canyon Slough', 'Springbloom Druid', 'Bloodtithe Harvester', 'Raven''s Crime', 'Immortal Coil', 'Fury Charm', 'Arcbound Worker', 'Courier''s Briefcase', 'Doubling Cube', 'Tangled Florahedron', 'Bastion of Remembrance', 'Knight of the Reliquary', 'Ob Nixilis, the Fallen', 'Padeem, Consul of Innovation', 'Martyr of Sands', 'Ancient Stirrings', 'Dust of Moments', 'Grimdancer', 'Experimental Synthesizer', 'Brave the Elements', 'Dead // Gone', 'Desperate Ritual', 'Dictate of Kruphix', 'Knucklebone Witch', 'Glen Elendra Archmage', 'Field Marshal', 'Goblin Electromancer', 'Sylvan Advocate', 'Banefire', 'Hushwing Gryff', 'Buried Ruin', 'Drown in Sorrow', 'Llanowar Wastes', 'Prismatic Lens', 'Death Baron', 'March of Burgeoning Life', 'Blazing Shoal', 'Raging Ravine', 'Glorybringer', 'Outland Liberator', 'Oust', 'Smothering Abomination', 'Lava Dart', 'Curse of Exhaustion', 'Quicken', 'Suffocating Fumes', 'Pentarch Ward', 'Lumbering Falls', 'Renegade Tactics', 'Mistvault Bridge', 'Sign in Blood', 'Metalwork Colossus', 'Castigate', 'Shaile, Dean of Radiance', 'Hapatra, Vizier of Poisons', 'Evangel of Heliod', 'Rally for the Throne', 'Spell Pierce', 'Jaya Ballard', 'Fieldmist Borderpost', 'Faerie Miscreant', 'Glacial Fortress', 'Duress', 'Prism Ring', 'Bygone Bishop', 'Sporoloth Ancient', 'Piranha Marsh', 'Sejiri Shelter', 'Trespasser''s Curse', 'Azami, Lady of Scrolls', 'Void Snare', 'Temple of Malady', 'Scrapheap Scrounger', 'Gideon Jura', 'Nivmagus Elemental', 'Runeflare Trap', 'Colossal Skyturtle', 'Bankrupt in Blood', 'Unified Will', 'Zhalfirin Void', 'Garruk Wildspeaker', 'Hada Freeblade', 'Liliana''s Caress', 'Saffi Eriksdotter', 'Disciple of the Vault', 'Leechridden Swamp', 'Yahenni''s Expertise', 'Augur of Bolas', 'Behold the Unspeakable', 'Shard Volley', 'Glaze Fiend', 'Ravenous Squirrel', 'Mutilate', 'Sleight of Hand', 'Angel of Glory''s Rise', 'Voldaren Epicure', 'Deathcap Cultivator', 'Agony Warp', 'Joraga Warcaller', 'Weapons Trainer', 'Sage''s Dousing', 'Vendetta', 'Banshee''s Blade', 'Deliberate', 'Tanglepool Bridge', 'Remorseful Cleric', 'Memory''s Journey', 'Muddle the Mixture', 'Incinerate', 'Mesmeric Fiend', 'Shadowmage Infiltrator', 'Blastoderm', 'Golgari Germination', 'Obscura Storefront', 'Pyrite Spellbomb', 'Jhoira''s Timebug', 'Hornet Queen', 'Vision Skeins', 'Magus of the Abyss', 'Faithless Salvaging', 'Electric Revelation', 'Selesnya Charm', 'Hissing Quagmire', 'Bump in the Night', 'Quest for the Nihil Stone', 'Negate', 'Nyx Lotus', 'Cauldron Haze', 'Reckless Charge', 'Heliod''s Pilgrim', 'Gitaxian Probe', 'Nightscape Familiar', 'Galvanic Relay', 'Sky Terror', 'Wrath of God', 'Vampire Nighthawk', 'Power Conduit', 'Mogg War Marshal', 'Winds of Rebuke', 'Falkenrath Aristocrat', 'Wild Cantor', 'Firebolt', 'Mirari''s Wake', 'Tectonic Giant', 'Sticky Fingers', 'Seaside Citadel', 'Temple of Enlightenment', 'Chemister''s Insight', 'Swiftblade Vindicator', 'Vampire Envoy', 'Tithe Taker', 'Zulaport Duelist', 'Blisterpod', 'Displace', 'Sacred Fire', 'Varragoth, Bloodsky Sire', 'Accorder Paladin', 'Mishra''s Factory', 'Wildfield Borderpost', 'Cremate', 'Jokulhaups', 'Double Vision', 'Journeyer''s Kite', 'Seething Song', 'Chain Lightning', 'Valiant Changeling', 'Improbable Alliance', 'Temmet, Vizier of Naktamun', 'Thallid Germinator', 'Disfigure', 'Tajic, Legion''s Edge', 'Quicksilver Fountain', 'Favored Hoplite', 'Sea Gate Oracle', 'Silence', 'Pyromancer''s Swath', 'Nezahal, Primal Tide', 'Deathspore Thallid', 'Burst Lightning', 'Oracle of Mul Daya', 'Fanatical Firebrand', 'Runed Halo', 'Thundering Raiju', 'Gird for Battle', 'Evolving Door', 'Westvale Abbey', 'Forsake the Worldly', 'Illuminator Virtuoso', 'Mirror Entity', 'Jolrael, Mwonvuli Recluse', 'Lantern of the Lost', 'Wrench Mind', 'Shreds of Sanity', 'Glimmerpost', 'Grapeshot', 'Animate Dead', 'Lost Auramancers', 'Herald of the Pantheon', 'Angel of Despair', 'Braids, Cabal Minion', 'Champion of Wits', 'Sokenzan Smelter', 'Gavony Township', 'Radiant Scrollwielder', 'Garth One-Eye', 'General Ferrous Rokiric', 'Jewel Thief', 'Mercurial Chemister', 'Unexpected Results', 'Frogtosser Banneret', 'Lys Alana Huntmaster', 'Skyshroud Forest', 'Traumatize', 'Nyxathid', 'Dream Salvage', 'Lashwrithe', 'Edge of Autumn', 'Frontier Bivouac', 'Blistercoil Weird', 'See the Truth', 'Karametra''s Favor', 'Judge''s Familiar', 'Growth-Chamber Guardian', 'Fiery Justice', 'Trostani''s Summoner', 'Deep Analysis', 'Nevermore', 'Kira, Great Glass-Spinner', 'Sanguine Statuette', 'Bloodchief''s Thirst', 'Shalai, Voice of Plenty', 'Heartwood Storyteller', 'Balustrade Spy', 'Blowfly Infestation', 'Timeless Witness', 'Darkmoss Bridge', 'Honor of the Pure', 'Figure of Destiny', 'Pyretic Ritual', 'Codie, Vociferous Codex', 'Blazing Rootwalla', 'Kunoros, Hound of Athreos', 'Stonybrook Angler', 'Song-Mad Treachery', 'Mire''s Toll', 'Launch the Fleet', 'Silverbluff Bridge', 'Graveshifter', 'Goblin Anarchomancer', 'Hero of Precinct One', 'Fyndhorn Elves', 'Mistveil Plains', 'Soul Warden', 'Curiosity', 'Touch the Spirit Realm', 'Chasm Skulker', 'Voltage Surge', 'Thousand-Faced Shadow', 'Nested Shambler', 'Explore', 'Murderous Cut', 'Wooded Bastion', 'Qasali Pridemage', 'Cleansing Wildfire', 'Utopia Mycon', 'Caves of Koilos', 'Ritual of Soot', 'Grumgully, the Generous', 'Invoke Calamity', 'Austere Command', 'Fierce Retribution', 'Tomb of Urami', 'Jace, the Living Guildpact', 'Wall of Omens', 'Scrabbling Claws', 'Secluded Glen', 'Magister of Worth', 'Watcher for Tomorrow', 'Sylvan Primordial', 'Captain''s Claws', 'Riveteers Overlook', 'Epochrasite', 'Talisman of Curiosity', 'Caged Sun', 'Slagwoods Bridge', 'Fact or Fiction', 'Stirring Wildwood', 'Slagstorm', 'Keldon Marauders', 'Warren Weirding', 'Sungold Sentinel', 'Mayor of Avabruck', 'Unlucky Witness', 'Ghor-Clan Rampager', 'Elixir of Immortality', 'Abbot of Keral Keep', 'Ajani''s Pridemate', 'Silver-Fur Master', 'Phyrexian Dreadnought', 'Reckoner''s Bargain', 'Bala Ged Thief', 'Raze the Effigy', 'Search Party Captain', 'Esper Charm', 'Mind''s Desire', 'Gatekeeper of Malakir', 'Cumber Stone', 'Messenger''s Speed', 'Haktos the Unscarred', 'Opulent Palace', 'Zada''s Commando', 'Needle Spires', 'Vedalken Anatomist', 'Clifftop Retreat', 'Mystic Monastery', 'Riveteers Charm', 'Opt', 'Midnight Reaper', 'Slaughter Pact', 'Avacyn''s Pilgrim', 'Prophet of Kruphix', 'Assault Strobe', 'Grave Strength', 'Lead the Stampede', 'Venerable Knight', 'Nirkana Assassin', 'Spring-Leaf Avenger', 'Vampire''s Kiss', 'Orim''s Chant', 'Sylvan Scrying', 'Shielding Plax', 'Honored Hydra', 'Psychosis Crawler', 'Goblin Dark-Dwellers', 'Captain of the Watch', 'Dire Tactics', 'Otherworldly Gaze', 'Pia and Kiran Nalaar', 'Cloudpost', 'Flametongue Kavu', 'Feat of Resistance', 'Oni-Cult Anvil', 'Rustvale Bridge', 'Eternal Dragon', 'Teferi''s Ageless Insight', 'Blossoming Sands', 'Cruel Edict', 'Chaplain of Alms', 'Scout''s Warning', 'Snow-Covered Forest', 'Undercity Informer', 'Hokori, Dust Drinker', 'Step Through', 'Night of Souls'' Betrayal', 'Tymaret, Chosen from Death', 'Thopter Spy Network', 'Okina, Temple to the Grandfathers', 'Pyroclasm', 'Medomai''s Prophecy', 'Time of Ice', 'Tainted Strike', 'Commune with the Gods', 'Lizard Blades', 'Bloodbraid Elf', 'Phoenix of Ash', 'Mind Funeral', 'Golgari Grave-Troll', 'Lochmere Serpent', 'Char', 'Thallid Shell-Dweller', 'Vindicate', 'Goldhound', 'Ominous Seas', 'Reality Ripple', 'Flame Slash', 'Psychotrope Thallid', 'Lonely Sandbar', 'Raise the Draugr', 'Carnophage', 'Dream Twist', 'Arcbound Ravager', 'Electrolyze', 'Graf Harvest', 'Diregraf Captain', 'Engulf the Shore', 'Awakening Zone', 'Llanowar Elves', 'Tranquil Cove', 'Cathar Commando', 'Gods Willing', 'Jadelight Ranger', 'Blade Splicer', 'Dissolve', 'Changeling Outcast', 'Commit // Memory', 'Verdant Command', 'Linvala, the Preserver', 'Sorin''s Vengeance', 'Dream Trawler', 'Ethersworn Canonist', 'Blessed Alliance', 'Midnight Clock', 'Lich Lord of Unx', 'Smiting Helix', 'Tamiyo''s Safekeeping', 'Izzet Boilerworks', 'Kiln Fiend', 'Saproling Burst', 'Dread Return', 'Lose Focus', 'Shrieking Affliction', 'Skybridge Towers', 'General''s Enforcer', 'Sidisi, Brood Tyrant', 'Voidmage Prodigy', 'Master of Death', 'Grisly Salvage', 'Forbid', 'Smokestack', 'Shriekmaw', 'Ondu Inversion', 'Gravitational Shift', 'Duskwatch Recruiter', 'Rule of Law', 'Serrated Scorpion', 'Daru Warchief', 'Shivan Wurm', 'Snow-Covered Plains', 'Endless Horizons', 'Haunted Dead', 'Ojutai''s Command', 'Thought Erasure', 'Beastcaller Savant', 'Dark Ritual', 'Wayward Guide-Beast', 'Temple of Triumph', 'Lightning Axe', 'Mirrorshell Crab', 'Savannah Lions', 'Goblin Matron', 'Repeal', 'Dihada''s Ploy', 'Fiend Hunter', 'Combine Chrysalis', 'Arch of Orazca', 'Erebos''s Intervention', 'Sea Gate Wreckage', 'Steel Hellkite', 'Geomancer''s Gambit', 'Diregraf Ghoul', 'Phantasmagorian', 'Eiganjo Castle', 'Goblin Chieftain', 'Mana Leak', 'Snowfield Sinkhole', 'Trickbind', 'Maestros Theater', 'Hunted Nightmare', 'Strike It Rich', 'Student of Warfare', 'Treasure Cruise', 'Snow-Covered Mountain', 'Sandsteppe Citadel', 'Blighted Agent', 'Debt to the Kami', 'Sunset Revelry', 'Murderous Redcap', 'Feed the Swarm', 'Elves of Deep Shadow', 'Dread Fugue', 'Dread Presence', 'Benalish Marshal', 'Fabricate', 'Prodigal Sorcerer', 'Reckless Rage', 'Akuta, Born of Ash', 'Illness in the Ranks', 'Asylum Visitor', 'Auntie''s Snitch', 'Chainer, Nightmare Adept', 'Slip Out the Back', 'Fraying Sanity', 'Frantic Search', 'Hero of Iroas', 'Bramblewood Paragon', 'Out of Time', 'Mouth of Ronom', 'Obstinate Baloth', 'Collateral Damage', 'Inevitable Betrayal', 'Dryad Militant', 'Triskaidekaphile', 'Abrade', 'Obliterate', 'Invigorating Hot Spring', 'Linvala, Shield of Sea Gate', 'Tragic Slip', 'Isolate', 'Sporesower Thallid', 'Defiant Strike', 'Kaya, Ghost Assassin', 'Razortide Bridge', 'Stinkdrinker Bandit', 'Temple of Plenty', 'Thallid', 'Ghost Quarter', 'Startled Awake', 'Bronzehide Lion', 'Veinfire Borderpost', 'Dockside Chef', 'Moon-Circuit Hacker', 'Volcanic Salvo', 'Giant Killer', 'Restoration Angel', 'Zabaz, the Glimmerwasp', 'Flickerform', 'Incubation Druid', 'Merfolk Secretkeeper', 'Lotleth Giant', 'Niv-Mizzet, the Firemind', 'Mindslaver', 'Loxodon Smiter', 'Manic Scribe', 'Verdurous Gearhulk', 'Oviya Pashiri, Sage Lifecrafter', 'Goblin Assault', 'Psychic Strike', 'Beast Whisperer', 'Temple of Deceit', 'Homestead Courage', 'Thought Scour', 'Terminus', 'Ezuri, Renegade Leader', 'Curse of Thirst', 'Unburial Rites', 'Trading Post', 'Sylvan Library', 'Reveillark', 'Advent of the Wurm', 'Malakir Rebirth', 'Goldmire Bridge', 'Kumano Faces Kakkazan', 'Strionic Resonator', 'Eaten Alive', 'Skirk Prospector', 'Coalition Relic', 'Apex of Power', 'Hotshot Mechanic', 'Cabal Interrogator', 'Slaughter Games', 'Leonin Relic-Warder', 'Putrid Imp', 'Usher of the Fallen', 'Fire Covenant', 'Enlistment Officer', 'Restore Balance', 'Murmuring Mystic', 'Laboratory Maniac', 'Curse of Stalked Prey', 'Reckless Impulse', 'Kamahl''s Druidic Vow', 'Presence of Gond', 'Curse of Death''s Hold', 'Pieces of the Puzzle', 'Arguel''s Blood Fast', 'Delay', 'Worthy Knight', 'Temple of Epiphany', 'Prickly Boggart', 'Shigeki, Jukai Visionary'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 73.1, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (81.5 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Forbid', 'Thought Scour', 'Experimental Overload', 'Ominous Seas', 'Blackmail', 'Dakmor Salvage', 'Growing Rites of Itlimoc', 'Entrancing Melody', 'Blisterpod', 'Slip Out the Back', 'Unexpected Results', 'General Ferrous Rokiric', 'Arbor Elf', 'Crib Swap', 'Orcish Vandal', 'Foreboding Ruins', 'Glacial Fortress', 'Power Conduit', 'Gaea''s Anthem', 'Qasali Pridemage', 'Ezuri, Renegade Leader', 'Abyssal Persecutor', 'Assault Strobe', 'Field of Ruin', 'Pia and Kiran Nalaar', 'Scout''s Warning', 'Shivan Wurm', 'Duskwatch Recruiter', 'Mortician Beetle', 'Terminus', 'Caged Sun', 'Experimental Frenzy', 'Opt', 'Blade Splicer', 'Springbloom Druid', 'Inspiring Overseer', 'Step Through', 'Hour of Promise', 'Chandra, Fire Artisan', 'Ash Zealot', 'Dauntless Bodyguard', 'Needle Spires', 'Vampire Envoy', 'Herald of the Pantheon', 'Fleecemane Lion', 'Cabal Therapist', 'Honored Hydra', 'Zada''s Commando', 'Brokers Charm', 'Footfall Crater', 'Kumano Faces Kakkazan', 'Izzet Boilerworks', 'Disruptive Pitmage', 'Temple of Silence', 'Detention Sphere', 'Hornet Queen', 'Jhoira of the Ghitu', 'Journeyer''s Kite', 'Unburial Rites', 'Rally for the Throne', 'Condemn', 'Tome Scour', 'Spider Umbra', 'Yahenni''s Expertise', 'Lonely Sandbar', 'Behold the Unspeakable', 'Rune of Sustenance', 'Forgotten Cave', 'Seething Song', 'Reckless Rage', 'Bloodbraid Elf', 'Force of Rage', 'Heliod''s Pilgrim', 'Sea Gate Oracle', 'Disallow', 'Claim the Firstborn', 'Hunted Witness', 'Arch of Orazca', 'Lightning Axe', 'Rakdos Headliner', 'Plargg, Dean of Chaos', 'Drowned Catacomb', 'Flametongue Kavu', 'Kami of False Hope', 'Combine Chrysalis', 'Braids, Cabal Minion', 'Wayward Guide-Beast', 'Enlistment Officer', 'Launch the Fleet', 'Keldon Marauders', 'Jokulhaups', 'Logic Knot', 'Blood Fountain', 'Reckoner''s Bargain', 'Putrid Imp', 'Secluded Courtyard', 'Magister of Worth', 'Obscura Storefront', 'Reverent Hoplite', 'Beast Whisperer', 'Wrench Mind', 'Lead the Stampede', 'Skyshroud Forest', 'Foundry Street Denizen', 'Doubling Cube', 'Arcbound Stinger', 'Razortide Bridge', 'Feat of Resistance', 'Bronzehide Lion', 'Prickly Boggart', 'Kabira Takedown', 'Nomad Outpost', 'Pentarch Ward', 'Mishra''s Factory', 'Deathcap Cultivator', 'Curse of Stalked Prey', 'Fertile Ground', 'Displace', 'Arguel''s Blood Fast', 'Sigrid, God-Favored', 'Captain of the Watch', 'Manic Scribe', 'Llanowar Wastes', 'Revitalize', 'Lizard Blades', 'Erebos''s Intervention', 'Sorin Markov', 'Medomai''s Prophecy', 'Haunted Dead', 'Thirst for Discovery', 'Pyroclasm', 'Timeless Witness', 'Electrolyze', 'Into the Story', 'Kitchen Imp', 'Kiln Fiend', 'Hushwing Gryff', 'Oust', 'Mercurial Chemister', 'Gods Willing', 'See the Truth', 'Fodder Launch', 'Sejiri Shelter', 'Triskaidekaphile', 'Llanowar Elves', 'Goldhound', 'Mistcutter Hydra', 'Growth-Chamber Guardian', 'Buried Alive', 'Gatekeeper of Malakir', 'Verdurous Gearhulk', 'Tempest Djinn', 'Sylvan Scrying', 'Burst Lightning', 'Fires of Yavimaya', 'Signal Pest', 'Soul Snare', 'Magus of the Disk', 'Fyndhorn Elves', 'Deathspore Thallid', 'Ob Nixilis, the Fallen', 'Earwig Squad', 'Scrabbling Claws', 'Tajic, Legion''s Edge', 'Kor Duelist', 'Sporoloth Ancient', 'Soulflayer', 'Michiko''s Reign of Truth', 'Anguished Unmaking', 'Prism Ring', 'Intangible Virtue', 'Touch the Spirit Realm', 'Nirkana Assassin', 'Birds of Paradise', 'Impostor of the Sixth Pride', 'Peer Through Depths', 'Mouth of Ronom', 'Jace, the Living Guildpact', 'Raise the Alarm', 'Fire Covenant', 'Prowling Serpopard', 'March of Burgeoning Life', 'Jaya Ballard', 'Timely Reinforcements', 'Doomed Dissenter', 'Howltooth Hollow', 'Cruel Bargain', 'Gideon Jura', 'Hapatra, Vizier of Poisons', 'Wrath of God', 'Fire-Lit Thicket', 'Judge''s Familiar', 'Icehide Golem', 'Kazandu Blademaster', 'Isolate', 'Hymn to Tourach', 'Adanto Vanguard', 'Pieces of the Puzzle', 'Darkmoss Bridge', 'Gladecover Scout', 'Kefnet the Mindful', 'Desperate Ritual', 'Lantern of the Lost', 'Okina, Temple to the Grandfathers', 'Suffocating Fumes', 'Smothering Abomination', 'Cabal Interrogator', 'Saffi Eriksdotter', 'Diregraf Ghoul', 'Response // Resurgence', 'Autumn''s Veil', 'Repeal', 'Cryptolith Rite', 'Coiling Oracle', 'Chain Lightning', 'Vampire''s Kiss', 'Ancient Stirrings', 'Tymaret, Chosen from Death', 'Demonic Dread', 'Riveteers Charm', 'Snow-Covered Mountain', 'Blastoderm', 'Frontier Bivouac', 'Nuisance Engine', 'Mayor of Avabruck', 'Dust of Moments', 'Blessed Alliance', 'Kunoros, Hound of Athreos', 'Glaze Fiend', 'Treasure Cruise', 'Syr Faren, the Hengehammer', 'Crash Through', 'Endless Horizons', 'Mistvault Bridge', 'Wooded Bastion', 'Reckless Impulse', 'Seasoned Hallowblade', 'Leatherback Baloth', 'Advent of the Wurm', 'Stromkirk Noble', 'Loxodon Smiter', 'Shalai, Voice of Plenty', 'Firewild Borderpost', 'Slaughter Pact', 'Varragoth, Bloodsky Sire', 'Outland Liberator', 'Brokers Hideout', 'Prophet of Kruphix', 'Grim Lavamancer', 'Golgari Brownscale', 'Brimstone Dragon', 'Quicksilver Fountain', 'Sign in Blood', 'Apex of Power', 'Illuminator Virtuoso', 'Hero of Precinct One', 'Angel of Grace', 'Engulf the Shore', 'Ondu Cleric', 'Compulsive Research', 'Liliana Vess', 'Lys Alana Huntmaster', 'Jukai Naturalist', 'Courier''s Briefcase', 'Yorvo, Lord of Garenbrig', 'Deep Analysis', 'Kamahl''s Druidic Vow', 'Joraga Treespeaker', 'Dark Ritual', 'Elves of Deep Shadow', 'Silverbluff Bridge', 'Darigaaz Reincarnated', 'Tooth and Nail', 'Dragonskull Summit', 'Marwyn, the Nurturer', 'Ojutai''s Command', 'Spell Pierce', 'Lord of the Undead', 'Tamiyo''s Safekeeping', 'The Raven''s Warning', 'Restore Balance', 'Trading Post', 'Snow-Covered Plains', 'Woodland Cemetery', 'Izzet Charm', 'Frostwalk Bastion', 'Prophetic Prism', 'Alms of the Vein', 'Voltage Surge', 'Winds of Rebuke', 'Ghost Quarter', 'Garruk Wildspeaker', 'Codie, Vociferous Codex', 'Muddle the Mixture', 'Zenith Flare', 'Edric, Spymaster of Trest', 'Sky Terror', 'Vampire Nighthawk', 'Reckless Charge', 'Sterling Grove', 'Faithful Mending', 'Worldgorger Dragon', 'Hada Freeblade', 'Delver of Secrets', 'Seaside Citadel', 'Ranger of Eos', 'Cauldron Haze', 'Void Snare', 'Zurgo Bellstriker', 'Presence of Gond', 'Tainted Strike', 'Arcbound Ravager', 'Evolving Door', 'Mistveil Plains', 'Prismatic Lens', 'Sarkhan the Masterless', 'Kaya, Ghost Assassin', 'Aetherspouts', 'Unlucky Witness', 'Cyclone Summoner', 'Sacred Fire', 'Abiding Grace', 'Llanowar Tribe', 'Startled Awake', 'Glen Elendra Archmage', 'Cerodon Yearling', 'Adorned Pouncer', 'Hostage Taker', 'Jolrael, Mwonvuli Recluse', 'Trostani''s Summoner', 'Bala Ged Recovery', 'Tectonic Giant', 'Ponder', 'Preeminent Captain', 'Disciple of the Vault', 'Teachings of the Kirin', 'Spark Spray', 'Dead Weight', 'Heartless Act', 'Sandwurm Convergence', 'Frogtosser Banneret', 'Collateral Damage', 'Raven''s Crime', 'Feed the Swarm', 'Diabolic Edict', 'Dream Salvage', 'Traumatize', 'Vendetta', 'Cruel Ultimatum', 'Graveshifter', 'Strionic Resonator', 'Bazaar Trader', 'Earthshaker Khenra', 'Coalition Relic', 'Mana Leak', 'Smokestack', 'Keeper of the Dead', 'Fauna Shaman', 'Hieroglyphic Illumination', 'Psychic Strike', 'Agony Warp', 'Clifftop Retreat', 'Mire''s Toll', 'Ritual of Soot', 'Mirran Crusader', 'Commit // Memory', 'Shrieking Affliction', 'Invoke Calamity', 'Phoenix of Ash', 'Joraga Warcaller', 'Niv-Mizzet, the Firemind', 'Angel of Despair', 'Mind''s Desire', 'Snow-Covered Swamp', 'Bone Shards', 'Stinkdrinker Bandit', 'Benevolent Bodyguard', 'Pathrazer of Ulamog', 'Animate Dead', 'Incinerate', 'Captain Lannery Storm', 'Tragic Slip', 'Sylvan Primordial', 'Urban Utopia', 'Temple of Mystery', 'Drana''s Emissary', 'Blazing Rootwalla', 'Vision Skeins', 'Kor Skyfisher', 'Thundering Raiju', 'Martyr''s Soul', 'Garth One-Eye', 'Voldaren Epicure', 'Mirrorshell Crab', 'Chaplain of Alms', 'Cumber Stone', 'Sticky Fingers', 'Cruel Sadist', 'Sylvan Library', 'Augur of Bolas', 'Raging Ravine', 'Fieldmist Borderpost', 'Blossoming Sands', 'Epochrasite', 'Steel Hellkite', 'Despoiler of Souls', 'Karametra''s Favor', 'Late to Dinner', 'Fury Charm', 'Arcbound Worker', 'Bastion of Remembrance', 'Scryb Ranger', 'Lapse of Certainty', 'Form of the Dragon', 'Foundation Breaker', 'Vicious Rumors', 'Fierce Retribution', 'Temple of Epiphany', 'Vindicate', 'Dihada''s Ploy', 'Obliterate', 'Magus of the Abyss', 'Zulaport Cutthroat', 'Game Trail', 'Dragonstorm', 'Hateful Eidolon', 'Austere Command', 'Lost Auramancers', 'Banshee''s Blade', 'Wildfield Borderpost', 'Gravitational Shift', 'Sidisi, Undead Vizier', 'Kjeldoran Outpost', 'Firebolt', 'Aspect of Hydra', 'Reliquary Tower', 'Didn''t Say Please', 'Abbot of Keral Keep', 'Mangara of Corondor', 'Brave the Elements', 'Reveillark', 'Bygone Bishop', 'Opulent Palace', 'Mogg War Marshal', 'Midnight Guard', 'Soul''s Attendant', 'Westvale Abbey', 'Bala Ged Thief', 'Akroma''s Memorial', 'Ethersworn Canonist', 'Tyrant''s Scorn', 'Zulaport Duelist', 'Mire''s Grasp', 'Dwynen''s Elite', 'Leechridden Swamp', 'Evangel of Heliod', 'Clarion Spirit', 'Haktos the Unscarred', 'Nivmagus Elemental', 'Captain''s Claws', 'Kazandu Mammoth', 'Dread Fugue', 'Jungle Hollow', 'Ajani''s Pridemate', 'Dissipate', 'Shadowmage Infiltrator', 'Ornithopter', 'Raise the Draugr', 'Pack Rat', 'Slaughter Games', 'Thallid', 'Esper Charm', 'Brazen Upstart', 'Hypnotic Specter', 'Lose Focus', 'Renegade Tactics', 'Day of Judgment', 'Hinterland Harbor', 'Blighted Agent', 'Agonizing Remorse', 'Gitaxian Probe', 'Famished Paladin', 'Flourishing Fox', 'Zabaz, the Glimmerwasp', 'Hissing Quagmire', 'Grimdancer', 'Colossal Skyturtle', 'Ethereal Armor', 'Sandsteppe Citadel', 'Planar Portal', 'Destiny Spinner', 'Glimmerpost', 'Evolving Wilds', 'Deliberate', 'Awakening Zone', 'Stonybrook Angler', 'Ruin Crab', 'Ethersworn Sphinx', 'Go for the Throat', 'Soul Warden', 'Barkhide Troll', 'Last Breath', 'Dimir Aqueduct', 'Remorseful Cleric', 'Caves of Koilos', 'Avacyn''s Pilgrim', 'Duress', 'Linvala, Shield of Sea Gate', 'Novice Occultist', 'Dryad Militant', 'Judith, the Scourge Diva', 'Cleansing Nova', 'Bloodchief''s Thirst', 'Verduran Enchantress', 'Fabricate', 'Improbable Alliance', 'Verdant Command', 'Sorin''s Vengeance', 'Disfigure', 'Immortal Coil', 'Ghitu Encampment', 'Elvish Archdruid', 'Sleight of Hand', 'Smallpox', 'Orochi Merge-Keeper', 'Dream Twist', 'Banefire', 'Maestros Theater', 'Shrapnel Blast', 'Fiend Hunter', 'Think Twice', 'Dennick, Pious Apprentice', 'Sylvan Anthem', 'Mistvein Borderpost', 'Piranha Marsh', 'Elvish Mystic', 'Mirror Entity', 'Gird for Battle', 'Temple of Deceit', 'Argentum Armor', 'Shardless Agent', 'Favored Hoplite', 'Canyon Slough', 'Glint Hawk', 'Champion of Wits', 'Hunted Nightmare', 'Goblin Electromancer', 'Drannith Stinger', 'Vampire Lacerator', 'Radiant Scrollwielder', 'Delay', 'Volcanic Salvo', 'Gavony Township', 'Bladestitched Skaab', 'Eater of Virtue', 'Eldrazi Conscription', 'Experimental Synthesizer', 'Faithless Salvaging', 'Sungold Sentinel', 'Bloodtithe Harvester', 'Oviya Pashiri, Sage Lifecrafter', 'Weapons Trainer', 'Ghor-Clan Rampager', 'Ondu Inversion', 'Nether Traitor', 'Vapor Snag', 'Open the Armory', 'Riptide Laboratory', 'Fiery Justice', 'Scrapheap Scrounger', 'Thornglint Bridge', 'Dictate of Kruphix', 'Mire Triton', 'Frantic Inventory', 'Beastcaller Savant', 'Hokori, Dust Drinker', 'Shielding Plax', 'It That Betrays', 'Oni-Cult Anvil', 'Frantic Search', 'Spirit Link', 'Battlefield Forge', 'Sporesower Thallid', 'Grapeshot', 'Shredded Sails', 'Flickerform', 'Dread Presence', 'Tanglepool Bridge', 'Ondu War Cleric', 'Galvanic Relay', 'Harmless Offering', 'Blowfly Infestation', 'Nested Shambler', 'Edge of Autumn', 'Lochmere Serpent', 'Geomancer''s Gambit', 'Unflinching Courage', 'Decree of Justice', 'Urza''s Factory', 'Hero of Iroas', 'Skybridge Towers', 'Rootbound Crag', 'Grave Strength', 'Flame Slash', 'Empty the Warrens', 'Stirring Wildwood', 'Isareth the Awakener', 'Grave Pact', 'Drowned Secrets', 'Rocky Tar Pit', 'Cloudshift', 'Vedalken Anatomist', 'Buried Ruin', 'Distended Mindbender', 'Sphere of Safety', 'Valiant Changeling', 'Base Camp', 'Cathar Commando', 'Cleansing Wildfire', 'Predator Ooze', 'Lava Dart', 'Spirited Companion', 'Ethereal Absolution', 'Behold the Multiverse', 'Shriekmaw', 'Sylvan Advocate', 'Never // Return', 'Mirari''s Wake', 'Tithe Taker', 'Reality Ripple', 'Dissolve', 'Warren Weirding', 'Teferi''s Ageless Insight', 'Banisher Priest', 'Thraben Inspector', 'Explore', 'Golgari Germination', 'Sanguine Statuette', 'Zhalfirin Void', 'Tranquil Cove', 'Figure of Destiny', 'Slagwoods Bridge', 'Jace, Memory Adept', 'Sower of Temptation', 'Restoration Angel', 'Arcane Sanctum', 'Chandra, Pyromaster', 'Rustvale Bridge', 'Shigeki, Jukai Visionary', 'Jwari Disruption', 'Carnophage', 'Trickbind', 'Gilt-Leaf Archdruid', 'Karmic Guide', 'Wonder', 'Sunrise Cavalier', 'Invigorating Hot Spring', 'Molten Slagheap', 'Linvala, the Preserver', 'Murmuring Mystic', 'Search Party Captain', 'Universal Automaton', 'Walking Skyscraper', 'Go for Blood', 'Sage''s Dousing', 'Bogardan Hellkite', 'Drannith Healer', 'Thopter Spy Network', 'Lumbering Falls', 'Diregraf Captain', 'Cold-Eyed Selkie', 'Out of Time', 'Thought Erasure', 'Chain Reaction', 'Runeflare Trap', 'Legion''s Initiative', 'Pyromancer''s Swath', 'General''s Enforcer', 'Doomed Traveler', 'Viashino Pyromancer', 'Master of Death', 'Metalwork Colossus', 'Giant Killer', 'Sarkhan, the Dragonspeaker', 'Nyx Lotus', 'Moritte of the Frost', 'Woodfall Primus', 'Pyretic Ritual', 'Cloudpost', 'Talisman of Impulse', 'Quest for the Holy Relic', 'Eaten Alive', 'Temple of Malady', 'Heartwood Storyteller', 'Nyxathid', 'Serrated Scorpion', 'Archaeomancer', 'Megrim', 'Mindslaver', 'Thallid Shell-Dweller', 'Prodigal Sorcerer', 'Secluded Steppe', 'Slagstorm', 'Voidmage Prodigy', 'Vexing Shusher', 'Mantis Rider', 'Elixir of Immortality', 'Utopia Mycon', 'Fiery Temper', 'Otherworldly Gaze', 'Spatial Contortion', 'Quicken', 'Dramatic Finale', 'Shreds of Sanity', 'Hagra Mauling', 'Snow-Covered Forest', 'Putrid Goblin', 'Fling', 'Desolation Twin', 'Silundi Vision', 'Quest for the Nihil Stone', 'Infernal Grasp', 'Champion of the Parish', 'Oracle of Mul Daya', 'Jadelight Ranger', 'Dire Tactics', 'Spring-Leaf Avenger', 'Song-Mad Treachery', 'Abrade', 'Nameless Inversion', 'Watcher for Tomorrow', 'Auntie''s Snitch', 'Fanatical Firebrand', 'Homestead Courage', 'Irencrag Feat', 'Eiganjo Castle', 'Zulaport Chainmage', 'Bump in the Night', 'Goblin Bombardment', 'Barren Moor', 'Blackbloom Rogue', 'Mind Rake', 'Phyrexian Dreadnought', 'Graf Harvest', 'Stern Dismissal', 'Saproling Burst', 'Suspend', 'Bedlam Reveler', 'Sleep', 'Ancestral Anger', 'Bramblewood Paragon', 'Upriser Renegade', 'Mystifying Maze', 'Primal Command', 'Riding the Dilu Horse', 'Spikefield Hazard', 'Viscera Seer', 'Dimir Charm', 'Field Marshal', 'Primal Forcemage', 'Aphemia, the Cacophony', 'Graf Reaver', 'Gryff''s Boon', 'Falkenrath Aristocrat', 'Temple of Plenty', 'Double Vision', 'Psychotrope Thallid', 'Ravenous Squirrel', 'Tendrils of Agony', 'Shaile, Dean of Radiance', 'Strike It Rich', 'Akuta, Born of Ash', 'Midnight Reaper', 'Negate', 'Temmet, Vizier of Naktamun', 'Jhoira''s Timebug', 'Barrin, Tolarian Archmage', 'Curiosity', 'Riveteers Overlook', 'Dockside Chef', 'Castigate', 'Overwhelming Splendor', 'Rabbit Battery', 'The Scorpion God', 'Splinterfright', 'Black Sun''s Zenith', 'Lavaclaw Reaches', 'Patch Up', 'Inevitable Betrayal', 'Blistercoil Weird', 'Daru Warchief', 'Catacomb Sifter', 'Skyclave Shade', 'Incubation Druid', 'Sunset Revelry', 'Eternal Dragon', 'Martyr of Sands', 'Knucklebone Witch', 'Death Baron', 'Elemental Mastery', 'Swiftblade Vindicator', 'Skyclave Cleric', 'Unified Will', 'Kor Blademaster', 'Cruel Reality', 'Forsake the Worldly', 'Commune with the Gods', 'Ramunap Excavator', 'Temple of Enlightenment', 'Bontu the Glorified', 'Sokenzan Smelter', 'Wild Cantor', 'Orim''s Chant', 'Time Stretch', 'Knight of the Reliquary', 'Satyr Wayfinder', 'Dream Trawler', 'Hanweir Garrison', 'Thallid Germinator', 'Sea Gate Wreckage', 'Force of Savagery', 'Zetalpa, Primal Dawn', 'Gadwick, the Wizened', 'Vampire of the Dire Moon', 'Veinfire Borderpost', 'Jewel Thief', 'Drossforge Bridge', 'Cabaretti Courtyard', 'Tribute Mage', 'Vedalken Aethermage', 'Oran-Rief Ooze', 'Padeem, Consul of Innovation', 'Rakdos Cackler', 'Wall of Omens', 'Crumbling Necropolis', 'Blazing Shoal', 'Obstinate Baloth', 'Liliana''s Caress', 'Memory Lapse', 'Greater Gargadon', 'Fevered Visions', 'Mesmeric Fiend', 'Messenger''s Speed', 'Dead // Gone', 'Mind Funeral', 'Snowfield Sinkhole', 'Chasm Skulker', 'Cabal Stronghold', 'Faerie Vandal', 'Mystic Monastery', 'Merfolk Secretkeeper', 'Time of Ice', 'Raze the Effigy', 'Xathrid Necromancer', 'Nightscape Familiar', 'Lich Lord of Unx', 'Goblin Assault', 'Temple of Triumph', 'Harrow', 'Pyrite Spellbomb', 'Acolyte of Affliction', 'Goblin Dark-Dwellers', 'Midnight Clock', 'Glorybringer', 'Grisly Salvage', 'Golgari Grave-Troll', 'Char', 'Chemister''s Insight', 'Goldmire Bridge', 'Bankrupt in Blood', 'Sidisi, Brood Tyrant', 'Dread Return', 'Selesnya Charm', 'Teferi, Mage of Zhalfir', 'Undead Butler', 'Ghostly Flicker', 'Fact or Fiction', 'Fraying Sanity', 'Murderous Cut', 'Psychosis Crawler', 'Demigod of Revenge', 'Justice Strike', 'Asylum Visitor', 'Valiant Rescuer', 'Defiant Strike'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 81.5, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (79.3 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Cloudpost', 'Woodfall Primus', 'Think Twice', 'Restoration Angel', 'Unburial Rites', 'Korlash, Heir to Blackblade', 'Experimental Synthesizer', 'Mutilate', 'Rootwater Depths', 'Scab-Clan Berserker', 'Goldmire Bridge', 'Fact or Fiction', 'Plaguecrafter', 'Lotleth Giant', 'Mouth of Ronom', 'Distended Mindbender', 'Judith, the Scourge Diva', 'Kumano Faces Kakkazan', 'Hinterland Harbor', 'It That Betrays', 'Brave the Elements', 'Diabolic Edict', 'Mindstab', 'Archaeomancer', 'Frostwalk Bastion', 'Crumbling Vestige', 'Universal Automaton', 'Crackling Drake', 'Soul of Innistrad', 'Putrid Imp', 'Haunted Dead', 'Temple of Malice', 'Edge of Autumn', 'Sea Gate Oracle', 'Flourishing Fox', 'Rakdos Headliner', 'Arcbound Worker', 'Tithe Taker', 'The Scorpion God', 'Footfall Crater', 'Sunblade Samurai', 'Faithful Mending', 'Cathedral Sanctifier', 'Flame Rift', 'Signal Pest', 'Fire Covenant', 'Bloodchief''s Thirst', 'Adanto Vanguard', 'Falkenrath Pit Fighter', 'Llanowar Elves', 'Gather the Townsfolk', 'Children of Korlis', 'Yidaro, Wandering Monster', 'Commune with the Gods', 'Phantasmagorian', 'Soul Foundry', 'Seething Song', 'Vivid Creek', 'Slagwoods Bridge', 'Treasure Cruise', 'Batterbone', 'Detention Sphere', 'Viashino Pyromancer', 'Thryx, the Sudden Storm', 'Razortide Bridge', 'Colossal Skyturtle', 'Ghitu Lavarunner', 'Tranquil Thicket', 'Sea Gate Wreckage', 'Temple of Enlightenment', 'Angel of Despair', 'Tyrant of Discord', 'Demon''s Disciple', 'Sleight of Hand', 'Dreadhorde Invasion', 'Pull from Tomorrow', 'Spider Umbra', 'Condemn', 'Metallic Rebuke', 'Treasure Keeper', 'Zenith Flare', 'Leechridden Swamp', 'Cleansing Wildfire', 'Wrath of God', 'Jhoira, Weatherlight Captain', 'Into the Roil', 'Wheel of Fate', 'Summer Bloom', 'Radiant Fountain', 'Life of Toshiro Umezawa', 'Frontier Bivouac', 'Snowfield Sinkhole', 'Ethersworn Canonist', 'Hostage Taker', 'Revitalize', 'Urza''s Factory', 'Cormela, Glamour Thief', 'Mirror-Mad Phantasm', 'Champion of the Parish', 'Zulaport Cutthroat', 'Arcbound Javelineer', 'Shrieking Affliction', 'Forked Bolt', 'Temple of Epiphany', 'Dimir Charm', 'Scoured Barrens', 'Tavern Scoundrel', 'Intervention Pact', 'Maestros Charm', 'Maestros Theater', 'Valiant Changeling', 'Izzet Charm', 'Circuit Mender', 'Flametongue Kavu', 'Benevolent Bodyguard', 'Buried Alive', 'Raging Ravine', 'Cenn''s Enlistment', 'Castigate', 'Ethersworn Sphinx', 'Steel Overseer', 'Dark Intimations', 'Mephidross Vampire', 'Ral Zarek', 'Explore', 'Legacy Weapon', 'Expansion // Explosion', 'Wall of Omens', 'The Raven''s Warning', 'Burst Lightning', 'Akroma''s Blessing', 'Leonin Relic-Warder', 'Second Sunrise', 'Judge''s Familiar', 'Duress', 'Pelakka Predation', 'Mindless Automaton', 'Kabira Takedown', 'Barbarian Ring', 'Astral Drift', 'Delay', 'Kazandu Mammoth', 'Desperate Ritual', 'Hypergenesis', 'Ranger of Eos', 'Firespout', 'Braid of Fire', 'Flayer of the Hatebound', 'Throne of Geth', 'Dread Return', 'Nightscape Familiar', 'Mishra''s Factory', 'Memory Lapse', 'Jwari Disruption', 'Wandering Mind', 'Braingeyser', 'Smokestack', 'Obstinate Baloth', 'Disallow', 'Student of Warfare', 'Sandwurm Convergence', 'Altar of the Brood', 'Shigeki, Jukai Visionary', 'Frantic Search', 'Battlefield Forge', 'Zof Consumption', 'Turnabout', 'Hada Freeblade', 'Temple of Mystery', 'Yahenni''s Expertise', 'Kami of False Hope', 'Mistvault Bridge', 'Lose Focus', 'Research // Development', 'Mana Flare', 'Gitaxian Probe', 'Glimmerpost', 'Preeminent Captain', 'Repeal', 'Crawl from the Cellar', 'Drossforge Bridge', 'Rabbit Battery', 'Honor of the Pure', 'Shreds of Sanity', 'Underworld Connections', 'Viridian Shaman', 'Thirst for Meaning', 'Myr Retriever', 'Pyroclasm', 'Doom Blade', 'Liliana Vess', 'Malakir Rebirth', 'Memory''s Journey', 'Heartless Summoning', 'Fiery Gambit', 'Undercity Informer', 'Michiko''s Reign of Truth', 'Roil Eruption', 'Liquimetal Coating', 'Talisman of Impulse', 'Yarok''s Fenlurker', 'Field Marshal', 'Temple of Malady', 'Rebuild', 'Grimdancer', 'Temple of Deceit', 'Realm Razer', 'Wild Cantor', 'Everlasting Torment', 'Oust', 'Natural State', 'Cruel Ultimatum', 'Abiding Grace', 'March of Reckless Joy', 'Ornithopter', 'Ethereal Armor', 'Voldaren Epicure', 'Ash Zealot', 'Wooded Bastion', 'Undead Butler', 'Heartbeat of Spring', 'Primal Command', 'Magister Sphinx', 'Soul Snare', 'Blackbloom Rogue', 'Izzet Boilerworks', 'Enlistment Officer', 'Quest for the Nihil Stone', 'Erebos''s Intervention', 'Goblin Bombardment', 'Unflinching Courage', 'Dread Presence', 'Demonic Dread', 'Mycosynth Golem', 'Blazing Rootwalla', 'Dread Fugue', 'Marauding Raptor', 'Bala Ged Recovery', 'Snow-Covered Forest', 'Sprouting Vines', 'Ancient Grudge', 'Birds of Paradise', 'Lantern of the Lost', 'Merchant of the Vale', 'Alms of the Vein', 'Riding the Dilu Horse', 'Feed the Swarm', 'Crumbling Necropolis', 'Dream Salvage', 'Mnemonic Sphere', 'Sign in Blood', 'Vampire Nighthawk', 'Lightning Axe', 'Magister of Worth', 'Wrench Mind', 'Drown in Sorrow', 'Brain Freeze', 'Benalish Marshal', 'Day of Judgment', 'Agonizing Remorse', 'Valiant Rescuer', 'Ral, Storm Conduit', 'Animate Dead', 'Canyon Slough', 'Unlucky Witness', 'Timeless Witness', 'Triskelion', 'Strike It Rich', 'Go for Blood', 'Spirit Link', 'Hive Mind', 'Thirst for Discovery', 'Hour of Devastation', 'Trygon Predator', 'Gladecover Scout', 'Hieroglyphic Illumination', 'Armguard Familiar', 'Balustrade Spy', 'Power Depot', 'Lonely Sandbar', 'Seasoned Hallowblade', 'Fatestitcher', 'Shenanigans', 'Hypnotic Specter', 'Nomad Outpost', 'Clifftop Retreat', 'Arcbound Mouser', 'Lashwrithe', 'Ghostly Flicker', 'Splinter', 'Laboratory Maniac', 'Debt to the Kami', 'Goblin Dark-Dwellers', 'Acolyte of Affliction', 'Sylvan Library', 'Strionic Resonator', 'Covert Technician', 'Turn the Earth', 'Smiting Helix', 'Grisly Salvage', 'Eternal Dragon', 'Gryff''s Boon', 'Woodland Cemetery', 'Austere Command', 'Radiant Flames', 'Bedlam Reveler', 'Hagra Mauling', 'Stern Dismissal', 'Temporal Fissure', 'Temple of Silence', 'Glacial Fortress', 'Sylvan Scrying', 'Terastodon', 'Mana Seism', 'Unsubstantiate', 'Witch''s Cottage', 'Blossoming Sands', 'Shredded Sails', 'Ponder', 'Magmaquake', 'Darigaaz Reincarnated', 'Dauntless Bodyguard', 'Aether Spellbomb', 'Heartless Act', 'Vivid Grove', 'Dregscape Zombie', 'Shardless Agent', 'Prismatic Lens', 'Bedevil', 'Elvish Mystic', 'Sacred Fire', 'Dimir Aqueduct', 'Snow-Covered Plains', 'Titanoth Rex', 'Spark Spray', 'Viscera Seer', 'Nyxathid', 'Dryad Militant', 'Caves of Koilos', 'Morselhoarder', 'Animation Module', 'Cathodion', 'Sin Collector', 'Kitchen Imp', 'Mesmeric Fiend', 'Collected Conjuring', 'Incinerate', 'Fiery Temper', 'Uncharted Haven', 'Giant Killer', 'Ajani, Caller of the Pride', 'Slaughter Pact', 'Chainer, Nightmare Adept', 'Force of Rage', 'Starstorm', 'Gatekeeper of Malakir', 'Mind''s Desire', 'Bump in the Night', 'Evolving Wilds', 'Swiftwater Cliffs', 'Akoum Warrior', 'Yusri, Fortune''s Flame', 'Thought Scour', 'Selesnya Sanctuary', 'Kazandu Blademaster', 'Zabaz, the Glimmerwasp', 'Midnight Clock', 'Sire of Insanity', 'Secluded Steppe', 'Dragonskull Summit', 'Underworld Cerberus', 'Choking Sands', 'Runed Halo', 'Mana Leak', 'Blood Fountain', 'Tribute Mage', 'Basalt Ravager', 'Dark Ritual', 'Tectonic Giant', 'Electric Revelation', 'Search Party Captain', 'Stromkirk Noble', 'Chandra, Pyromaster', 'Scout''s Warning', 'Llanowar Wastes', 'Spikefield Hazard', 'Tangled Florahedron', 'Demigod of Revenge', 'March of the Machines', 'Nezumi Shortfang', 'Behold the Multiverse', 'Rustvale Bridge', 'Sorcerous Spyglass', 'Bogardan Hellkite', 'Ravaging Blaze', 'Patchwork Automaton', 'Varragoth, Bloodsky Sire', 'Rune-Scarred Demon', 'Warstorm Surge', 'Declaration in Stone', 'Improbable Alliance', 'Invoke Calamity', 'Desperate Ravings', 'Abrade', 'Walk the Aeons', 'Forbid', 'Double Vision', 'Composite Golem', 'Silverbluff Bridge', 'Reckless Impulse', 'Bloodtithe Harvester', 'Coalition Relic', 'Forgotten Cave', 'Blade Splicer', 'Tymaret, Chosen from Death', 'Jokulhaups', 'Flame Slash', 'Gruul Turf', 'Golgari Rot Farm', 'Drannith Stinger', 'Astral Slide', 'Ancient Stirrings', 'Tooth and Nail', 'Mimic Vat', 'Cathar Commando', 'Wasteland Strangler', 'Reinforced Ronin', 'Drannith Healer', 'Hymn to Tourach', 'Mystifying Maze', 'Stirring Wildwood', 'Renewed Faith', 'Hour of Promise', 'Kaya, Ghost Assassin', 'Lumbering Falls', 'Hornet Queen', 'Sylvan Primordial', 'Foreboding Ruins', 'Opt', 'Tendrils of Agony', 'Braids, Cabal Minion', 'Vindicate', 'Thraben Inspector', 'Chain Lightning', 'Skyclave Cleric', 'Arcbound Ravager', 'Deep Forest Hermit', 'Sandsteppe Citadel', 'Deep Analysis', 'Poison the Cup', 'Sungold Sentinel', 'Tendo Ice Bridge', 'Ghost Quarter', 'Temple of Plenty', 'Phoenix of Ash', 'Barrenton Medic', 'Doomed Traveler', 'Remorseful Cleric', 'Ardent Elementalist', 'Roar of Reclamation', 'Commune with Lava', 'Pitiless Plunderer', 'Driver of the Dead', 'Sterling Grove', 'Liquimetal Torque', 'Impostor of the Sixth Pride', 'Acquisitions Expert', 'Bone Shards', 'Satyr Wayfinder', 'Asylum Visitor', 'Ravenous Squirrel', 'Nicol Bolas, Planeswalker', 'Prophetic Prism', 'Raven''s Crime', 'Daru Warchief', 'Necrotic Ooze', 'Thrill of Possibility', 'Kitesail Freebooter', 'Touch the Spirit Realm', 'Pyretic Ritual', 'Earthshaker Khenra', 'Inevitable Betrayal', 'Volcanic Geyser', 'Labyrinth of Skophos', 'Scrapyard Recombiner', 'Kunoros, Hound of Athreos', 'Drowned Catacomb', 'Panoptic Mirror', 'Spell Pierce', 'Resurgent Belief', 'Jack-o''-Lantern', 'Myr Landshaper', 'Implement of Examination', 'Restore Balance', 'Krark''s Thumb', 'Seaside Citadel'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 79.3, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (65.1 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Golgari Grave-Troll', 'Blackmail', 'Ominous Parcel', 'Radha, Heart of Keld', 'Buried Ruin', 'Sin Collector', 'Tranquil Thicket', 'Thaumatic Compass', 'Wrath of God', 'Broodhatch Nantuko', 'Magister of Worth', 'Invigorate', 'Valiant Changeling', 'Mephidross Vampire', 'Arrogant Wurm', 'Ethersworn Canonist', 'Fire Covenant', 'Anticipate', 'Oust', 'Mind''s Desire', 'Goblin Dark-Dwellers', 'Bazaar Trader', 'Coalition Relic', 'Remorseful Cleric', 'Animate Dead', 'Chandra, Pyromaster', 'Raging Ravine', 'Secluded Courtyard', 'Jokulhaups', 'Eternal Dragon', 'Silver-Fur Master', 'Grumgully, the Generous', 'Negate', 'Dead // Gone', 'Runed Halo', 'Akroma''s Blessing', 'Massive Might', 'Seal of Removal', 'Haunted Dead', 'Simic Charm', 'Codie, Vociferous Codex', 'Rustvale Bridge', 'Game Trail', 'Ral, Storm Conduit', 'Birds of Paradise', 'Abundant Harvest', 'Treasure Cruise', 'Temple of Malice', 'Unravel the Aether', 'Gitaxian Probe', 'Hinterland Harbor', 'Slip Out the Back', 'Stinkweed Imp', 'Preeminent Captain', 'Conflagrate', 'Judge''s Familiar', 'Caves of Koilos', 'Commune with the Gods', 'Slagwoods Bridge', 'Wooded Bastion', 'Signal Pest', 'Spell Burst', 'Temple of Deceit', 'Tyrant''s Scorn', 'Grimdancer', 'Ancient Stirrings', 'Wild Mongrel', 'Delver of Secrets', 'Thousand-Faced Shadow', 'Blood Fountain', 'Garruk Wildspeaker', 'Volcano Hellion', 'Vampire Nighthawk', 'Moon-Circuit Hacker', 'Deep Forest Hermit', 'Big Score', 'Universal Automaton', 'Sea Gate Wreckage', 'Goldmire Bridge', 'Silver Bolt', 'Sylvan Scrying', 'Lose Focus', 'Lochmere Serpent', 'Razortide Bridge', 'Lashwrithe', 'Riveteers Charm', 'Psychic Spiral', 'Tooth and Nail', 'Magmaquake', 'Primal Amulet', 'The Raven''s Warning', 'Chain Lightning', 'Sylvan Library', 'Realm Razer', 'Bloodtithe Harvester', 'Harmless Offering', 'Talisman of Impulse', 'Woodfall Primus', 'Smiting Helix', 'Reality Ripple', 'Master of Etherium', 'Summoning Station', 'Ravaging Blaze', 'Noose Constrictor', 'Cleansing Wildfire', 'Grisly Salvage', 'Tyrant of Discord', 'Desperate Ritual', 'Skirk Prospector', 'Satyr Wayfinder', 'Master of Death', 'March of Reckless Joy', 'Maestros Theater', 'Blasphemous Act', 'Hieroglyphic Illumination', 'Circular Logic', 'Gatekeeper of Malakir', 'Detention Sphere', 'Faerie Vandal', 'Stern Dismissal', 'Hada Freeblade', 'Temple of Epiphany', 'Stirring Wildwood', 'Blighted Agent', 'Ranger''s Guile', 'Blossoming Sands', 'Mystifying Maze', 'Goblin Bombardment', 'Become Immense', 'Leonin Relic-Warder', 'Champion of the Parish', 'Secluded Steppe', 'Thirst for Discovery', 'Cursecatcher', 'Riveteers Overlook', 'Grim Lavamancer', 'Drowned Catacomb', 'Condemn', 'Llanowar Wastes', 'Elvish Mystic', 'Mindslaver', 'Kazandu Blademaster', 'Disallow', 'Daru Warchief', 'Memory Lapse', 'Basking Rootwalla', 'Hagra Mauling', 'Honor of the Pure', 'Obsessive Search', 'Field Marshal', 'Astral Drift', 'Goblin Electromancer', 'Izzet Boilerworks', 'Trickbind', 'Goblin Warchief', 'Dryad Militant', 'Demigod of Revenge', 'Ethersworn Sphinx', 'Mana Flare', 'Tithe Taker', 'Blight Mamba', 'Austere Command', 'Sleight of Hand', 'Sylvan Advocate', 'Hour of Promise', 'Feed the Swarm', 'Ichorclaw Myr', 'Salvaging Station', 'Distended Mindbender', 'High-Speed Hoverbike', 'Hornet Queen', 'Witching Well', 'Padeem, Consul of Innovation', 'Vapor Snag', 'See the Truth', 'Frantic Search', 'Arch of Orazca', 'Boros Reckoner', 'Dark Ritual', 'Hymn to Tourach', 'Forked Bolt', 'Starstorm', 'Braid of Fire', 'Urza''s Factory', 'Primal Command', 'Benalish Marshal', 'Seething Song', 'Glimmerpost', 'Midnight Clock', 'Erebos''s Intervention', 'Sylvan Primordial', 'Behold the Multiverse', 'Pull from Tomorrow', 'Ponder', 'Changeling Outcast', 'Goblin Cratermaker', 'Slagstorm', 'Burst Lightning', 'Heartless Act', 'Sandsteppe Citadel', 'Centaur Garden', 'Barren Moor', 'Commit // Memory', 'Electric Revelation', 'Llanowar Elves', 'Dread Fugue', 'Canyon Slough', 'Bloodchief''s Thirst', 'Cathar Commando', 'Drossforge Bridge', 'Timeless Witness', 'Fraying Sanity', 'Might of Old Krosa', 'Phyrexian Dreadnought', 'Golgari Brownscale', 'Bedlam Reveler', 'Bone Shards', 'Snowfield Sinkhole', 'Opt', 'Mishra''s Factory', 'Ingenious Infiltrator', 'Forbid', 'Temple of Enlightenment', 'Triskelion', 'Lodestone Golem', 'Folio of Fancies', 'Immortal Coil', 'Deep Analysis', 'Brokers Hideout', 'Volcanic Geyser', 'Dread Return', 'Pelakka Predation', 'Chief Engineer', 'Fire-Lit Thicket', 'Spell Pierce', 'Abyssal Persecutor', 'Secluded Glen', 'Tymaret, Chosen from Death', 'Mouth of Ronom', 'Ghost Quarter', 'Endbringer', 'Lonely Sandbar', 'Cloudpost', 'Faerie Miscreant', 'Enlistment Officer', 'Rootbound Crag', 'Unburial Rites', 'Jace, the Living Guildpact', 'Expansion // Explosion', 'Invoke Calamity', 'Silverbluff Bridge', 'Take Inventory', 'Obstinate Baloth', 'Bedevil', 'Astral Slide', 'Renewed Faith', 'Goblin Matron', 'Throne of the God-Pharaoh', 'Dauntless Bodyguard', 'Old Stickfingers', 'Evolving Wilds', 'Thought Scour', 'Undead Butler', 'Lavaclaw Reaches', 'Prophetic Prism', 'Tanglepool Bridge', 'Goblin Chieftain', 'Ghoultree', 'Terastodon', 'Lumbering Falls', 'Scour All Possibilities', 'Search Party Captain', 'Shardless Agent', 'Woodland Cemetery', 'Skyline Cascade', 'Wonder', 'Zur''s Weirding', 'Brave the Elements', 'It That Betrays', 'Repeal', 'Mogg War Marshal', 'Aether Spellbomb', 'Tendrils of Agony', 'Angel of Despair', 'Sphinx''s Tutelage', 'Bala Ged Recovery', 'Dragonskull Summit', 'Kabira Takedown', 'Precursor Golem', 'Glacial Fortress', 'Simic Signet', 'Wall of Omens', 'Ramunap Excavator', 'Etherium Sculptor', 'Murderous Redcap', 'Acolyte of Affliction', 'Forbidden Alchemy', 'Grand Architect', 'Strike It Rich', 'Goblin Ringleader', 'Buried Alive', 'Castigate', 'Nightshade Stinger', 'Honored Hydra', 'Dream''s Grip', 'Boneyard Wurm', 'Sign in Blood', 'Hornet Nest', 'Impostor of the Sixth Pride', 'Guild Globe', 'Elixir of Immortality', 'Artificer''s Assistant', 'Agonizing Remorse', 'Snow-Covered Forest', 'Fallen Shinobi', 'Student of Warfare', 'Bloodbraid Elf', 'Duress', 'Mirrodin Besieged', 'Distortion Strike'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 65.1, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (86.8 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Runed Halo', 'Luminarch Ascension', 'Benevolent Bodyguard', 'Timely Reinforcements', 'Lantern-Lit Graveyard', 'Vapor Snag', 'Invigorate', 'Laboratory Maniac', 'Kargan Intimidator', 'Judge''s Familiar', 'Eye of Vecna', 'Doomed Necromancer', 'Prophet of Kruphix', 'Bolas''s Citadel', 'Yorvo, Lord of Garenbrig', 'Fact or Fiction', 'Feed the Swarm', 'Char', 'Oracle of Mul Daya', 'Radiant Fountain', 'Seething Song', 'Haunted Dead', 'Diamond Lion', 'Obzedat, Ghost Council', 'Balmor, Battlemage Captain', 'River of Tears', 'Dimir Aqueduct', 'Flourishing Fox', 'Mina and Denn, Wildborn', 'Lost Legacy', 'Tidehollow Sculler', 'Drowner of Hope', 'Aether Spellbomb', 'Korlash, Heir to Blackblade', 'Asylum Visitor', 'Helm of Kaldra', 'Glimmerpost', 'Stormfist Crusader', 'Mishra''s Factory', 'Drizzt Do''Urden', 'Radha, Heart of Keld', 'Nephalia Drownyard', 'Wayward Guide-Beast', 'Colossal Skyturtle', 'Kabira Takedown', 'Sprite Dragon', 'Arcum''s Astrolabe', 'Bedevil', 'Snow-Covered Forest', 'Niv-Mizzet, Parun', 'Scout''s Warning', 'Thopter Foundry', 'Swiftwater Cliffs', 'Creeping Chill', 'Commit // Memory', 'Inquisitive Puppet', 'Cloudpost', 'Silverbluff Bridge', 'Wandering Fumarole', 'Garruk''s Harbinger', 'Ancient Stirrings', 'Force of Rage', 'Chromium, the Mutable', 'Oblivion Ring', 'Blossoming Sands', 'Thragtusk', 'Profane Command', 'Bazaar Trademage', 'Thoughts of Ruin', 'Abiding Grace', 'Inkwell Leviathan', 'Arcane Sanctum', 'Angel of Vitality', 'Bane of Bala Ged', 'Priest of Fell Rites', 'Grisly Salvage', 'Sea Gate Oracle', 'Scaled Herbalist', 'Marit Lage''s Slumber', 'Needlebite Trap', 'Yavimaya Coast', 'Mire Triton', 'Silver Scrutiny', 'Jund Charm', 'Nomad Outpost', 'Hard Evidence', 'Academy Loremaster', 'Inscription of Ruin', 'Jinnie Fay, Jetmir''s Second', 'Sylvan Scrying', 'Hieroglyphic Illumination', 'Gruul Turf', 'Pelakka Predation', 'Boros Signet', 'Fabricate', 'Mirrodin Besieged', 'Toolcraft Exemplar', 'Dissipate', 'Splinter', 'Icehide Golem', 'Feather, the Redeemed', 'Shimmerdrift Vale', 'Shrine of Burning Rage', 'Reckless Waif', 'Forsake the Worldly', 'Calciform Pools', 'Jukai Naturalist', 'Crawling Barrens', 'Llanowar Elves', 'Makeshift Mannequin', 'Rakdos Signet', 'Treasure Map', 'Temple of Malice', 'Thraben Inspector', 'Coldsteel Heart', 'Painful Truths', 'Vithian Renegades', 'Arc Trail', 'Circuit Mender', 'Tempered Steel', 'Flood Plain', 'Boros Guildgate', 'Condemn', 'Geomancer''s Gambit', 'Magus of the Vineyard', 'Malakir Rebirth', 'Parcelbeast', 'Oath of Gideon', 'Clifftop Retreat', 'Negate', 'Golgari Guildgate', 'Angel of Glory''s Rise', 'Wall of Omens', 'Fanatical Firebrand', 'Radha''s Firebrand', 'Sudden Edict', 'Ob Nixilis Reignited', 'Vraska, Relic Seeker', 'Venser, Shaper Savant', 'Regal Force', 'Sylvan Primordial', 'Kessig Wolf Run', 'Braid of Fire', 'Kaya, Ghost Assassin', 'Risk Factor', 'Dihada''s Ploy', 'Viridian Shaman', 'Kappa Tech-Wrecker', 'Double Vision', 'Garza Zol, Plague Queen', 'Eidolon of Obstruction', 'Divest', 'Boon Satyr', 'Mephidross Vampire', 'Lab Rats', 'Magmatic Insight', 'Domri Rade', 'Lathliss, Dragon Queen', 'God-Pharaoh''s Gift', 'Bad River', 'Gonti, Lord of Luxury', 'Desecration Demon', 'Dinrova Horror', 'Cleansing Wildfire', 'Tyrant of Discord', 'Parallax Wave', 'Relentless Rats', 'Skyclave Shade', 'Scourge Devil', 'Might of Old Krosa', 'Ajani Unyielding', 'Boreal Shelf', 'Strangle', 'Induced Amnesia', 'Lingering Souls', 'Triskelion', 'Esper Charm', 'Saproling Burst', 'Bala Ged Recovery', 'Wood Elves', 'Thieving Skydiver', 'Pact of the Titan', 'Liquimetal Torque', 'Abzan Charm', 'Crimson Wisps', 'Future Sight', 'Mystical Teachings', 'March of Reckless Joy', 'Shrapnel Blast', 'Frostwalk Bastion', 'Spell Pierce', 'Scab-Clan Berserker', 'Isolated Chapel', 'Ivy Lane Denizen', 'End Hostilities', 'Oran-Rief, the Vastwood', 'Defiant Strike', 'Llanowar Scout', 'Haze of Rage', 'World at War', 'Drift of Phantasms', 'Galvanic Relay', 'Unholy Heat', 'Dragonskull Summit', 'Kumano Faces Kakkazan', 'Sword of Kaldra', 'Sin Collector', 'Reap the Past', 'Porphyry Nodes', 'Orbs of Warding', 'Sheltering Ancient', 'Engulf the Shore', 'Unearth', 'Sterling Grove', 'Halimar Depths', 'Brindle Shoat', 'Bloodvial Purveyor', 'Altar of the Brood', 'Mathas, Fiend Seeker', 'Magus of the Bazaar', 'Vines of Vastwood', 'Magister of Worth', 'Ilysian Caryatid', 'Stubborn Denial', 'Charge Through', 'Broodmate Dragon', 'Strike It Rich', 'Experimental Frenzy', 'Escape Protocol', 'Sacred Peaks', 'Urza Assembles the Titans', 'March of Burgeoning Life', 'Ramunap Excavator', 'Ivy, Gleeful Spellthief', 'It That Betrays', 'Earthquake', 'Birds of Paradise', 'Cruel Ultimatum', 'Nivmagus Elemental', 'Shambling Vent', 'Plaza of Harmony', 'Midnight Clock', 'Bedlam Reveler', 'Jace, Memory Adept', 'Patchwork Automaton', 'Flamewake Phoenix', 'Reckless Rage', 'Relentless Assault', 'Dark Petition', 'Maestros Charm', 'Primal Command', 'Acidic Slime', 'Obsidian Charmaw', 'Idyllic Tutor', 'Virus Beetle', 'Gladecover Scout', 'Timeless Witness', 'Desperate Ravings', 'Ominous Seas', 'Thornglint Bridge', 'Yosei, the Morning Star', 'Cabal Stronghold', 'Lumbering Falls', 'Astral Slide', 'Squee, Goblin Nabob', 'Blade Splicer', 'Jace, Architect of Thought', 'Arguel''s Blood Fast', 'Spikefield Hazard', 'Myr Battlesphere', 'Nameless Inversion', 'Secluded Steppe', 'Sphinx of the Steel Wind', 'Burning Inquiry', 'Llanowar Augur', 'Salvaging Station', 'Darigaaz Reincarnated', 'Mortician Beetle', 'Lose Focus', 'Silversmote Ghoul', 'Tainted Indulgence', 'Hotshot Mechanic', 'Temple of Mystery', 'Grand Architect', 'Revitalize', 'Judith, the Scourge Diva', 'Forked Bolt', 'Keldon Marauders', 'Canyon Slough', 'Jokulhaups', 'Erebos''s Intervention', 'Angel of Despair', 'Essence Capture', 'Kederekt Parasite', 'Monk Idealist', 'Awakening Zone', 'Brokers Hideout', 'Treasure Cruise', 'Prophetic Prism', 'Glimmerpoint Stag', 'Slagstorm', 'Chandra, Pyromaster', 'Enter the God-Eternals', 'Caves of Koilos', 'Midnight Reaper', 'Umezawa''s Charm', 'Manic Vandal', 'Expansion // Explosion', 'Ensoul Artifact', 'Archangel of Wrath', 'Augur of Bolas', 'Cruel Edict', 'Fae Offering', 'Glint Hawk', 'Rile', 'Sphere of Safety', 'Network Disruptor', 'Distortion Strike', 'Barbarian Ring', 'Thrumming Stone', 'Firebolt', 'Oath of Teferi', 'Phyrexian Revoker', 'Reinforced Ronin', 'Izzet Charm', 'Sleight of Hand', 'Dreadhorde Butcher', 'Lonely Sandbar', 'Putrefy', 'Phyrexian Dreadnought', 'Leaf-Crowned Elder', 'Vindicate', 'Urza''s Factory', 'Forsworn Paladin', 'Hour of Promise', 'Reckless Charge', 'Experiment One', 'Ponder', 'Chief of the Foundry', 'Rakdos Guildgate', 'Mindslaver', 'Sorin, Vengeful Bloodlord', 'Brainstone', 'Mistveil Plains', 'The Underworld Cookbook', 'Chief Engineer', 'Phyrexian Metamorph', 'Power Sink', 'Gideon''s Intervention', 'Oviya Pashiri, Sage Lifecrafter', 'Hanweir Battlements', 'Azorius Guildgate', 'Orim''s Chant', 'Agonizing Remorse', 'Lignify', 'Khalni Hydra', 'Shrine of the Forsaken Gods', 'Tooth and Nail', 'Vendetta', 'Sheltered Thicket', 'Kitesail Freebooter', 'Lochmere Serpent', 'Tectonic Edge', 'Dimir Charm', 'Spore Frog', 'Bogardan Hellkite', 'Priest of Urabrask', 'Alms of the Vein', 'Darkmoss Bridge', 'Boomerang', 'Hanweir Garrison', 'Improbable Alliance', 'Riding the Dilu Horse', 'Crack the Earth', 'Duress', 'Frantic Search', 'Knight of the White Orchid', 'Fauna Shaman', 'Teachings of the Kirin', 'Fae of Wishes', 'Mogis''s Marauder', 'Narcomoeba', 'Gods'' Eye, Gate to the Reikai', 'Pull from Tomorrow', 'Okina, Temple to the Grandfathers', 'Evolving Wilds', 'Orzhov Guildgate', 'Tainted Remedy', 'Woodland Champion', 'Fire-Lit Thicket', 'Tidespout Tyrant', 'Augur of Skulls', 'Goblin Dark-Dwellers', 'Shivan Reef', 'Bloodthrone Vampire', 'Ghost Quarter', 'Sarkhan the Mad', 'Kazandu Mammoth', 'Apex of Power', 'Slaughter Games', 'Izzet Guildgate', 'Lightning Axe', 'Mycosynth Lattice', 'Azorius Charm', 'Garruk Wildspeaker', 'Toluz, Clever Conductor', 'Lantern Bearer', 'Retreat to Coralhelm', 'Boros Reckoner', 'Combat Research', 'Akroan Crusader', 'Leonin Lightscribe', 'Arch of Orazca', 'Draining Whelk', 'Condescend', 'Crash Through', 'Tomb of Urami', 'Rite of Consumption', 'Legacy Weapon', 'Bloodchief''s Thirst', 'Darksteel Colossus', 'Avaricious Dragon', 'Soul''s Attendant', 'Stronghold Arena', 'Story Circle', 'Tamiyo''s Safekeeping', 'Hallowed Moonlight', 'Gatekeeper of Malakir', 'Blessed Alliance', 'Prismatic Lens', 'Burning-Tree Emissary', 'Fleetwheel Cruiser', 'Vilis, Broker of Blood', 'Glacial Revelation', 'Tangled Florahedron', 'Atarka, World Render', 'Sorin, Grim Nemesis', 'Woe Strider', 'Tenth District Legionnaire', 'Oust', 'Dovescape', 'Balustrade Spy', 'Experimental Synthesizer', 'Lightning Strike', 'Howling Mine', 'Thrill of Possibility', 'Dragon Tempest', 'Sphere of the Suns', 'Skyclave Cleric', 'Sandsteppe Citadel', 'Izzet Boilerworks', 'Barren Moor', 'Rivaz of the Claw', 'Grim Initiate', 'Storm Entity', 'Crux of Fate', 'King Darien XLVIII', 'Golgari Brownscale', 'Court Homunculus', 'Tempest Djinn', 'Gods Willing', 'Artisan of Kozilek', 'Tyrant''s Scorn', 'Goldhound', 'Tresserhorn Sinks', 'Abominable Treefolk', 'Aegis of the Gods', 'Bump in the Night', 'Dismal Failure', 'Thaumatic Compass', 'Plow Under', 'Rofellos, Llanowar Emissary', 'Stirring Wildwood', 'Warlord''s Fury', 'Mana Leak', 'Breya''s Apprentice', 'Draconic Roar', 'Incinerate', 'Golgari Rot Farm', 'Crumbling Necropolis', 'Infuriate', 'Angel''s Grace', 'Predator''s Gambit', 'Archfiend''s Vessel', 'Simic Guildgate', 'Fleecemane Lion', 'Dread Return', 'Diregraf Ghoul', 'Endbringer', 'Etherium Sculptor', 'Elixir of Immortality', 'Goldmire Bridge', 'Decree of Justice', 'Deep Analysis', 'Idyllic Grange', 'Spirited Companion', 'Slip Out the Back', 'Thalia, Heretic Cathar', 'Sol Talisman', 'Glowspore Shaman', 'Hornet Nest', 'Drannith Healer', 'Haunted Mire', 'Blood Servitor', 'Burst Lightning', 'Blighted Agent', 'Hatching Plans', 'Rakdos Cackler', 'Dauntless Bodyguard', 'Disrupting Shoal', 'Auramancer', 'Dennick, Pious Apprentice', 'Sylvan Advocate', 'Sunpetal Grove', 'Dark Ritual', 'Pack Rat', 'Blazing Rootwalla', 'Furious Bellow', 'Prohibit', 'Sweltering Suns', 'Raging Ravine', 'Izzet Signet', 'Gloomshrieker', 'Ominous Parcel', 'Pillage', 'Irreverent Revelers', 'Quicken', 'Joraga Treespeaker', 'Oni-Cult Anvil', 'Search for Azcanta', 'Kor Skyfisher', 'Bone Shards', 'Tatsunari, Toad Rider', 'Become Immense', 'Cathartic Reunion', 'Chrome Courier', 'Jwari Disruption', 'Idyllic Beachfront', 'Dryad Militant', 'Aria of Flame', 'Blinkmoth Nexus', 'Gideon Jura', 'Buried Ruin', 'Selesnya Guildgate', 'Nest Invader', 'Orzhov Signet', 'Rustvale Bridge', 'March of Swirling Mist', 'Filigree Familiar', 'Scrapheap Scrounger', 'Abrade', 'Mind Funeral', 'Graven Cairns', 'Ghor-Clan Rampager', 'Blackmail', 'Thought Scour', 'Memory Lapse', 'Glint-Sleeve Siphoner', 'Sign in Blood', 'Kunoros, Hound of Athreos', 'Lavaclaw Reaches', 'Foundry Street Denizen', 'Price of Progress', 'Scurry Oak', 'Sunlit Marsh', 'Simian Spirit Guide', 'Zulaport Cutthroat', 'Thirst for Knowledge', 'Perilous Research', 'Master of Death', 'Jace Beleren', 'Rime Tender', 'Steel Hellkite', 'Nemata, Primeval Warden', 'Nevermaker', 'Lava Coil', 'Overgrowth', 'Zof Consumption', 'Chatterstorm', 'Heartwood Storyteller', 'Approach of the Second Sun', 'Founding the Third Path', 'Magmatic Channeler', 'Ral, Izzet Viceroy', 'Tunneling Geopede', 'Glistener Elf', 'Jungle Hollow', 'Touch the Spirit Realm', 'Aven Heartstabber', 'Ertai''s Scorn', 'Thorn of Amethyst', 'Pentad Prism', 'Hour of Revelation', 'Gingerbread Cabin', 'Skyshroud Ranger', 'Sanguine Sacrament', 'Sedraxis Specter', 'Crackling Doom', 'Militia Bugler', 'Ransack the Lab', 'Hornet Queen', 'Stoic Rebuttal', 'Tangled Islet', 'Grim Lavamancer', 'Kuldotha Rebirth', 'Elvish Scrapper', 'Spell Burst', 'Authority of the Consuls', 'Tameshi, Reality Architect', 'Theater of Horrors', 'Blightning', 'Hobgoblin Captain', 'Magus of the Tabernacle', 'Consult the Necrosages', 'Ash Zealot', 'Dawn of Hope', 'Temple of Enlightenment', 'Ruin Crab', 'Mastermind''s Acquisition', 'Postmortem Lunge', 'Sarcomancy', 'Ichorclaw Myr', 'Captain Lannery Storm', 'Ruric Thar, the Unbowed', 'Sanguine Bond', 'Mass Hysteria', 'Spatial Contortion', 'Eldrazi Skyspawner', 'Ad Nauseam', 'Contaminated Aquifer', 'Pilfer', 'Shield of Kaldra', 'Avacyn''s Pilgrim', 'Tendrils of Agony', 'Tireless Provisioner', 'Zurgo Bellstriker', 'Fiery Temper', 'Trash for Treasure', 'Drowned Catacomb', 'Sylvan Library', 'Bone Dragon', 'Teferi, Mage of Zhalfir', 'Prophetic Bolt', 'Elvish Lyrist', 'Chain of Plasma', 'Impulse', 'Snow-Covered Swamp', 'Nimbus Maze', 'Crowd''s Favor', 'Garruk Relentless', 'Devilish Valet', 'Repeal', 'Blind Obedience', 'Abundant Harvest', 'Honor of the Pure', 'Embereth Shieldbreaker', 'Forgotten Cave', 'Smuggler''s Copter', 'Siege Rhino', 'Melira, Sylvok Outcast', 'Herald of Anguish', 'Sulfurous Blast', 'Tectonic Giant', 'Insolent Neonate', 'Delver of Secrets', 'Gruul Guildgate', 'Boon of the Wish-Giver', 'Winter''s Rest', 'Heartless Act', 'Terminus', 'Neutralize', 'Mistvault Bridge', 'Keldon Flamesage', 'Shore Up', 'Blastoderm', 'Stinkweed Imp', 'Gitaxian Probe', 'Rift Sower', 'Dreadhorde Invasion', 'Azami, Lady of Scrolls', 'Conduit of Ruin', 'Vampire Nighthawk', 'Volcano Hellion', 'Soulfire Grand Master', 'Fearless Pup', 'Woodfall Primus', 'Buried Alive', 'Drakuseth, Maw of Flames', 'Smallpox', 'Tolarian Terror', 'Snapback', 'Thunderbreak Regent', 'Fetid Pools', 'Imposing Vantasaur', 'Phantasmagorian', 'Distended Mindbender', 'Solemnity', 'Dead of Winter', 'Game Trail', 'Snow-Covered Plains', 'Timeless Dragon', 'Cut Down', 'Skybind', 'Waves of Aggression', 'Mirari''s Wake', 'Fog', 'Dictate of Kruphix', 'Bring to Light', 'Darksteel Citadel', 'Kogla, the Titan Ape', 'Illuminator Virtuoso', 'Fatal Grudge', 'Coalition Relic', 'Corrupted Crossroads', 'Blistercoil Weird', 'Summoning Station', 'Silundi Vision', 'Stromkirk Noble', 'Force of Virtue', 'The Modern Age', 'Boreal Druid', 'Brineborn Cutthroat', 'Glorybringer', 'The Cauldron of Eternity', 'Kolaghan, the Storm''s Fury', 'Chandra Nalaar', 'Throne of the God-Pharaoh', 'Coiling Oracle', 'Expedite', 'Treefolk Harbinger', 'Commune with the Gods', 'Commune with Spirits', 'Fervent Champion', 'Blossoming Calm', 'Earthshaker Khenra', 'Archon of Sun''s Grace', 'Valakut Exploration', 'Tyrant''s Choice', 'Wasitora, Nekoru Queen', 'Carth the Lion', 'Foundation Breaker', 'Tear Asunder', 'Peer Through Depths', 'Glacial Fortress', 'Tasigur, the Golden Fang', 'Raking Claws', 'Seal of Fire', 'Qasali Pridemage', 'Viscera Seer', 'Fleetfoot Dancer', 'Pyretic Ritual', 'Massive Might', 'Restoration Angel', 'Josu Vess, Lich Knight', 'Fists of Flame', 'Empty the Warrens', 'Arlinn Kord', 'Ghitu Lavarunner', 'Verix Bladewing', 'Enchantress''s Presence', 'Basking Rootwalla', 'Recurring Nightmare', 'Collateral Damage', 'Wasteland Strangler', 'Tanglepool Bridge', 'Skullscorch', 'Swans of Bryn Argoll', 'Starstorm', 'Drossforge Bridge', 'Soul Warden', 'Priest of the Haunted Edge', 'Oath of Ajani', 'Hero''s Downfall', 'Gravelighter', 'Brazen Upstart', 'Simic Signet', 'Ajani''s Pridemate', 'Liquimetal Coating', 'Exhaustion', 'Solitary Confinement', 'Wickerbough Elder', 'Mystifying Maze', 'Electrolyze', 'Scalding Cauldron', 'Grasping Dunes', 'Realm Razer', 'Dimir Guildgate', 'Sarkhan, the Dragonspeaker', 'Dromoka''s Command', 'Sea-Dasher Octopus', 'Hinterland Harbor', 'Seasons Past', 'Guile', 'Reclamation Sage', 'Shivan Wurm', 'Leonin Relic-Warder', 'Maze''s End', 'Skyblade''s Boon', 'Putrid Imp', 'Run Amok', 'Undercity Informer', 'Summer Bloom', 'Savage Beating', 'Hurloon Battle Hymn', 'Sire of Insanity', 'Silumgar''s Scorn', 'Gigadrowse', 'Lovestruck Beast', 'Artificer''s Assistant', 'Inspiring Overseer', 'Rain of Gore', 'Aspect of Hydra', 'Astral Drift', 'Phoenix Chick', 'Renegade Tactics', 'Blood Artist', 'Emeria, the Sky Ruin', 'Blasphemous Act', 'Bladewing''s Thrall', 'Nicol Bolas, Planeswalker', 'Alchemist''s Refuge', 'Breakthrough', 'Fyndhorn Elves', 'Kitchen Imp', 'Liliana Vess', 'Broodhatch Nantuko', 'Reality Acid', 'Acolyte of Affliction', 'Sigil of the Empty Throne', 'Jace, Unraveler of Secrets', 'Day of Judgment', 'Waker of Waves', 'Westvale Abbey', 'Font of Fertility', 'Nine Lives', 'Unburial Rites', 'Scattered Groves', 'Trickbind', 'Vryn Wingmare', 'Shriekmaw', 'Flametongue Kavu', 'Secluded Courtyard', 'Dream Trawler', 'Traxos, Scourge of Kroog', 'Temple of Deceit', 'Psychatog', 'Dragon''s Hoard', 'Myth Realized', 'Steel Overseer', 'Flaying Tendrils', 'Devastating Summons', 'Opt', 'Satyr Wayfinder', 'Vesperlark', 'Favored Hoplite', 'Disallow', 'Obscura Ascendancy', 'Syncopate', 'Baffling End', 'Champion of Wits', 'Elvish Mystic', 'Simic Charm', 'Banefire', 'Safehold Elite', 'Padeem, Consul of Innovation', 'Chandra, Flamecaller', 'Golgari Grave-Troll', 'Omen of the Sea', 'Anguished Unmaking', 'Selfless Savior', 'Ohran Viper', 'Volcanic Salvo', 'Obscura Storefront', 'Putrid Goblin', 'Ritual of Soot', 'Murderous Redcap', 'Mizzium Skin', 'Rapid Hybridization', 'Shard Volley', 'Smiting Helix', 'Bloodsoaked Champion', 'Walking Atlas', 'Nihil Spellbomb', 'Polukranos, Unchained', 'Mesmeric Fiend', 'Fertile Ground', 'Escape to the Wilds', 'Waterveil Cavern', 'Gilded Lotus', 'Elves of Deep Shadow', 'Flame Rift', 'Witching Well', 'Goblin Assault', 'Eldrazi Mimic', 'Orb of Dragonkind', 'Bearer of Silence', 'Forbid', 'Razortide Bridge', 'Volcanic Geyser', 'Skyclave Relic', 'Sphinx''s Tutelage', 'Ranger''s Guile', 'Temple of Malady', 'Rootbound Crag', 'Nevermore', 'Primalcrux', 'Gallia of the Endless Dance', 'Oath of Liliana', 'Electrostatic Infantry', 'Sarkhan the Masterless', 'Blackbloom Rogue', 'Jorn, God of Winter', 'Blood Baron of Vizkopa', 'Fires of Yavimaya', 'Harmonize', 'Blazing Shoal'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 86.8, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (72.6 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Dinrova Horror', 'Draining Whelk', 'Tyrant''s Choice', 'Viridian Shaman', 'Feed the Swarm', 'Colossal Skyturtle', 'Doomed Necromancer', 'Avacyn''s Pilgrim', 'Sorin Markov', 'Soul Warden', 'Mephidross Vampire', 'Prophetic Bolt', 'Decree of Justice', 'Lantern-Lit Graveyard', 'Intervention Pact', 'Bloodvial Purveyor', 'Liquimetal Coating', 'Verix Bladewing', 'Curse of Exhaustion', 'Spirited Companion', 'Atarka, World Render', 'Anguished Unmaking', 'Bloodchief''s Thirst', 'Broodhatch Nantuko', 'Spatial Contortion', 'Bedevil', 'Frostwalk Bastion', 'Mishra''s Factory', 'Tunneling Geopede', 'Chandra''s Regulator', 'Reclamation Sage', 'Golgari Rot Farm', 'Bone Shards', 'Sterling Grove', 'Caves of Koilos', 'Mindslaver', 'Sol Talisman', 'Magus of the Vineyard', 'Desperate Ravings', 'Pyroclasm', 'Gods'' Eye, Gate to the Reikai', 'Mystifying Maze', 'Elsewhere Flask', 'Wood Elves', 'Theater of Horrors', 'Frogmite', 'Jinnie Fay, Jetmir''s Second', 'Bloodsoaked Champion', 'Thieving Skydiver', 'Experimental Frenzy', 'Sanguine Sacrament', 'Fyndhorn Elves', 'Dark Ritual', 'Barkhide Troll', 'Teferi, Mage of Zhalfir', 'Leonin Relic-Warder', 'Luminarch Ascension', 'Skyclave Shade', 'Rustvale Bridge', 'Illuminator Virtuoso', 'Silverquill Silencer', 'Dream Trawler', 'Inspiring Overseer', 'Brindle Shoat', 'Pull from Tomorrow', 'Bane of Bala Ged', 'Errant, Street Artist', 'Vapor Snag', 'Nimbus Maze', 'Keldon Marauders', 'Skarrgan Pit-Skulk', 'Oracle of Mul Daya', 'Feather, the Redeemed', 'Zulaport Cutthroat', 'Primalcrux', 'Blackbloom Rogue', 'Priest of Urabrask', 'Tameshi, Reality Architect', 'Deathless Knight', 'Swiftwater Cliffs', 'Escape Protocol', 'Domri Rade', 'Reality Acid', 'Crumbling Necropolis', 'Kitchen Imp', 'Geyadrone Dihada', 'Elvish Lyrist', 'Eye of Vecna', 'Kessig Wolf Run', 'Touch the Spirit Realm', 'Lumbering Falls', 'Secluded Courtyard', 'Dictate of Kruphix', 'Inscription of Ruin', 'Chandra''s Phoenix', 'Opt', 'Kazuul''s Fury', 'Teachings of the Kirin', 'Hieroglyphic Illumination', 'Dimir Guildgate', 'Reckless Rage', 'Vines of Vastwood', 'Temple of Malice', 'Tenth District Legionnaire', 'Auramancer', 'Hobgoblin Captain', 'Caustic Caterpillar', 'Blood Artist', 'Icehide Golem', 'Drannith Healer', 'Overgrowth', 'Shore Up', 'Ominous Seas', 'Arcum''s Astrolabe', 'Bearer of Silence', 'Aether Spellbomb', 'Plow Under', 'Crowd''s Favor', 'Condescend', 'Garza Zol, Plague Queen', 'Solemnity', 'World at War', 'Boros Signet', 'Splinter', 'Essence Capture', 'Goblin Electromancer', 'Goblin Assault', 'Nemata, Primeval Warden', 'Run Amok', 'Sarcomancy', 'Commune with Spirits', 'Skyclave Relic', 'Doom Foretold', 'Sanguine Bond', 'Steel Hellkite', 'Sheltering Ancient', 'Yavimaya Coast', 'Consult the Necrosages', 'Unburial Rites', 'Jadelight Ranger', 'Grapeshot', 'Pact of the Titan', 'Thornglint Bridge', 'Conduit of Ruin', 'Walking Atlas', 'Oath of Teferi', 'Yorvo, Lord of Garenbrig', 'Nameless Inversion', 'Midnight Clock', 'Hypnotic Specter', 'Yosei, the Morning Star', 'Strangle', 'Selfless Savior', 'Ad Nauseam', 'Qasali Pridemage', 'Oath of Liliana', 'Mogg War Marshal', 'Pyromancer Ascension', 'Chrome Courier', 'Jungle Hollow', 'Lavaclaw Reaches', 'Okiba Reckoner Raid', 'Induced Amnesia', 'Arc Trail', 'Rivaz of the Claw', 'Ash Zealot', 'Momentary Blink', 'Crash Through', 'Drowner of Hope', 'Ornithopter', 'Riding the Dilu Horse', 'Pathrazer of Ulamog', 'Soulfire Grand Master', 'Fae of Wishes', 'Command the Dreadhorde', 'Reverse Engineer', 'Steel Overseer', 'Shivan Reef', 'Pyretic Ritual', 'Glint Hawk', 'Vesperlark', 'Retreat to Coralhelm', 'Tasigur, the Golden Fang', 'Crack the Earth', 'Savage Beating', 'King Darien XLVIII', 'Obzedat, Ghost Council', 'Negate', 'Cleric of Life''s Bond', 'Volcanic Salvo', 'Howling Mine', 'Grim Lavamancer', 'Skirk Prospector', 'Boros Reckoner', 'Crackling Doom', 'Coldsteel Heart', 'Dark Petition', 'Aspect of Hydra', 'Lovestruck Beast', 'Acidic Slime', 'Hornet Queen', 'Mistveil Plains', 'Firebolt', 'Treacherous Blessing', 'Radiant Fountain', 'Dissipate', 'Chromescale Drake', 'Corrupted Crossroads', 'Buried Ruin', 'The Underworld Cookbook', 'Goblin Bombardment', 'Ral, Storm Conduit', 'Mirrodin Besieged', 'Rule of Law', 'Urza''s Rage', 'Tragic Poet', 'Slaughter Games', 'Khalni Hydra', 'Pelt Collector', 'Mistvault Bridge', 'Rime Tender', 'Traxos, Scourge of Kroog', 'Oath of Chandra', 'Sunpetal Grove', 'Elvish Scrapper', 'Baru, Fist of Krosa', 'Sylvan Anthem', 'Lashwrithe', 'Bone Dragon', 'Earthquake', 'Nicol Bolas, God-Pharaoh', 'Lost Legacy', 'Stormfist Crusader', 'Evolving Wilds', 'Warlord''s Fury', 'Vendetta', 'Murderous Redcap', 'Etherium Sculptor', 'Sword of Kaldra', 'Fauna Shaman', 'Lightning Strike', 'Volcano Hellion', 'Great Sable Stag', 'Glistener Elf', 'Urza''s Factory', 'Snow-Covered Swamp', 'Implement of Improvement', 'Saproling Burst', 'Ghor-Clan Rampager', 'Realm Razer', 'Unearth', 'Idyllic Tutor', 'Chatterstorm', 'Grasping Dunes', 'Tooth of Chiss-Goria', 'Cleansing Wildfire', 'Improbable Alliance', 'Glint-Sleeve Siphoner', 'Locket of Yesterdays', 'Omen of the Sun', 'Gloomshrieker', 'Aetherflux Reservoir', 'Shield of Kaldra', 'Joraga Treespeaker', 'Judge''s Familiar', 'Force of Virtue', 'Sigil of the Empty Throne', 'Kuldotha Rebirth', 'Magmatic Insight', 'Treasure Cruise', 'Banefire', 'Mnemonic Wall', 'Drakuseth, Maw of Flames', 'Triskelion', 'Pentad Prism', 'Cathartic Reunion', 'Virus Beetle', 'Thirst for Knowledge', 'Sea-Dasher Octopus', 'Gideon''s Intervention', 'Inkwell Leviathan', 'Pillage', 'Orzhov Pontiff', 'Bladewing''s Thrall', 'Liquimetal Torque', 'Tidehollow Sculler', 'Prophetic Prism', 'Woe Strider', 'Possibility Storm', 'Radha, Heart of Keld', 'Ponder', 'Angel of Glory''s Rise', 'Lose Focus', 'Mana Leak', 'Haunted Mire', 'Forsworn Paladin', 'Helm of Kaldra', 'Soul Spike', 'Scout''s Warning', 'Runed Halo', 'Dead of Winter', 'Phyrexian Missionary', 'Kessig Prowler', 'Lathliss, Dragon Queen', 'Pyrite Spellbomb', 'Josu Vess, Lich Knight', 'Haunted Dead', 'Rakdos Guildgate', 'Trickbind', 'Timely Reinforcements', 'Incinerate', 'Orzhov Signet', 'Azorius Charm', 'Tamiyo''s Safekeeping', 'Waves of Aggression', 'Geomancer''s Gambit', 'Sylvan Scrying', 'Circuit Mender', 'Price of Progress', 'Glimmerpost', 'Devastating Summons', 'Malakir Rebirth', 'Chromatic Lantern', 'Rakdos Cackler', 'Eldrazi Mimic', 'Commune with the Gods', 'Simic Charm', 'Timeless Witness', 'Tempered Steel', 'Coiling Oracle', 'Platinum Angel', 'Jukai Naturalist', 'Revitalize', 'Scourge Devil', 'Myr Enforcer', 'Thunderbreak Regent', 'Undertaker', 'Grimdancer', 'Ranger of Eos', 'Lingering Souls', 'Galvanic Relay', 'Foundry Street Denizen', 'Mogis''s Marauder', 'Master of Death', 'Gatekeeper of Malakir', 'Syncopate', 'Selesnya Guildgate', 'Darksteel Colossus', 'Embereth Shieldbreaker', 'Repeal', 'Forgotten Cave', 'Blackmail', 'Sulfurous Blast', 'Tidespout Tyrant', 'Fetid Pools', 'Raging Ravine', 'Salvaging Station', 'Boon of the Wish-Giver', 'Scalding Cauldron', 'Blistercoil Weird', 'Forsake the Worldly', 'Woodfall Primus', 'Goblin Dark-Dwellers', 'Phyrexian Dreadnought', 'Ichorclaw Myr', 'Jace, Memory Adept', 'Aegis of the Gods', 'Rix Maadi Reveler', 'Fabricate', 'Shambling Vent', 'Torrent Sculptor', 'Mind Funeral', 'Vilis, Broker of Blood', 'Rain of Gore', 'Fast // Furious', 'Militia Bugler', 'Radha''s Firebrand', 'Ertai''s Scorn', 'Gutterbones', 'Invigorate', 'Crystal Grotto', 'Pieces of the Puzzle', 'Quicken', 'Skybind', 'Defiler of Flesh', 'Fearless Pup', 'Feasting Troll King', 'Risk Factor', 'Regal Force', 'Ral, Izzet Viceroy', 'Foundation Breaker', 'Lochmere Serpent', 'Gladecover Scout', 'Izzet Signet', 'Rabbit Battery', 'Recurring Nightmare', 'Boros Guildgate', 'Heartless Act', 'Slagwoods Bridge', 'Myr Battlesphere', 'The Modern Age', 'Commit // Memory', 'Beacon of Tomorrows', 'Sheltered Thicket', 'Sparring Regimen', 'Golgari Brownscale', 'Mirari''s Wake', 'Shriekmaw', 'Putrid Goblin', 'Garruk Relentless', 'Abundant Harvest', 'Goblin Warchief', 'Manic Vandal', 'Delver of Secrets', 'Mire Triton', 'Boreal Shelf', 'Hallowed Moonlight', 'Founding the Third Path', 'Asylum Visitor', 'Disenchant', 'Nine Lives', 'Electrolyze', 'Rakdos Signet', 'Cut Down', 'Drossforge Bridge', 'Dimir Aqueduct', 'Barbarian Ring', 'Thopter Foundry', 'Enchantress''s Presence', 'Ghost Quarter', 'Utter End', 'Chief of the Foundry', 'Form of the Dragon', 'Oran-Rief, the Vastwood', 'Sphere of the Suns', 'Darksteel Citadel', 'Sprite Dragon', 'Avaricious Dragon', 'Glacial Revelation', 'Throne of the God-Pharaoh', 'Dreadhorde Butcher', 'Gravelighter', 'Bedlam Reveler', 'Eidolon of Obstruction', 'Tangled Florahedron', 'Makeshift Mannequin', 'Terrarion', 'Kambal, Consul of Allocation', 'Voldaren Pariah', 'Magister of Worth', 'Blasphemous Act', 'Furious Bellow', 'Burst Lightning', 'Azorius Guildgate', 'Mycosynth Lattice', 'Force of Rage', 'Zurgo Bellstriker', 'Waterveil Cavern', 'Bazaar Trademage', 'Hotshot Mechanic', 'Angel of Vitality', 'Fiend Hunter', 'Bogardan Hellkite', 'Snapback', 'Shrine of the Forsaken Gods', 'Orim''s Chant', 'Ajani''s Pridemate', 'Tomb of Urami', 'Goblin Matron', 'Sleight of Hand', 'Chandra, Fire of Kaladesh', 'Blazing Rootwalla', 'Plaza of Harmony', 'Phyrexian Revoker', 'Aria of Flame', 'Rite of Consumption', 'Fertile Ground', 'Esper Charm', 'Electrostatic Infantry', 'Echoing Return', 'Venser, Shaper Savant', 'Wandering Fumarole', 'Silver Scrutiny', 'Izzet Guildgate', 'Slip Out the Back', 'Profane Command', 'Bala Ged Recovery', 'Vampire Nighthawk', 'Simian Spirit Guide', 'Shrine of Burning Rage', 'Sweltering Suns', 'Relentless Assault', 'Grapple with the Past', 'End Hostilities', 'Experimental Synthesizer', 'Imposing Vantasaur', 'Nevermore', 'Spoils of the Vault', 'Crimson Wisps', 'Char', 'Izzet Charm', 'Blossoming Calm', 'Herald of Anguish', 'Wall of Omens', 'Kuldotha Phoenix', 'Gruul Turf', 'Baffling End', 'Renegade Tactics', 'Stubborn Denial', 'Jokulhaups', 'Goblin Chieftain', 'Sunlit Marsh', 'Font of Fertility', 'Raven''s Crime', 'Call the Bloodline', 'Cruel Ultimatum', 'Wayward Guide-Beast', 'Flametongue Kavu', 'Oath of Gideon', 'Reinforced Ronin', 'Monk Idealist', 'Search for Azcanta', 'Tear Asunder', 'Nephalia Drownyard', 'Phoenix Chick', 'Fae Offering', 'Arlinn Kord', 'Ivy, Gleeful Spellthief', 'Flourishing Fox', 'Maestros Charm', 'Balmor, Battlemage Captain', 'Bloodthrone Vampire', 'Darigaaz Reincarnated', 'Scrapheap Scrounger', 'Tainted Remedy', 'Hurloon Battle Hymn', 'Game Trail', 'Parallax Wave', 'Dawn of Hope', 'Mass Hysteria', 'Glowspore Shaman', 'Chain of Plasma', 'Gigadrowse', 'Network Disruptor', 'Wasitora, Nekoru Queen', 'Tangled Islet', 'Wildgrowth Walker', 'Court Homunculus', 'Tyrant of Discord', 'Savage Swipe', 'Opulent Palace', 'Putrefy', 'Zombie Infestation', 'Tectonic Giant', 'Lightning Axe', 'Isareth the Awakener', 'Nightveil Specter', 'Altar of the Brood', 'God-Pharaoh''s Gift', 'Summer Bloom', 'Coalition Relic', 'Blightning', 'Contaminated Aquifer', 'Shimmerdrift Vale', 'Toolcraft Exemplar', 'Experiment One', 'Ohran Viper', 'Akroan Crusader', 'Empty the Warrens', 'Nihil Spellbomb', 'Enduring Ideal', 'Nivmagus Elemental', 'Tectonic Edge', 'Deep Analysis', 'Buried Alive', 'Seasons Past', 'Dovescape', 'Raffine''s Informant', 'Dread Return', 'Llanowar Scout', 'Thoughts of Ruin', 'March of Reckless Joy', 'Irreverent Revelers', 'Nicol Bolas, Planeswalker', 'Charge Through', 'Academy Loremaster', 'Tendrils of Agony', 'Alms of the Vein', 'Collateral Damage', 'Archfiend''s Vessel', 'Dimir Charm', 'Tooth and Nail', 'Tresserhorn Sinks', 'Mathas, Fiend Seeker', 'Halimar Depths', 'Obsessive Search', 'Arch of Orazca', 'Cloudpost', 'Gruul Guildgate', 'Birds of Paradise', 'Bad River', 'Smuggler''s Copter', 'Perilous Research', 'Skyclave Cleric', 'Temple of Silence', 'Kitesail Freebooter', 'Oni-Cult Anvil', 'Solitary Confinement', 'Kabira Takedown', 'Zof Consumption', 'Parcelbeast', 'Scab-Clan Berserker', 'Patchwork Automaton', 'Sedraxis Specter', 'Restoration Angel', 'Dauntless Bodyguard', 'Diregraf Ghoul', 'Carnage Altar', 'Boomerang', 'Drift of Phantasms', 'Chandra, Flamecaller', 'Rally the Ancestors', 'Ghostly Flicker', 'Agonizing Remorse', 'Blood Baron of Vizkopa', 'Rofellos, Llanowar Emissary', 'The Cauldron of Eternity', 'Winter''s Rest', 'Putrid Imp', 'Gallia of the Endless Dance', 'Kolaghan, the Storm''s Fury', 'Magus of the Tabernacle', 'Genesis', 'Archangel of Wrath', 'Blessed Alliance', 'Thrumming Stone', 'Aven Heartstabber', 'Skullscorch', 'Storm Entity', 'Awakening Zone', 'Archon of Sun''s Grace', 'Disallow', 'Sorin, Grim Nemesis', 'Forbid', 'Simian Sling', 'Pack Rat', 'Snow-Covered Forest', 'Myth Realized', 'Brazen Upstart', 'Ensoul Artifact', 'Enter the Unknown', 'Canyon Slough', 'Blighted Agent', 'Inquisitor Exarch', 'Silverbluff Bridge', 'Sylvan Library', 'Tireless Provisioner', 'Ixalli''s Diviner', 'Stromkirk Noble', 'Witching Well', 'Isolated Chapel', 'Sandwurm Convergence', 'Drizzt Do''Urden', 'Ransack the Lab', 'Silundi Vision', 'Hall of Oracles', 'Temporal Adept', 'Slaughter Pact', 'Stoic Rebuttal', 'Flood Plain', 'Distended Mindbender', 'Mina and Denn, Wildborn', 'Basking Rootwalla', 'Frantic Search', 'Smallpox', 'Retriever Phoenix', 'Benevolent Bodyguard', 'Grim Initiate', 'Razortide Bridge', 'Alchemist''s Refuge', 'Burning-Tree Emissary', 'Woodland Champion', 'Safehold Elite', 'Legacy Weapon', 'Sylvan Advocate', 'Flame Rift', 'Impulse', 'Simic Signet', 'Disrupting Shoal', 'Skyblade''s Boon', 'Dihada''s Ploy', 'Siege Rhino', 'Angel''s Grace', 'Glorybringer', 'Lantern Bearer', 'Shrapnel Blast', 'Padeem, Consul of Innovation', 'Blastoderm', 'Thraben Inspector', 'Breakthrough', 'Sea Gate Oracle', 'Abominable Treefolk', 'Raking Claws', 'Graven Cairns', 'Astral Drift', 'Fervent Champion', 'Sojourner''s Companion', 'Sign in Blood', 'Marit Lage''s Slumber', 'Chancellor of the Dross', 'Mikaeus, the Lunarch', 'Blind Obedience', 'Mystical Teachings', 'Jace Beleren', 'Dryad Militant', 'Artisan of Kozilek', 'Laboratory Maniac', 'Grumgully, the Generous', 'Relentless Rats', 'Dragon Tempest', 'Spore Frog', 'Phantasmagorian', 'Jace, Architect of Thought', 'Knight of the White Orchid', 'Secure the Wastes', 'Terminus', 'Flicker of Fate', 'Needlebite Trap', 'Valakut Exploration', 'Kor Skyfisher', 'Peer Through Depths', 'Secluded Steppe', 'Hanweir Battlements', 'Soldier of the Pantheon', 'Ob Nixilis Reignited', 'Okina, Temple to the Grandfathers', 'Sacred Peaks', 'Chromium, the Mutable', 'Memory Lapse', 'Champion of Wits', 'Mulch', 'Stirring Wildwood', 'Hanweir Garrison', 'Kazandu Mammoth', 'Rootwater Depths', 'Combat Research', 'Tolarian Terror', 'It That Betrays', 'Sleeper Agent', 'Elves of Deep Shadow', 'Vithian Renegades', 'Goblin Ringleader', 'Primal Command', 'Wasteland Strangler', 'Jund Charm', 'Dreadhorde Invasion', 'Kederekt Parasite', 'Postmortem Lunge', 'Garruk Wildspeaker', 'Astral Slide', 'Sarkhan the Mad', 'Fleetfoot Dancer', 'Kumano Faces Kakkazan', 'Neutralize', 'Authority of the Consuls', 'Thrill of Possibility', 'Fists of Flame', 'Psychatog', 'Kaya, Ghost Assassin', 'Judith, the Scourge Diva', 'Tamiyo, Collector of Tales', 'Liliana Vess', 'River of Tears', 'Bolas''s Citadel', 'Orb of Dragonkind', 'Bump in the Night', 'Braid of Fire', 'Engulf the Shore', 'Prismatic Lens', 'Angel of Despair', 'Suture Priest', 'Idyllic Beachfront', 'Silversmote Ghoul', 'Augur of Bolas', 'Spell Burst', 'Vryn Wingmare', 'Defiant Strike', 'Inquisitive Puppet', 'Gods Willing', 'March of Swirling Mist', 'Undercity Informer', 'Mesmeric Fiend', 'Sandsteppe Citadel', 'Approach of the Second Sun', 'Slagstorm', 'Kiora, Master of the Depths', 'Prophet of Kruphix', 'Desecration Demon', 'Lava Coil', 'Duress', 'Volcanic Geyser', 'Umezawa''s Charm', 'Spell Pierce', 'Honor of the Pure', 'Oblivion Ring', 'Barren Moor', 'Shivan Wurm', 'Blade Splicer', 'Ivy Lane Denizen', 'Obscura Storefront', 'Sudden Death', 'Jorn, God of Winter', 'Tainted Indulgence', 'Ravenous Chupacabra', 'Narcomoeba', 'Marauding Blight-Priest', 'Emeria, the Sky Ruin', 'Fleecemane Lion', 'Fire-Lit Thicket', 'Gilded Lotus', 'Maze''s End', 'Dromoka''s Command', 'Expansion // Explosion', 'Drowned Catacomb', 'Thorn of Amethyst', 'Sudden Edict', 'Gideon Jura', 'Sphinx''s Tutelage', 'Sin Collector', 'Braids, Cabal Minion', 'Flamewake Phoenix', 'Path of Discovery', 'Burning Inquiry', 'Terramorphic Expanse', 'Diamond Lion', 'Trash for Treasure', 'Azami, Lady of Scrolls', 'Phyrexian Metamorph', 'Day of Judgment', 'Kargan Intimidator', 'Mastermind''s Acquisition', 'Snow-Covered Plains', 'Swans of Bryn Argoll', 'Earthshaker Khenra', 'Sphinx of the Steel Wind', 'Explosive Singularity', 'Balustrade Spy', 'Power Depot', 'Scaled Herbalist', 'Empyrial Archangel', 'Crawling Barrens', 'Dragon''s Hoard', 'Muddle the Mixture', 'Idyllic Grange', 'Sword-Point Diplomacy', 'Seal of Fire', 'Chandra Nalaar', 'Vindicate', 'Oviya Pashiri, Sage Lifecrafter', 'Escape to the Wilds', 'Silumgar''s Scorn', 'Isolate', 'Fires of Yavimaya', 'Leonin Lightscribe', 'Glimmerpoint Stag', 'Niv-Mizzet, Parun', 'Fiery Temper', 'Hard Evidence', 'Scrabbling Claws', 'Garruk''s Harbinger', 'Hour of Revelation', 'Grisly Salvage', 'Abzan Charm', 'Stillmoon Cavalier', 'Greater Gargadon', 'Clifftop Retreat', 'Darkmoss Bridge', 'Story Circle', 'Become Immense', 'Bloodchief Ascension', 'Chandra, Fire Artisan', 'Kunoros, Hound of Athreos', 'Brineborn Cutthroat', 'Vraska, Relic Seeker', 'Oust', 'Sire of Insanity', 'Condemn', 'Ghitu Lavarunner', 'Captain Lannery Storm', 'Rapid Hybridization', 'Skyshroud Ranger', 'Soul Stair Expedition', 'Mistcutter Hydra', 'Implement of Malice', 'Gonti, Lord of Luxury', 'Rile', 'Scattered Groves', 'Enter the God-Eternals', 'Crumbling Vestige', 'Notion Thief', 'Llanowar Augur', 'Might of Old Krosa', 'Apex of Power', 'Golgari Guildgate', 'Reap the Past', 'Thalia, Heretic Cathar', 'Scurry Oak', 'Temple of Deceit', 'Spikefield Hazard', 'Pelakka Predation', 'Lost Auramancers', 'Blinkmoth Nexus', 'Obsidian Charmaw', 'Mirran Crusader', 'Blood Servitor', 'Dragonskull Summit', 'Flaying Tendrils', 'Infuriate', 'Polukranos, Unchained', 'Thragtusk', 'Glacial Fortress', 'Lab Rats', 'Cabal Stronghold', 'Bring to Light', 'Kami of False Hope', 'Ramunap Excavator', 'Augur of Skulls', 'Ruin Crab', 'Kappa Tech-Wrecker', 'Lonely Sandbar', 'Chief Engineer', 'Boreal Druid', 'Waker of Waves', 'Ritual of Soot', 'Porphyry Nodes', 'Ancient Stirrings', 'Prohibit', 'Jwari Disruption', 'Midnight Reaper', 'Gitaxian Probe', 'Filigree Familiar', 'Favored Hoplite', 'Goldmire Bridge', 'Goldhound', 'Soul''s Attendant', 'Korlash, Heir to Blackblade', 'Thought Scour', 'Starstorm', 'Rootbound Crag', 'Ethersworn Sphinx', 'Jaya Ballard, Task Mage', 'Fact or Fiction', 'Abiding Grace', 'Melira, Sylvok Outcast', 'Viscera Seer', 'Sorin, Vengeful Bloodlord', 'Priest of the Haunted Edge', 'Chandra, the Firebrand', 'Boon Satyr', 'Chandra, Pyromaster', 'Grand Architect', 'Sylvan Primordial', 'Fatal Grudge', 'Elvish Mystic', 'Obscura Ascendancy', 'Tangle', 'Satyr Wayfinder', 'Timeless Dragon', 'Elixir of Immortality', 'Ruric Thar, the Unbowed', 'Tyrant''s Scorn', 'Shard Volley', 'Simic Guildgate', 'Fanatical Firebrand', 'Seekers'' Squire', 'Tempest Djinn', 'Strike It Rich', 'Power Sink', 'Hour of Promise', 'Mythos of Nethroi', 'Temple of Enlightenment', 'Cruel Edict', 'Haze of Rage', 'Syr Faren, the Hengehammer', 'Summoning Station', 'Priest of Fell Rites', 'Stronghold Arena', 'Expedite', 'Unholy Heat', 'Grenzo, Dungeon Warden', 'Exhaustion', 'Izzet Boilerworks', 'Reaper King', 'Reckless Charge', 'Mortician Beetle', 'Fog', 'Hornet Nest', 'Temple of Mystery', 'Sovereign''s Bite', 'Eldrazi Skyspawner', 'Hatching Plans', 'Broodmate Dragon', 'Acolyte of Affliction', 'Sarkhan, the Dragonspeaker', 'Llanowar Elves', 'Predator''s Gambit', 'Hero''s Downfall', 'Seething Song', 'Nomad Outpost', 'Ominous Parcel', 'Jace, Unraveler of Secrets', 'Draconic Roar', 'Arcane Sanctum', 'Hinterland Harbor', 'Mystic Crusader', 'Temple of Malady', 'Blazing Shoal', 'Smiting Helix', 'Radiant Grove', 'Orbs of Warding', 'Sphere of Safety', 'Crux of Fate', 'Keldon Flamesage', 'Orzhov Guildgate', 'Erebos''s Intervention', 'Devilish Valet', 'Reckless Waif', 'Squee, Goblin Nabob', 'Breya''s Apprentice', 'Abrade', 'Rift Sower', 'Treasure Map', 'Silverquill Command', 'Divest', 'Lead the Stampede', 'Double Vision', 'Eye of Nowhere', 'Magmatic Channeler', 'Endbringer', 'Calciform Pools', 'Forked Bolt', 'Nest Invader', 'Pilfer', 'Tanglepool Bridge', 'Nevermaker', 'Blossoming Sands', 'Painful Truths', 'Arguel''s Blood Fast', 'Sarkhan the Masterless'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 72.6, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (81.1 > 60.0) in mysql: ```

    SELECT

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

    FROM
        deck AS d

    LEFT JOIN
        competition AS c ON d.competition_id = c.id
    LEFT JOIN
        competition_series AS cs ON cs.id = c.competition_series_id
    LEFT JOIN
        competition_type AS ct ON ct.id = cs.competition_type_id

    LEFT JOIN
        deck_cache AS cache ON d.id = cache.deck_id
    LEFT JOIN deck_cache AS season ON d.id = season.deck_id
    WHERE
        (d.id IN (SELECT deck_id FROM deck_card WHERE card IN ('Sparring Regimen', 'Experiment One', 'Hornet Queen', 'Electrolyze', 'Tide Shaper', 'Life Goes On', 'Thaumatic Compass', 'Blastoderm', 'Wayward Guide-Beast', 'Barren Moor', 'Countersquall', 'Suture Priest', 'Fblthp, the Lost', 'Riding the Dilu Horse', 'Glint-Sleeve Siphoner', 'Bazaar Trademage', 'Golden Wish', 'Labyrinth of Skophos', 'End-Raze Forerunners', 'Tresserhorn Sinks', 'Elixir of Immortality', 'Boros Guildgate', 'Trash for Treasure', 'Approach of the Second Sun', 'Abiding Grace', 'Hour of Promise', 'Geth''s Grimoire', 'Condemn', 'Ninth Bridge Patrol', 'Jwari Disruption', 'Doomed Traveler', 'Hostile Desert', 'Thought Scour', 'Avaricious Dragon', 'Syncopate', 'Into the Roil', 'Sylvan Library', 'Jace, Unraveler of Secrets', 'Sorin, Grim Nemesis', 'Ranger of Eos', 'Boros Reckoner', 'Bearer of Silence', 'Eldrazi Skyspawner', 'Man-o''-War', 'Rune Snag', 'World at War', 'Thopter Foundry', 'Chief Engineer', 'Glimmerpoint Stag', 'Magus of the Vineyard', 'Balmor, Battlemage Captain', 'Grisly Salvage', 'Idyllic Grange', 'Silverbluff Bridge', 'Augur of Bolas', 'Obscura Ascendancy', 'Golgari Guildgate', 'Orzhov Guildgate', 'Kyodai, Soul of Kamigawa', 'Immersturm Predator', 'Wilt', 'Chandra''s Phoenix', 'Crimson Wisps', 'Keldon Flamesage', 'Coalition Relic', 'Infuriate', 'Leonin Lightscribe', 'Stoic Rebuttal', 'Galvanic Relay', 'Obscura Storefront', 'Tyrant''s Scorn', 'Sylvan Anthem', 'Escape to the Wilds', 'Malakir Rebirth', 'Naru Meha, Master Wizard', 'Plea for Guidance', 'Elsewhere Flask', 'Boreal Druid', 'Callous Dismissal', 'Mikaeus, the Lunarch', 'Tectonic Edge', 'Forked Bolt', 'Silverquill Silencer', 'Archon of Sun''s Grace', 'Diabolic Tutor', 'Spatial Contortion', 'Slaughter Games', 'Squee, Goblin Nabob', 'March of Swirling Mist', 'Forsaken Sanctuary', 'Disrupting Shoal', 'Cleric of Life''s Bond', 'Gruul Guildgate', 'Enigma Sphinx', 'Caustic Caterpillar', 'Laboratory Maniac', 'Forbidden Alchemy', 'Selesnya Sanctuary', 'Ground Seal', 'Ohran Viper', 'Tangled Islet', 'Simic Signet', 'Lathliss, Dragon Queen', 'Reaper King', 'Endless One', 'Fire-Lit Thicket', 'Lumbering Falls', 'Pelt Collector', 'Sprite Dragon', 'Nevinyrral''s Disk', 'Sandsteppe Citadel', 'Vampire Nighthawk', 'Chromatic Lantern', 'Woe Strider', 'Herald of the Pantheon', 'Shore Up', 'Engulf the Shore', 'Thornglint Bridge', 'Darkmoss Bridge', 'Thassa''s Intervention', 'Scaled Herbalist', 'Notion Thief', 'Touch the Spirit Realm', 'Terminus', 'Fetid Pools', 'Fertile Ground', 'Skarrgan Pit-Skulk', 'Price of Progress', 'Thalia, Heretic Cathar', 'Brain Freeze', 'Summoning Station', 'Vilis, Broker of Blood', 'Moon-Circuit Hacker', 'Baffling End', 'Pyrite Spellbomb', 'Gallia of the Endless Dance', 'Putrid Imp', 'Fabricate', 'Upheaval', 'Gideon''s Intervention', 'Kessig Wolf Run', 'Grim Initiate', 'Exhaustion', 'Bad River', 'Safehold Elite', 'Unholy Heat', 'Sylvan Ranger', 'Luminarch Ascension', 'Skyclave Relic', 'Diamond Lion', 'Urza''s Rage', 'Hieroglyphic Illumination', 'Memoricide', 'Blessed Respite', 'Dissipation Field', 'Umezawa''s Charm', 'Warlord''s Fury', 'Slitherwisp', 'Sigil of the Empty Throne', 'Grafted Wargear', 'Feed the Swarm', 'Draining Whelk', 'Great Sable Stag', 'Displace', 'Oath of Liliana', 'Braingeyser', 'Glowstone Recluse', 'Korlash, Heir to Blackblade', 'Elas il-Kor, Sadistic Pilgrim', 'Commit // Memory', 'Cult Conscript', 'Sweltering Suns', 'Blasphemous Act', 'Rule of Law', 'Defiant Strike', 'Sorin Markov', 'Sacred Ground', 'Psychatog', 'In Search of Greatness', 'Sanguine Bond', 'Walking Atlas', 'Fanatical Firebrand', 'Illuminator Virtuoso', 'Bloom Tender', 'Archfiend''s Vessel', 'Stone Rain', 'God-Pharaoh''s Gift', 'Agonizing Remorse', 'Waterveil Cavern', 'Temple of Malice', 'Intervention Pact', 'End Hostilities', 'Inspiring Overseer', 'Ajani''s Pridemate', 'Blightning', 'Fearless Pup', 'Scurry Oak', 'Jace Beleren', 'Ixalan''s Binding', 'Flame Blitz', 'Captain Lannery Storm', 'Runed Halo', 'Abundance', 'Chrome Courier', 'Lizard Blades', 'Inquisitor Exarch', 'Neutralize', 'Aetherflux Reservoir', 'Earthshaker Khenra', 'Sunstrike Legionnaire', 'Clifftop Retreat', 'Shrapnel Blast', 'Phyrexian Revoker', 'Migratory Greathorn', 'Mirari''s Wake', 'Sphinx''s Tutelage', 'Izzet Charm', 'Commune with Spirits', 'Heartless Act', 'Glittering Wish', 'Avacyn''s Pilgrim', 'Thryx, the Sudden Storm', 'Nimbus Maze', 'Orbs of Warding', 'Aether Adept', 'Trumpeting Gnarr', 'Hermit Druid', 'Stubborn Denial', 'Genesis', 'Dreadhorde Butcher', 'Phoenix Chick', 'Gladecover Scout', 'Font of Fertility', 'Yosei, the Morning Star', 'Rime Tender', 'Pharika''s Libation', 'Intruder Alarm', 'Champion of Wits', 'Prohibit', 'Vryn Wingmare', 'Negate', 'Pact of the Titan', 'Prismatic Lens', 'Favored Hoplite', 'King Darien XLVIII', 'Rally the Ancestors', 'Dire Fleet Poisoner', 'Disdainful Stroke', 'Fleetfoot Dancer', 'Seal of Fire', 'Curse of Death''s Hold', 'Devilish Valet', 'Nadaar, Selfless Paladin', 'Walk the Aeons', 'Siege Rhino', 'Secluded Courtyard', 'Corrupted Crossroads', 'Mistvault Bridge', 'Soul Warden', 'Magister of Worth', 'Sorin, Vengeful Bloodlord', 'Obsidian Charmaw', 'Zulaport Cutthroat', 'Sylvan Awakening', 'Razortide Bridge', 'Vivid Marsh', 'Breakthrough', 'Jeskai Ascendancy', 'Dismal Backwater', 'Tempest Djinn', 'Dreamtail Heron', 'Thraben Inspector', 'Dromoka''s Command', 'Triskelion', 'Monk Idealist', 'Serrated Scorpion', 'Sunken Hope', 'Balustrade Spy', 'Temple of Deceit', 'Burst Lightning', 'Faerie Miscreant', 'Grasslands', 'Thawing Glaciers', 'Helm of Kaldra', 'Garruk Relentless', 'Obsessive Search', 'Brokers Hideout', 'Bane of Bala Ged', 'Dovescape', 'Cathartic Reunion', 'Circuit Mender', 'Cruel Ultimatum', 'Founding the Third Path', 'Ornithopter', 'Garruk''s Harbinger', 'Sylvan Primordial', 'Prophetic Prism', 'Crystal Grotto', 'Syr Faren, the Hengehammer', 'Hard Evidence', 'Legacy Weapon', 'Lazotep Plating', 'Make Disappear', 'Jace''s Erasure', 'Vitu-Ghazi, the City-Tree', 'Crash Through', 'Dictate of Kruphix', 'Jadelight Ranger', 'Anafenza, Kin-Tree Spirit', 'Treasure Cruise', 'Arctic Flats', 'Oust', 'Barkhide Troll', 'Silundi Vision', 'Ruin Raider', 'Become Immense', 'Froghemoth', 'Marit Lage''s Slumber', 'Aetherspouts', 'Goblin Electromancer', 'Buried Alive', 'Power Depot', 'Orator of Ojutai', 'Undertaker', 'Grapeshot', 'Sunpetal Grove', 'Run Amok', 'Soul Stair Expedition', 'Hanweir Garrison', 'Liliana Vess', 'Yorvo, Lord of Garenbrig', 'Bramblesnap', 'Mesmeric Fiend', 'Bloodthrone Vampire', 'Starstorm', 'Maze''s End', 'Tamiyo, Collector of Tales', 'Patchwork Automaton', 'Trickbind', 'Recurring Nightmare', 'Coldsteel Heart', 'Kefnet the Mindful', 'Disallow', 'Nameless Inversion', 'Thrill of Possibility', 'Vendetta', 'Archangel of Wrath', 'Benevolent Bodyguard', 'Escape Protocol', 'Expedite', 'Mnemonic Wall', 'Glorybringer', 'Embereth Shieldbreaker', 'Phyrexian Metamorph', 'Bedevil', 'Imposing Vantasaur', 'Shatter the Sky', 'Fraying Sanity', 'Kederekt Parasite', 'Darksteel Citadel', 'Dimir Charm', 'Blistercoil Weird', 'Jace, Architect of Thought', 'Crumbling Necropolis', 'Exclude', 'Skyshroud Ranger', 'Inquisitive Puppet', 'Night of Souls'' Betrayal', 'Lost Auramancers', 'Golgari Rot Farm', 'Semester''s End', 'Teachings of the Kirin', 'Breya''s Apprentice', 'Deranged Hermit', 'Lonis, Cryptozoologist', 'Forgotten Cave', 'Sylvan Scrying', 'Temple of Enlightenment', 'Devastating Summons', 'Bonders'' Enclave', 'Reckless Waif', 'Impede Momentum', 'River of Tears', 'Nemata, Primeval Warden', 'Priest of Urabrask', 'Cabaretti Courtyard', 'Seal of Primordium', 'Lavaclaw Reaches', 'Winter''s Rest', 'Faerie Vandal', 'Thrumming Stone', 'Molten Tributary', 'Rampant Growth', 'Putrid Goblin', 'Volcanic Salvo', 'Grand Architect', 'Fleecemane Lion', 'Goblin Dark-Dwellers', 'Eye of Vecna', 'Wasteland Strangler', 'Baru, Fist of Krosa', 'Gods Willing', 'Goldmire Bridge', 'Lovestruck Beast', 'Ravaging Blaze', 'Implement of Improvement', 'Elves of Deep Shadow', 'Bone Dragon', 'Lead the Stampede', 'Dire Fleet Daredevil', 'Ivy Lane Denizen', 'Josu Vess, Lich Knight', 'Judge''s Familiar', 'Acidic Slime', 'Phylath, World Sculptor', 'Shenanigans', 'Isolated Chapel', 'Dead Weight', 'Scrabbling Claws', 'Commune with the Gods', 'Mina and Denn, Wildborn', 'Blinkmoth Nexus', 'Sulfurous Blast', 'Azorius Charm', 'Knight of the White Orchid', 'Risk Factor', 'Cryptic Caves', 'Blackmail', 'Shriekhorn', 'Pilfer', 'Solemnity', 'Calciform Pools', 'Marauding Blight-Priest', 'Aven Heartstabber', 'Stronghold Arena', 'Sheltered Thicket', 'Gatekeeper of Malakir', 'Sire of Insanity', 'Hurloon Battle Hymn', 'Grapple with the Past', 'Kazandu Mammoth', 'Summer Bloom', 'Timeless Dragon', 'Liquimetal Torque', 'Tamiyo''s Safekeeping', 'Witching Well', 'Nine Lives', 'Martial Coup', 'Pull from Tomorrow', 'Magus of the Tabernacle', 'Quiet Speculation', 'Crack the Earth', 'Midnight Guard', 'Torment of Scarabs', 'Electrostatic Infantry', 'Pathrazer of Ulamog', 'Locket of Yesterdays', 'Temple of Silence', 'Kami of False Hope', 'Entrancing Melody', 'Ambush Viper', 'Wavebreak Hippocamp', 'Valakut Exploration', 'Dimir Guildgate', 'Qasali Pridemage', 'Warped Devotion', 'Seething Song', 'Rofellos, Llanowar Emissary', 'Bala Ged Recovery', 'Ral, Izzet Viceroy', 'Ghor-Clan Rampager', 'Jungle Hollow', 'Kaervek, the Spiteful', 'Out of Time', 'Rix Maadi Reveler', 'Gruul Turf', 'Smiting Helix', 'Blossoming Sands', 'Multiple Choice', 'Glowspore Shaman', 'Teferi, Mage of Zhalfir', 'Ravenous Chupacabra', 'Spoils of the Vault', 'Dawn of Hope', 'Hornet Nest', 'Deny Reality', 'Implement of Malice', 'Foundry Street Denizen', 'Mystifying Maze', 'Academy Wall', 'Myth Realized', 'Astral Drift', 'Rustvale Bridge', 'Sarkhan the Mad', 'Shrine of the Forsaken Gods', 'Alchemist''s Refuge', 'Undercity Informer', 'Cruel Reality', 'Mirran Crusader', 'Rona''s Vortex', 'Chromium, the Mutable', 'Omen of the Sea', 'Abrade', 'Ivy, Gleeful Spellthief', 'Spawning Pool', 'Eerie Interlude', 'Slaughter Pact', 'Ritual of Soot', 'Hall of Oracles', 'Fires of Yavimaya', 'Haunted Mire', 'Zurgo Bellstriker', 'Filigree Familiar', 'Rob the Archives', 'Insatiable Hemophage', 'Darksteel Colossus', 'Okina, Temple to the Grandfathers', 'Silverquill Command', 'Forsake the Worldly', 'The Flame of Keld', 'Mulch', 'Broodmate Dragon', 'Trace of Abundance', 'Wall of Omens', 'Narcomoeba', 'Ghoulcaller''s Bell', 'Earthquake', 'Charge Through', 'Cloudshift', 'Glimmerpost', 'Mistcaller', 'Pulse of the Grid', 'Cut Down', 'Hobgoblin Captain', 'Demanding Dragon', 'Bladewing''s Thrall', 'Crawling Barrens', 'Sword of Kaldra', 'Soul''s Attendant', 'Banefire', 'Improbable Alliance', 'Erebos''s Intervention', 'Tidespout Tyrant', 'Lost Legacy', 'The Raven''s Warning', 'Sign in Blood', 'Goblin Assault', 'Shivan Reef', 'Astral Slide', 'Gavony Township', 'Vesperlark', 'Academy Loremaster', 'Angel''s Grace', 'Reality Acid', 'Force of Virtue', 'Ghost Quarter', 'Aether Spellbomb', 'Deep Analysis', 'Midnight Clock', 'Kathari Remnant', 'Nephalia Drownyard', 'Blacklance Paragon', 'Brindle Shoat', 'Momentary Blink', 'Fatal Grudge', 'Brokkos, Apex of Forever', 'An Offer You Can''t Refuse', 'Far // Away', 'Llanowar Elves', 'Obzedat, Ghost Council', 'Tenth District Legionnaire', 'Hypnotic Specter', 'Ponder', 'Emmara, Soul of the Accord', 'Pyretic Ritual', 'Skyclave Shade', 'Unearth', 'Lantern-Lit Graveyard', 'Experimental Synthesizer', 'Forerunner of the Coalition', 'Ghostly Flicker', 'Boreal Shelf', 'Sea-Dasher Octopus', 'Fast // Furious', 'Curse of Misfortunes', 'Soulfire Grand Master', 'Jukai Naturalist', 'Geomancer''s Gambit', 'Carven Caryatid', 'Slagwoods Bridge', 'March of the Machines', 'Séance', 'Char', 'Stormcaller''s Boon', 'Lightning Strike', 'Night Clubber', 'Sudden Edict', 'Judith, the Scourge Diva', 'Drakuseth, Maw of Flames', 'Necromancer''s Stockpile', 'Golgari Brownscale', 'Isareth the Awakener', 'Verix Bladewing', 'Jorn, God of Winter', 'Ominous Parcel', 'Dissipate', 'Phantasmagorian', 'Jewel Thief', 'Karrthus, Tyrant of Jund', 'Ichorclaw Myr', 'Tolarian Terror', 'Midnight Reaper', 'Blazing Shoal', 'Plaza of Harmony', 'Oni-Cult Anvil', 'Blessed Alliance', 'Myr Landshaper', 'Pentad Prism', 'Flametongue Yearling', 'Villainous Wealth', 'Haze of Rage', 'Voldaren Pariah', 'Arlinn Kord', 'Grim Lavamancer', 'Platinum Angel', 'Wayward Swordtooth', 'Startled Awake', 'Seaside Citadel', 'Lochmere Serpent', 'Drowned Catacomb', 'Venser, Shaper Savant', 'Bone Shards', 'Spore Frog', 'Gonti, Lord of Luxury', 'Imperial Mask', 'Snow-Covered Plains', 'Daring Buccaneer', 'Virus Beetle', 'Codex Shredder', 'Fact or Fiction', 'Vivid Meadow', 'Hero''s Downfall', 'Ominous Seas', 'Stromkirk Noble', 'Blazing Rootwalla', 'Evolving Wilds', 'Double Vision', 'Diabolic Edict', 'Radiant Grove', 'Sea Gate Oracle', 'Elvish Scrapper', 'Bloodsoaked Champion', 'Boon Satyr', 'Dihada''s Ploy', 'Goldhound', 'Delver of Secrets', 'Dauntless Bodyguard', 'Mindslaver', 'Desecration Demon', 'Etherium Sculptor', 'Skullscorch', 'Flourishing Fox', 'Sphinx of the Steel Wind', 'Tyrant''s Choice', 'Consult the Necrosages', 'Vindicate', 'Jund Charm', 'Bazaar Trader', 'Slip Out the Back', 'Jokulhaups', 'Dread Return', 'Verduran Enchantress', 'Kor Skyfisher', 'Blood Baron of Vizkopa', 'Megrim', 'Sylvan Advocate', 'Tasigur, the Golden Fang', 'Broodhatch Nantuko', 'Chandra, Pyromaster', 'Barbarian Ring', 'Gravelighter', 'Glacial Fortress', 'Drowner of Hope', 'Simic Charm', 'Radha, Heart of Keld', 'Ertai''s Scorn', 'Urza''s Factory', 'Rootbound Crag', 'Rabbit Battery', 'Authority of the Consuls', 'Viscera Seer', 'Lose Focus', 'Snow-Covered Forest', 'Skyclave Cleric', 'Lightning Axe', 'Commence the Endgame', 'Drossforge Bridge', 'Shrine of Burning Rage', 'Treasure Map', 'Greater Gargadon', 'Raiders'' Wake', 'Rakdos Cackler', 'Mirror Entity', 'Tranquil Thicket', 'Traumatize', 'Hatching Plans', 'Fists of Flame', 'Retriever Phoenix', 'Inscription of Ruin', 'Krosan Wayfarer', 'Postmortem Lunge', 'Forsworn Paladin', 'Dark Petition', 'Nicol Bolas, God-Pharaoh', 'Fauna Shaman', 'Azusa''s Many Journeys', 'Domri, Anarch of Bolas', 'Flicker of Fate', 'Blackbloom Rogue', 'Leonin Relic-Warder', 'Panoptic Mirror', 'Dragonskull Summit', 'Kogla, the Titan Ape', 'Llanowar Augur', 'Sudden Death', 'Mistveil Plains', 'Basking Rootwalla', 'Eldrazi Mimic', 'Lantern Bearer', 'Desert of the Indomitable', 'Cunning Nightbonder', 'Fists of Ironwood', 'Deathless Knight', 'Rakdos Guildgate', 'Murderous Redcap', 'Pillage', 'Mana Leak', 'Desert of the True', 'Shriekmaw', 'Precursor Golem', 'Sheltering Ancient', 'Pack Rat', 'Bolas''s Citadel', 'Regal Force', 'Kolaghan, the Storm''s Fury', 'Decree of Justice', 'Hellkite Overlord', 'Jungle Shrine', 'Scourge Devil', 'Raven''s Crime', 'Sterling Grove', 'Prophetic Bolt', 'Oran-Rief, the Vastwood', 'Command the Dreadhorde', 'Gideon Jura', 'Acolyte of Affliction', 'Yahenni''s Expertise', 'Swans of Bryn Argoll', 'Distortion Strike', 'Desperate Ravings', 'Tidehollow Sculler', 'Boomerang', 'Consume the Meek', 'Phyrexian Missionary', 'Bloodchief''s Thirst', 'Brazen Upstart', 'Kabira Takedown', 'Priest of the Haunted Edge', 'Dead of Winter', 'Muddle the Mixture', 'Prism Ring', 'Curse of Exhaustion', 'Overgrowth', 'Shield of Kaldra', 'Boon of the Wish-Giver', 'Shivan Wurm', 'Cartel Aristocrat', 'Angel of Despair', 'Painful Truths', 'Mastermind''s Acquisition', 'Firebolt', 'Porphyry Nodes', 'Spell Burst', 'Gloomshrieker', 'Endbringer', 'Pollywog Symbiote', 'Gilded Lotus', 'Release to the Wind', 'Abominable Treefolk', 'Kunoros, Hound of Athreos', 'Azorius Guildgate', 'Melira, Sylvok Outcast', 'Myr Battlesphere', 'Raffine''s Informant', 'Arch of Orazca', 'Salvaging Station', 'Blighted Agent', 'Riftwing Cloudskate', 'Dinrova Horror', 'Revitalize', 'Dragon''s Hoard', 'Nevermaker', 'Search for Tomorrow', 'Radha''s Firebrand', 'Selesnya Guildgate', 'Greenbelt Rampager', 'Chandra, Flamecaller', 'Bedlam Reveler', 'Orzhov Pontiff', 'Magmatic Channeler', 'Sky Tether', 'Scrapheap Scrounger', 'Thragtusk', 'Psychic Strike', 'Hour of Revelation', 'Mishra''s Factory', 'Angel of Glory''s Rise', 'Draconic Roar', 'Glacial Revelation', 'Rift Sower', 'Increasing Ambition', 'Invigorate', 'Tomb of Urami', 'Time of Need', 'Putrefy', 'Ghostfire Blade', 'Dimir Signet', 'Gods'' Eye, Gate to the Reikai', 'Soldier of the Pantheon', 'Drizzt Do''Urden', 'Liliana''s Caress', 'Llanowar Scout', 'Scoured Barrens', 'Raging Ravine', 'Feather, the Redeemed', 'Grave Scrabbler', 'Lab Rats', 'Canyon Slough', 'Tunneling Geopede', 'Profane Command', 'Into the North', 'Timely Reinforcements', 'Big Game Hunter', 'Smuggler''s Copter', 'The Modern Age', 'Reckless Rage', 'Haakon, Stromgald Scourge', 'The Phasing of Zhalfir', 'Bring to Light', 'Evacuation', 'Rune-Scarred Demon', 'Liquimetal Coating', 'Force of Rage', 'Oath of Teferi', 'Prophet of Kruphix', 'Verdurous Gearhulk', 'Peer Through Depths', 'Artisan of Kozilek', 'Frostwalk Bastion', 'Empty the Warrens', 'Ashes of the Abhorrent', 'Oblivion Ring', 'Scattered Groves', 'Forbid', 'Thirst for Knowledge', 'Vexing Shusher', 'Blade Splicer', 'Spirited Companion', 'Memory Lapse', 'Domri Rade', 'Primalcrux', 'Skyblade''s Boon', 'Abyssal Persecutor', 'Chandra Nalaar', 'Hallowed Moonlight', 'Arcum''s Astrolabe', 'Control Magic', 'Presence of Gond', 'Priest of Fell Rites', 'Foundation Breaker', 'Kaya, Ghost Assassin', 'Strangle', 'Sphere of the Suns', 'Aspect of Hydra', 'Power Sink', 'Rotting Rats', 'Cabal Stronghold', 'Ash Zealot', 'Waker of Waves', 'Erayo, Soratami Ascendant', 'Cleansing Wildfire', 'Rite of Consumption', 'Jolrael, Mwonvuli Recluse', 'Izzet Signet', 'Reclamation Sage', 'Explosive Singularity', 'Galepowder Mage', 'Halimar Depths', 'Lesser Masticore', 'Raking Claws', 'Terrarion', 'Temporal Adept', 'Relentless Rats', 'Mass Hysteria', 'Tourach''s Canticle', 'Vapor Snag', 'Lava Coil', 'Duress', 'Glistener Elf', 'Braids''s Frightful Return', 'Tendrils of Agony', 'Vivid Grove', 'Woodfall Primus', 'Dreadhorde Invasion', 'Immolating Souleater', 'Voidslime', 'Relentless Assault', 'Tanglepool Bridge', 'Mythos of Nethroi', 'Flash of Insight', 'Nomad Outpost', 'Flood Plain', 'Volcanic Geyser', 'Ruric Thar, the Unbowed', 'Angel of Vitality', 'Temple of Mystery', 'Dance of the Manse', 'Mistcutter Hydra', 'Cruel Edict', 'Throne of the God-Pharaoh', 'Wood Elves', 'Origin Spellbomb', 'Tainted Remedy', 'Mizzium Mortars', 'Vraska, Relic Seeker', 'Vivid Creek', 'Plow Under', 'Tezzeret the Schemer', 'Opt', 'Garruk Wildspeaker', 'March of Reckless Joy', 'Burning-Tree Emissary', 'Memory Leak', 'Kappa Tech-Wrecker', 'Turnabout', 'Waves of Aggression', 'Sunscorched Desert', 'Reap the Past', 'Induced Amnesia', 'Blood Artist', 'Simian Sling', 'Sol Talisman', 'Bump in the Night', 'Cloudpost', 'Nicol Bolas, Planeswalker', 'Blue Sun''s Zenith', 'Beacon of Tomorrows', 'Enduring Ideal', 'Retreat to Coralhelm', 'Awakening Zone', 'Immortal Coil', 'Elvish Visionary', 'Spell Pierce', 'Zombie Infestation', 'Glint Hawk', 'Bogardan Hellkite', 'Incinerate', 'Crux of Fate', 'Sacred Peaks', 'Carnage Altar', 'Augur of Skulls', 'Arguel''s Blood Fast', 'Ilysian Caryatid', 'Dusk Mangler', 'Niv-Mizzet, Parun', 'Selfless Savior', 'Orim''s Chant', 'Rivaz of the Claw', 'Storm Entity', 'Arcane Sanctum', 'Kessig Prowler', 'Tameshi, Reality Architect', 'Abzan Charm', 'Tribute to Horobi', 'Mystic Crusader', 'Tear Asunder', 'Jace, Memory Adept', 'Spikefield Hazard', 'Day of Judgment', 'Altar of the Brood', 'Geothermal Bog', 'Harmonize', 'Snapback', 'Lashwrithe', 'Black Sun''s Zenith', 'Wandering Fumarole', 'Dark Ritual', 'Magmatic Insight', 'Padeem, Consul of Innovation', 'Defiler of Flesh', 'Terror of Mount Velus', 'Temple of Plenty', 'Ghitu Encampment', 'Aria of Flame', 'Kitchen Imp', 'Seal of Removal', 'Ad Nauseam', 'Vines of Vastwood', 'Abundant Harvest', 'Coiling Oracle', 'Cultivate', 'Theater of Horrors', 'Silver Scrutiny', 'Chained to the Rocks', 'Tectonic Giant', 'Ghitu Lavarunner', 'Eye of Nowhere', 'Skybind', 'Flame Rift', 'Scab-Clan Berserker', 'Kargan Intimidator', 'Story Circle', 'Dragon Tempest', 'Thieving Skydiver', 'Smallpox', 'Gigadrowse', 'Phyrexian Dreadnought', 'Tamiyo''s Compleation', 'Auramancer', 'Caves of Koilos', 'Simic Guildgate', 'Elvish Mystic', 'Repeal', 'Maestros Charm', 'Joraga Treespeaker', 'Crumbling Vestige', 'Desert of the Mindful', 'Braids, Cabal Minion', 'Dakmor Salvage', 'Wasitora, Nekoru Queen', 'Swiftwater Cliffs', 'Yavimaya Coast', 'Doom Foretold', 'Nihil Spellbomb', 'Thorn of Amethyst', 'Fog', 'Essence Capture', 'Volcano Hellion', 'Honor of the Pure', 'Mirrodin Besieged', 'Aegis of the Gods', 'Mystical Teachings', 'Geyadrone Dihada', 'Stillmoon Cavalier', 'Fervent Champion', 'Mathas, Fiend Seeker', 'Nevermore', 'Scout''s Warning', 'Might of Old Krosa', 'Makeshift Mannequin', 'Burning Inquiry', 'Sanguine Sacrament', 'Wharf Infiltrator', 'Izzet Boilerworks', 'Sultai Charm', 'Scalding Cauldron', 'Silumgar''s Scorn', 'Feasting Troll King', 'Experimental Frenzy', 'Harmless Offering', 'Ancient Stirrings', 'Kuldotha Rebirth', 'Condescend', 'Enter the God-Eternals', 'Sarkhan the Masterless', 'Feast of Sanity', 'Oath of Gideon', 'Mire Triton', 'Maestros Theater', 'Steel Hellkite', 'Nivmagus Elemental', 'Gutterbones', 'Timeless Witness', 'Call the Bloodline', 'Voldaren Bloodcaster', 'Rootwater Depths', 'Snow-Covered Swamp', 'Collateral Damage', 'Dream Trawler', 'Sarkhan, the Dragonspeaker', 'Strategic Planning', 'Vraska''s Contempt', 'Shard Volley', 'Echoing Return', 'Tireless Provisioner', 'Pieces of the Puzzle', 'Akroan Crusader', 'Desert of the Glorified', 'Renegade Tactics', 'Ring of Ma''rûf', 'Wall of Blossoms', 'Game Trail', 'Ramunap Excavator', 'Impulse', 'Gitaxian Probe', 'Furious Bellow', 'Protean Hulk', 'Fyndhorn Elves', 'Crystal Shard', 'Grimdancer', 'Perilous Research', 'Doom Blade', 'Witness Protection', 'Seasons Past', 'Bloodvial Purveyor', 'Contaminated Aquifer', 'Blind Obedience', 'Satyr Wayfinder', 'Cathedral of War', 'Dragonstorm', 'Hypnotic Sprite', 'Frantic Search', 'Blood Servitor', 'Braid of Fire', 'Reckless Charge', 'Terramorphic Expanse', 'Sunlit Marsh', 'Slagstorm', 'Radiant Fountain', 'Tangled Florahedron', 'Oviya Pashiri, Sage Lifecrafter', 'Arc Trail', 'Tombstalker', 'Unburial Rites', 'Disciple of the Vault', 'Parcelbeast', 'Esper Charm', 'Battle of Wits', 'Lonely Sandbar', 'Thunderbreak Regent', 'Crowd''s Favor', 'Secluded Steppe', 'Heartbeat of Spring', 'Brineborn Cutthroat', 'Dryad Militant', 'Search for Azcanta', 'Idyllic Beachfront', 'Anguished Unmaking', 'Inkwell Leviathan', 'Tragic Poet', 'It That Betrays', 'Shambling Vent', 'Simian Spirit Guide', 'Colossal Skyturtle', 'Rapid Hybridization', 'Meteor Golem', 'Keldon Marauders', 'Captured Sunlight', 'Parallax Wave', 'Shimmerdrift Vale', 'Tainted Indulgence', 'Reinforced Ronin', 'Idyllic Tutor', 'Ivory Tower', 'Kumano Faces Kakkazan', 'Fall of the Thran', 'Drannith Healer', 'Fae of Wishes', 'Fiery Temper', 'Thornwood Falls', 'Divest', 'Wipe Away', 'Flamewake Phoenix', 'Drift of Phantasms', 'Howling Mine', 'Alms of the Vein', 'Dusk // Dawn', 'Militia Bugler', 'Dimir Aqueduct', 'Dirge Bat', 'Pelakka Predation', 'Mortician Beetle', 'Oracle of Mul Daya', 'Radiant Flames', 'Grasping Dunes', 'Lingering Souls', 'Lull', 'Master of Death', 'The Cauldron of Eternity', 'Crackling Doom', 'Hanweir Battlements', 'Stormfist Crusader', 'Izzet Guildgate', 'Hive Mind', 'Flametongue Kavu', 'Rile', 'Eidolon of Obstruction', 'Traxos, Scourge of Kroog', 'Secure the Wastes', 'Mind Funeral', 'Graven Cairns', 'Dread Wanderer', 'Irencrag Feat', 'Restoration Angel', 'Ransack the Lab', 'Asylum Visitor', 'Birds of Paradise', 'Savage Swipe', 'Sever the Bloodline', 'River''s Rebuke', 'Darigaaz Reincarnated', 'Blossoming Calm', 'Azami, Lady of Scrolls', 'Conduit of Ruin', 'Opulent Palace', 'Empyrial Archangel', 'Combat Research', 'Buried Ruin', 'Enchantress''s Presence', 'Garza Zol, Plague Queen', 'Stirring Wildwood', 'Kiora, Master of the Depths', 'Sin Collector', 'Enlisted Wurm', 'Haunted Dead', 'Silence', 'Choking Sands', 'Squee, the Immortal', 'Emeria, the Sky Ruin', 'Solitary Confinement', 'Atarka, World Render', 'Sedraxis Specter', 'Kitesail Freebooter', 'Arbor Elf', 'Kazuul''s Fury', 'Compelling Deterrence', 'Ob Nixilis Reignited', 'Codie, Vociferous Codex', 'Tibalt''s Trickery', 'Kambal, Consul of Allocation', 'Ruin Crab', 'Tangle', 'Chain of Plasma', 'Hinterland Harbor', 'Saproling Burst', 'Quicken', 'Flaying Tendrils', 'Sphere of Safety', 'Polukranos, Unchained', 'Savage Beating', 'Fiend Hunter', 'Apex of Power', 'Thoughts of Ruin', 'Nightveil Specter', 'Orb of Dragonkind', 'Distended Mindbender', 'Think Twice', 'Zur the Enchanter', 'Temple of Malady', 'Silumgar, the Drifting Death', 'Zof Consumption', 'Disenchant', 'Sleight of Hand', 'Doomed Necromancer', 'Deep Forest Hermit', 'Network Disruptor', 'Herald of Anguish', 'Primal Command', 'Elvish Lyrist', 'The Underworld Cookbook', 'Aetherling', 'Strike It Rich', 'Dragon Turtle'))) AND (TRUE)
    GROUP BY 
        d.id,
        d.competition_id, -- Every deck has only one competition_id but if we want to use competition_id in the HAVING clause we need this.
        season.season_id -- In theory this is not necessary as all decks are in a single season and we join on the date but MySQL cannot work that out so give it the hint it needs.

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

```

[] (slow_query, 81.1, mysql)

Reported on decksite by mysql-perf

Location Hash: 6c3d9872dab887c20364f9226b0a2293b78af0de

Labels: decksite