PennyDreadfulMTG / perf-reports

2 stars 2 forks source link

Exceeded slow_query limit (86.4 > 60.0) in mysql: ``` #58320

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 ('Snow-Covered Swamp', 'Epochrasite', 'Kodama''s Reach', 'Opulent Palace', 'Wipe Away', 'Tavern Scoundrel', 'Emergent Ultimatum', 'Yusri, Fortune''s Flame', 'Boggart Harbinger', 'Bloodflow Connoisseur', 'Abundant Harvest', 'Tireless Provisioner', 'Hermit Druid', 'Dramatic Reversal', 'Temple of Enlightenment', 'Dragonskull Summit', 'Stirring Wildwood', 'Muddle the Mixture', 'Scion of Oona', 'Acolyte of Affliction', 'Grand Architect', 'Laboratory Maniac', 'Jaspera Sentinel', 'Glacial Floodplain', 'Nihil Spellbomb', 'Abbot of Keral Keep', 'Power Sink', 'Lost Auramancers', 'Swan Song', 'Desecration Demon', 'Unburial Rites', 'Scattered Groves', 'Blizzard Strix', 'Suspend', 'Bone Shards', 'Stormchaser Mage', 'Cerebral Vortex', 'Thopter Assembly', 'Infernal Grasp', 'Pyrite Spellbomb', 'Negate', 'Elvish Visionary', 'Fanatical Firebrand', 'Lodestone Golem', 'Hour of Promise', 'Worthy Knight', 'Vampire Nighthawk', 'Control Magic', 'Vindicate', 'Kitchen Imp', 'Time Sieve', 'Dwynen''s Elite', 'Yosei, the Morning Star', 'Dwynen, Gilt-Leaf Daen', 'Polukranos, Unchained', 'Master of the Feast', 'Mirror Gallery', 'Kuldotha Rebirth', 'Hymn to Tourach', 'Mistbind Clique', 'Mycosynth Wellspring', 'Academy Elite', 'Arcum''s Astrolabe', 'Golgari Guildgate', 'Tasigur, the Golden Fang', 'Aetherflux Reservoir', 'Crumbling Necropolis', 'Lochmere Serpent', 'Kiora Bests the Sea God', 'Repeal', 'Drowned Catacomb', 'Nivmagus Elemental', 'Mindwrack Demon', 'Trading Post', 'Meloku the Clouded Mirror', 'Merfolk Mistbinder', 'Collective Unconscious', 'Mistvault Bridge', 'Flood Plain', 'Pathrazer of Ulamog', 'Rite of Oblivion', 'Springleaf Drum', 'Blood Fountain', 'Raging Goblin', 'Bloodbraid Marauder', 'Okina, Temple to the Grandfathers', 'Invisible Stalker', 'Vraska, Relic Seeker', 'Venerable Knight', 'Azorius Guildgate', 'Sigil of Distinction', 'Setessan Champion', 'Death Grasp', 'Vapor Snag', 'Ral, Storm Conduit', 'Yahenni''s Expertise', 'Abiding Grace', 'Shambling Ghast', 'Shardless Agent', 'Lashwrithe', 'Izzet Charm', 'Scrabbling Claws', 'Thaumatic Compass', 'Resistance Squad', 'Jace, Memory Adept', 'Signal Pest', 'Empyrean Eagle', 'Tombstalker', 'Sylvan Library', 'Chandra, Pyromaster', 'Memory Lapse', 'Sigarda''s Splendor', 'Faithful Mending', 'Glint-Sleeve Siphoner', 'Angel of Despair', 'Pride of the Clouds', 'Sorin''s Vengeance', 'Spikefield Hazard', 'Kederekt Parasite', 'Jadelight Ranger', 'Unified Will', 'Spoils of the Vault', 'Dead // Gone', 'Rakdos Cackler', 'Seething Song', 'Temple of Deceit', 'Acidic Slime', 'Chain Lightning', 'Bloodchief''s Thirst', 'Slaughterhorn', 'Lorehold Command', 'Dread Fugue', 'Jace Beleren', 'Stromkirk Noble', 'Sudden Edict', 'Warden of Evos Isle', 'Fabricate', 'Strike It Rich', 'Mutilate', 'Nessian Wanderer', 'Sign in Blood', 'Catch // Release', 'Woodfall Primus', 'Spell Pierce', 'Throne of the God-Pharaoh', 'Fiery Gambit', 'Vault of the Archangel', 'Imperious Perfect', 'Mouth of Ronom', 'Pulse of the Grid', 'Tribute Mage', 'Final Parting', 'Tranquil Cove', 'Judge''s Familiar', 'Fire Prophecy', 'Putrid Goblin', 'Mesmeric Fiend', 'Quirion Ranger', 'Explore', 'Frogmite', 'Qasali Ambusher', 'Plague Stinger', 'Bond of Insight', 'Cultivate', 'Fact or Fiction', 'Dovin Baan', 'Timeless Witness', 'Rotting Rats', 'Nissa, Vastwood Seer', 'Endless Horizons', 'Nevinyrral''s Disk', 'Gates Ablaze', 'Angel of Glory''s Rise', 'Court Homunculus', 'Ayara, First of Locthwain', 'Tarfire', 'Think Twice', 'Choking Sands', 'Rootbound Crag', 'Tempest Djinn', 'Sandsteppe Citadel', 'Declaration in Stone', 'Fumigate', 'Jwari Disruption', 'Master of Death', 'Goldmire Bridge', 'Sunpetal Grove', 'Cascading Cataracts', 'Shamanic Revelation', 'Ulamog''s Crusher', 'Oona''s Blackguard', 'Slagstorm', 'Chance Encounter', 'Wall of Omens', 'Fertile Ground', 'Tendrils of Agony', 'Ancient Stirrings', 'Field of Ruin', 'Slaughter Pact', 'Monk of the Open Hand', 'Boros Guildgate', 'Kor Outfitter', 'Idyllic Tutor', 'Crawling Barrens', 'Mogg War Marshal', 'Thirst for Meaning', 'Grand Coliseum', 'Quest for the Holy Relic', 'Kor Skyfisher', 'Servo Exhibition', 'Clifftop Retreat', 'Liliana Vess', 'Merfolk Sovereign', 'Izzet Guildmage', 'Ice Tunnel', 'Orzhov Guildgate', 'Oread of Mountain''s Blaze', 'Izzet Cluestone', 'Glacial Fortress', 'Zephyr Sprite', 'River of Tears', 'Search for Azcanta', 'Raging Ravine', 'Prismari Campus', 'Sylvan Messenger', 'Snapback', 'Deep Analysis', 'Hornet Queen', 'Aviary Mechanic', 'Thirst for Discovery', 'Frantic Search', 'Renewed Faith', 'Aeve, Progenitor Ooze', 'Crumbling Vestige', 'Vedalken Shackles', 'Goblin Bushwhacker', 'Boomerang', 'Zurgo Bellstriker', 'Dauntless Bodyguard', 'Terramorphic Expanse', 'Reckless Impulse', 'Obstinate Baloth', 'Sterling Grove', 'Glistener Elf', 'Insolent Neonate', 'Azorius Charm', 'Clickslither', 'Adarkar Wastes', 'Bad River', 'Chandra, the Firebrand', 'High Tide', 'Dictate of Kruphix', 'King of the Pride', 'Prophetic Prism', 'Pride Sovereign', 'Enduring Ideal', 'Lich''s Mirror', 'Twincast', 'Asylum Visitor', 'Moon-Blessed Cleric', 'Exclude', 'Silundi Vision', 'Warren Weirding', 'Clever Lumimancer', 'Jace''s Archivist', 'Commence the Endgame', 'Steel Overseer', 'Sulfurous Springs', 'Archon of Sun''s Grace', 'Ichor Wellspring', 'Magus of the Scroll', 'Keldon Megaliths', 'Rain of Tears', 'Oust', 'Temple of Malice', 'Opt', 'Apostle''s Blessing', 'Kjeldoran Outpost', 'Heir of Falkenrath', 'Goblin Chieftain', 'Pack Rat', 'Elvish Archdruid', 'Staff of Nin', 'Treasure Cruise', 'Zareth San, the Trickster', 'Ignite Memories', 'Stitch in Time', 'Kokusho, the Evening Star', 'Charmed Stray', 'Filigree Familiar', 'Battle Screech', 'Fblthp, the Lost', 'Westvale Abbey', 'Bloodhall Priest', 'Smallpox', 'Goblin Matron', 'Tyrant''s Choice', 'Knight of the White Orchid', 'Nature''s Lore', 'Fate Unraveler', 'Alchemist''s Refuge', 'Gnarlwood Dryad', 'Brooding Saurian', 'Bedlam Reveler', 'Silence', 'Murmuring Bosk', 'Herald of the Pantheon', 'Marrow Shards', 'Academy Manufactor', 'Lost Legacy', 'Fading Hope', 'Escape to the Wilds', 'Snow-Covered Island', 'Behold the Multiverse', 'Divide by Zero', 'Sengir Autocrat', 'Simic Guildgate', 'Thassa''s Intervention', 'Shadow Guildmage', 'Dark Ritual', 'Commit // Memory', 'Hypnotic Specter', 'Gitaxian Probe', 'Phyrexia''s Core', 'Myr Superion', 'Zagoth Crystal', 'Wheel of Fate', 'Vault Skirge', 'Winged Portent', 'Orim''s Chant', 'Student of Warfare', 'Forbid', 'Arch of Orazca', 'Cryptolith Rite', 'Tainted Strike', 'Hope of Ghirapur', 'Mindslaver', 'Changeling Outcast', 'Inscription of Ruin', 'Mina and Denn, Wildborn', 'Teferi''s Puzzle Box', 'Detention Sphere', 'Cleansing Nova', 'Blessed Alliance', 'Reaper King', 'Yahenni, Undying Partisan', 'Woe Strider', 'Mishra''s Factory', 'Simian Spirit Guide', 'Evolving Wilds', 'Elvish Clancaller', 'Volcanic Salvo', 'Skycat Sovereign', 'Drownyard Temple', 'Fleecemane Lion', 'Sinister Concoction', 'Master of Etherium', 'Artificer''s Assistant', 'Icehide Golem', 'Vivid Marsh', 'Garruk''s Harbinger', 'The Raven''s Warning', 'Marwyn, the Nurturer', 'Stormscape Familiar', 'Tide Shaper', 'Myr Battlesphere', 'Etherium Sculptor', 'Forked Bolt', 'Sunscour', 'Sejiri Refuge', 'Regal Caracal', 'Winding Way', 'Chittering Rats', 'Solitary Confinement', 'Thought Scour', 'Mirran Crusader', 'Barbed Spike', 'Starstorm', 'Monastery Swiftspear', 'Day of Judgment', 'Grim Haruspex', 'Curiosity', 'Faerie Vandal', 'Rimewood Falls', 'Call for Unity', 'Reflector Mage', 'Eternal Dragon', 'Skophos Reaver', 'Highland Forest', 'Bronzehide Lion', 'Chainer, Nightmare Adept', 'Sheltered Thicket', 'Skarrg, the Rage Pits', 'Skirk Prospector', 'Foresee', 'Traverse the Ulvenwald', 'Seaside Citadel', 'The Underworld Cookbook', 'Fiery Impulse', 'Assault Strobe', 'Aetherspouts', 'Ravenous Baloth', 'Crux of Fate', 'Dispel', 'Gigadrowse', 'Sweltering Suns', 'Easy Prey', 'Treasure Map', 'Gnarlid Pack', 'Wizard Class', 'Mayor of Avabruck', 'Drawn from Dreams', 'Llanowar Wastes', 'Hostage Taker', 'Champion of Wits', 'Avacyn''s Pilgrim', 'The Birth of Meletis', 'Fall of the Thran', 'Ornithopter', 'Blue Sun''s Zenith', 'Goblin Ringleader', 'Abrade', 'Barbarian Ring', 'Solve the Equation', 'Arcbound Ravager', 'Moment of Craving', 'Baffling End', 'Farseek', 'Volatile Fjord', 'Ancestral Anger', 'Irencrag Pyromancer', 'Medomai the Ageless', 'Myth Realized', 'Barbed Shocker', 'Pristine Talisman', 'Deafening Silence', 'Molten Psyche', 'Woodland Chasm', 'Krark''s Thumb', 'Wirewood Savage', 'Silvergill Adept', 'Ancestral Statue', 'Guild Summit', 'Izzet Boilerworks', 'Ring of Three Wishes', 'Lightning Axe', 'Legion''s Landing', 'Commune with the Gods', 'Angelsong', 'Yavimaya Coast', 'Aetherize', 'Animate Dead', 'Mythos of Brokkos', 'Shrine of Loyal Legions', 'Runed Halo', 'Sorin, Grim Nemesis', 'Cackling Counterpart', 'Plaza of Harmony', 'Merrow Reejerey', 'Grafted Wargear', 'Geier Reach Sanitarium', 'Favorable Winds', 'Risk Factor', 'Enchantress''s Presence', 'Ghitu Lavarunner', 'Augur of Bolas', 'Squadron Hawk', 'Gobhobbler Rats', 'Knight Exemplar', 'Ondu Inversion', 'Quarantine Field', 'Frogtosser Banneret', 'Faerie Miscreant', 'Rakdos Guildgate', 'Elves of Deep Shadow', 'Gideon''s Intervention', 'Chief of the Foundry', 'Shaman of the Pack', 'Selesnya Guildgate', 'Darkmoss Bridge', 'Slagwoods Bridge', 'Chandra, Flame''s Catalyst', 'Sower of Temptation', 'Izzet Guildgate', 'Arcbound Mouser', 'Maze''s End', 'Legion Angel', 'Arctic Treeline', 'Knucklebone Witch', 'Lava Dart', 'Consider', 'Stormfist Crusader', 'Viscera Seer', 'Darksteel Pendant', 'Burning Inquiry', 'Sephara, Sky''s Blade', 'Garruk Wildspeaker', 'Blistercoil Weird', 'Migration Path', 'Leonin Warleader', 'Blazing Rootwalla', 'Mystical Teachings', 'Banishing Light', 'Duress', 'Mogg Fanatic', 'Nostalgic Dreams', 'Peer Through Depths', 'Bonesplitter', 'Mana Tithe', 'Hypnotic Sprite', 'Munitions Expert', 'Knight of the Holy Nimbus', 'Power Word Kill', 'Overgrowth', 'Chief Engineer', 'Council''s Judgment', 'Edge of Autumn', 'Treasure Mage', 'Neutralize', 'Pyretic Ritual', 'Shriekmaw', 'Empty the Pits', 'Erebos''s Intervention', 'Rakdos Guildmage', 'Long-Term Plans', 'Blighted Agent', 'Dubious Challenge', 'Urza''s Factory', 'Ingenious Infiltrator', 'Dream''s Grip', 'Fyndhorn Elves', 'Condemn', 'Snow-Covered Mountain', 'Satyr Wayfinder', 'Brain Freeze', 'Lantern of the Lost', 'Thraben Inspector', 'Silverbluff Bridge', 'Blackbloom Rogue', 'Cleansing Wildfire', 'Dream Trawler', 'Rally the Peasants', 'Tomb of Urami', 'Goblin Trashmaster', 'Arctic Flats', 'Dread Return', 'Tree of Tales', 'Delirium Skeins', 'Primal Command', 'Razortide Bridge', 'Ponder', 'Lonely Sandbar', 'Gray Merchant of Asphodel', 'Bring to Light', 'Temple of Silence', 'Birds of Paradise', 'Shrine of Burning Rage', 'Unholy Heat', 'Tanglepool Bridge', 'Nezumi Cutthroat', 'Arcane Sanctum', 'Bane of Bala Ged', 'Timeless Dragon', 'Gathan Raiders', 'Mirari''s Wake', 'Cursecatcher', 'Go for the Throat', 'Colossus of Akros', 'Soulbright Flamekin', 'Firebolt', 'Out of Time', 'Crash Through', 'Magnifying Glass', 'Faerie Harbinger', 'Lavaclaw Reaches', 'Counterspell', 'Glimmerpost', 'Play with Fire', 'Expedition Map', 'Meddling Mage', 'Glint Hawk', 'Tidehollow Sculler', 'Bolas''s Citadel', 'Sling-Gang Lieutenant', 'Shard Volley', 'Mastermind''s Acquisition', 'Bygone Bishop', 'Swiftwater Cliffs', 'Channel the Suns', 'Into the North', 'The Flame of Keld', 'Undead Butler', 'Brushstrider', 'Coralhelm Commander', 'Flame Rift', 'Tectonic Edge', 'Woodland Cemetery', 'Skin Invasion', 'Graven Lore', 'Foundry Street Denizen', 'Mana Leak', 'Pull from Tomorrow', 'Oblivion Ring', 'Gaea''s Will', 'Glen Elendra Archmage', 'Burst Lightning', 'Beacon of Tomorrows', 'Snowfield Sinkhole', 'Quest for Ancient Secrets', 'Elvish Promenade', 'Tendo Ice Bridge', 'Buried Ruin', 'Cloudpost', 'Aven Gagglemaster', 'Prophet of Kruphix', 'Delver of Secrets', 'Nephalia Drownyard', 'Howling Mine', 'Rakdos Headliner', 'Mission Briefing', 'Boggart Shenanigans', 'Wayfarer''s Bauble', 'Extinction Event', 'Ground Rift', 'Elixir of Immortality', 'Deathbonnet Sprout', 'Recurring Nightmare', 'Frostwalk Bastion', 'Magister of Worth', 'Dimir Charm', 'Deranged Hermit', 'Adaptive Automaton', 'Doom Blade', 'Dimir Guildgate', 'Fourth Bridge Prowler', 'Izzet Signet', 'Shatter the Sky', 'Gingerbrute', 'Snow-Covered Forest', 'Electrolyze', 'Consume the Meek', 'Fires of Invention', 'Elvish Mystic', 'Braids, Cabal Minion', 'Underworld Dreams', 'Adorned Pouncer', 'Lose Focus', 'Blazing Shoal', 'Dawn of Hope', 'Zulaport Cutthroat', 'Putrid Imp', 'Druid Class', 'Twiddle', 'Ketria Crystal', 'Argentum Armor', 'Revitalize', 'Gruul Guildgate', 'Karn''s Temporal Sundering', 'Nimbus Maze', 'Sigil of the Empty Throne', 'Battle Cry Goblin', 'Cartographer''s Survey', 'Plunge into Darkness', 'Flametongue Kavu', 'Identity Thief', 'Sprite Dragon', 'Labyrinth of Skophos', 'Champion of the Parish', 'Alpine Meadow', 'Walk the Aeons', 'Heartless Act', 'Disallow', 'Benevolent Bodyguard', 'Everlasting Torment', 'Demon''s Jester', 'Ritual of Soot', 'Bala Ged Recovery', 'Mad Auntie', 'Ingenious Smith', 'Runaway Steam-Kin', 'Llanowar Elves', 'Eye of Nowhere', 'Turnabout', 'Lumbering Falls', 'Serra Avenger', 'Garruk Relentless', 'Sygg, River Cutthroat', 'Drossforge Bridge', 'Fiery Temper', 'Hinterland Harbor', 'Sylvan Scrying', 'Chandra Ablaze', 'Battle of Wits', 'Honor of the Pure', 'Tempered Steel', 'Highland Weald', 'Stinkdrinker Bandit', 'Snow-Covered Plains', 'Mystifying Maze', 'Channel', 'Kiln Fiend', 'Battlefield Forge'))) 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.4, mysql)

Reported on decksite by mysql-perf

Location Hash: 5ea914a6bb508d349674ca47ced2e3cc4fb50457

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (66.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 ('Merfolk Windrobber', 'Floating-Dream Zubera', 'Midnight Reaper', 'Expedition Map', 'Jeskai Charm', 'Tranquil Thicket', 'Condemn', 'Precursor Golem', 'Genesis', 'Inscription of Ruin', 'Zur''s Weirding', 'Kodama of the North Tree', 'Glacial Revelation', 'Arch of Orazca', 'Perilous Myr', 'Heliod''s Intervention', 'Expansion // Explosion', 'Arctic Treeline', 'Dryad Militant', 'Consider', 'Faith''s Reward', 'Drainpipe Vermin', 'Tempting Wurm', 'Devouring Tendrils', 'Strike It Rich', 'Demon''s Disciple', 'Neutralize', 'Ichor Wellspring', 'Doomwake Giant', 'Lead the Stampede', 'Selesnya Guildgate', 'Myr Retriever', 'Rooftop Storm', 'Lavabelly Sliver', 'Tireless Provisioner', 'Drannith Healer', 'Prosperous Innkeeper', 'Snow-Covered Plains', 'Elvish Rejuvenator', 'Bloodthrone Vampire', 'Wash Away', 'Tectonic Edge', 'Hunting Pack', 'Awakening of Vitu-Ghazi', 'Lotleth Giant', 'Nissa''s Renewal', 'Gideon''s Intervention', 'Smiting Helix', 'Grand Coliseum', 'Curiosity', 'Herald of the Pantheon', 'Fiery Temper', 'Kabira Takedown', 'Biomancer''s Familiar', 'Out of Time', 'Fires of Invention', 'Diabolic Tutor', 'Sidisi, Undead Vizier', 'Krenko, Tin Street Kingpin', 'Kiln Fiend', 'Arcane Sanctum', 'Adarkar Wastes', 'Azorius Guildgate', 'Khalni Ambush', 'Nihil Spellbomb', 'Glen Elendra Archmage', 'Cartographer''s Survey', 'Frostwalk Bastion', 'Comet Storm', 'Treacherous Blessing', 'Yahenni''s Expertise', 'Sylvan Library', 'Electrolyze', 'Tormenting Voice', 'Rampaging Ferocidon', 'Boggart Mob', 'Dance of the Manse', 'Signal Pest', 'Stromkirk Noble', 'Unburial Rites', 'Changeling Outcast', 'Munitions Expert', 'Alchemist''s Refuge', 'Verdant Command', 'Drannith Stinger', 'Pyrite Spellbomb', 'Final Parting', 'Endbringer', 'Frogtosser Banneret', 'Extinction Event', 'Empty the Warrens', 'Think Twice', 'Council''s Judgment', 'Counterflux', 'Asylum Visitor', 'Drawn from Dreams', 'Siege-Gang Commander', 'Bad River', 'Basal Sliver', 'Feed the Swarm', 'Faithful Mending', 'Gadwick, the Wizened', 'Shardless Agent', 'Nyxathid', 'Rune of Might', 'Rootbound Crag', 'Zuran Orb', 'Legacy Weapon', 'Gigadrowse', 'Snow-Covered Mountain', 'Treasure Cruise', 'Tanglepool Bridge', 'Dread Wanderer', 'Thwart the Enemy', 'Insight', 'Tree of Tales', 'Bloodhall Priest', 'Sudden Edict', 'Proclamation of Rebirth', 'Burst Lightning', 'Agony Warp', 'Commune with Lava', 'Flame Slash', 'Aetherling', 'Izzet Boilerworks', 'Kitchen Imp', 'Grim Lavamancer', 'Wayfarer''s Bauble', 'Master Transmuter', 'Furyborn Hellkite', 'Helm of the Host', 'Student of Warfare', 'Sarcomancy', 'Abiding Grace', 'Boros Guildgate', 'Leyline of Anticipation', 'Dangerous Wager', 'Springbloom Druid', 'Return to the Ranks', 'Urza''s Factory', 'Vapor Snag', 'Lodestone Golem', 'Necromancer''s Stockpile', 'Dispel', 'Dimir Charm', 'Etherium Sculptor', 'Jwari Shapeshifter', 'Sidewinder Sliver', 'Rakdos Cackler', 'Bring to Light', 'Invasive Surgery', 'Champion of Wits', 'Oviya Pashiri, Sage Lifecrafter', 'Dark Petition', 'Fleshbag Marauder', 'Alpine Meadow', 'Game Trail', 'Tomb of Urami', 'Mistblade Shinobi', 'Gilt-Blade Prowler', 'Fatestitcher', 'Warriors'' Lesson', 'Go for the Throat', 'Detention Sphere', 'Yosei, the Morning Star', 'Sanguine Bond', 'Foreboding Ruins', 'Judge''s Familiar', 'Silver Myr', 'Mouth of Ronom', 'Gray Merchant of Asphodel', 'Solitary Confinement', 'Trail of Crumbs', 'You Find a Cursed Idol', 'Storm''s Wrath', 'The Flame of Keld', 'Nurturing Presence', 'Mirrodin Besieged', 'Acolyte of Affliction', 'Azorius Charm', 'Rise and Shine', 'Pyretic Ritual', 'Nostalgic Dreams', 'Boreal Druid', 'Orochi Hatchery', 'Hell Mongrel', 'Pelakka Predation', 'Halimar Excavator', 'Dawn of Hope', 'Academy Manufactor', 'Omen of the Sea', 'General Ferrous Rokiric', 'Vesperlark', 'Snow-Covered Swamp', 'The Eldest Reborn', 'Sweltering Suns', 'Whip of Erebos', 'Colossus of Akros', 'Overgrowth', 'Glint-Sleeve Siphoner', 'Enter the God-Eternals', 'Frogmite', 'Artificer''s Intuition', 'Tectonic Giant', 'Martyr of Dusk', 'Quarantine Field', 'White Sun''s Zenith', 'Wavesifter', 'Sylvan Scrying', 'Nature''s Lore', 'Feast of Sanity', 'Jack-o''-Lantern', 'Pieces of the Puzzle', 'Izzet Charm', 'Ponder', 'Goblin Dark-Dwellers', 'Winding Way', 'Doomed Traveler', 'Harrow', 'Silver Knight', 'Crux of Fate', 'Treasure Map', 'Sower of Temptation', 'Thornwood Falls', 'Primal Amulet', 'Seal of Removal', 'Braids, Cabal Minion', 'Elvish Visionary', 'Tide Shaper', 'Tempest Djinn', 'Deadly Dispute', 'Blood Fountain', 'Dragon''s Claw', 'Providence', 'Gild', 'Timeless Witness', 'Banishing Light', 'Meddling Mage', 'Nevermore', 'Saproling Migration', 'Warren Weirding', 'Forced Adaptation', 'Woodfall Primus', 'Deafening Clarion', 'Mirri, Cat Warrior', 'Battlefield Forge', 'Needle Spires', 'Animist''s Awakening', 'Logic Knot', 'Reclaim the Wastes', 'Veilborn Ghoul', 'Stromkirk Occultist', 'Barrin, Tolarian Archmage', 'Vedalken Shackles', 'Vraska''s Contempt', 'Desecration Demon', 'Diregraf Captain', 'Archghoul of Thraben', 'Envelop', 'Glimmerpost', 'Hard Evidence', 'Elsewhere Flask', 'Astral Cornucopia', 'Champion of Rhonas', 'Chandra''s Phoenix', 'Midnight Scavengers', 'Goblin Ringleader', 'Scourglass', 'Skophos Reaver', 'Engulf the Shore', 'Contagion Clasp', 'Meng Huo, Barbarian King', 'Hada Freeblade', 'Sphere of Safety', 'Seething Song', 'Evolving Wilds', 'Razortide Bridge', 'Undercity Informer', 'Astral Drift', 'Snow-Covered Forest', 'Find // Finality', 'Lux Cannon', 'Stern Dismissal', 'Sigarda''s Splendor', 'Orim''s Chant', 'Forbidden Alchemy', 'Spell Snuff', 'Heartless Act', 'Thirst for Discovery', 'Tajic, Legion''s Edge', 'Rotting Rats', 'Goreclaw, Terror of Qal Sisma', 'Footfall Crater', 'Aetherworks Marvel', 'Barren Moor', 'Laboratory Maniac', 'Kamahl''s Druidic Vow', 'Graven Lore', 'Magister of Worth', 'Temmet, Vizier of Naktamun', 'Burning Inquiry', 'Keldon Marauders', 'Storm the Vault', 'Temple of Enlightenment', 'Snakeskin Veil', 'Grim Wanderer', 'Coveted Prize', 'Crashing Drawbridge', 'Naturalize', 'Nimbus Maze', 'Manaweft Sliver', 'Dusk Legion Zealot', 'Rune-Scarred Demon', 'Chandra, the Firebrand', 'Tezzeret''s Gambit', 'Fertile Thicket', 'Path to the World Tree', 'Martyr of Sands', 'Farseek', 'Viscera Seer', 'Ally Encampment', 'Mystic Monastery', 'Augur of Skulls', 'Myr Incubator', 'Deathgorge Scavenger', 'Tilling Treefolk', 'Jace, Memory Adept', 'Codex Shredder', 'Astral Slide', 'Wort, Boggart Auntie', 'Ghirapur Aether Grid', 'Nicol Bolas, Planeswalker', 'Faerie Miscreant', 'Dauntless Bodyguard', 'Gruul Guildgate', 'Goblin Trashmaster', 'Pounce', 'Dizzy Spell', 'Plaza of Harmony', 'Mogg War Marshal', 'Teferi, Mage of Zhalfir', 'Piru, the Volatile', 'Silverbluff Bridge', 'Ixalli''s Diviner', 'Hour of Promise', 'Hope of Ghirapur', 'Vivid Marsh', 'Precinct Captain', 'Mana Leak', 'Jolrael, Mwonvuli Recluse', 'Deranged Hermit', 'All Suns'' Dawn', 'Counterspell', 'Glaze Fiend', 'Plow Under', 'Intangible Virtue', 'Bone Shards', 'Swan Song', 'Whelming Wave', 'Sling-Gang Lieutenant', 'Eyeblight''s Ending', 'Slagwoods Bridge', 'Thassa''s Intervention', 'Sekki, Seasons'' Guide', 'Frost Augur', 'Disallow', 'Fading Hope', 'Gingerbrute', 'Sea Gate Wreckage', 'Power Conduit', 'The Mending of Dominaria', 'Growth-Chamber Guardian', 'Avacyn''s Pilgrim', 'Fae Offering', 'Insolent Neonate', 'Throne of the God-Pharaoh', 'Deputy of Acquittals', 'Far // Away', 'Flourishing Fox', 'Thraben Inspector', 'Tendo Ice Bridge', 'Rakdos Guildgate', 'Ornithopter', 'Prismari Campus', 'Spirit of the Aldergard', 'Putrefax', 'Murder Investigation', 'Cursecatcher', 'Cathar Commando', 'Thief of Sanity', 'Kabira Evangel', 'Dream Trawler', 'Mastermind''s Acquisition', 'Renata, Called to the Hunt', 'Soul Snare', 'Boomerang', 'Sinew Sliver', 'Pirate''s Pillage', 'Terrarion', 'Phyrexian Swarmlord', 'Firemind''s Research', 'Multiple Choice', 'Shatter the Sky', 'Treasure Mage', 'Valiant Rescuer', 'Demigod of Revenge', 'Benalish Marshal', 'Icehide Golem', 'Voltaic Key', 'Emrakul''s Evangel', 'Kessig Flamebreather', 'Bile Blight', 'Ember-Fist Zubera', 'Blizzard Brawl', 'Woodland Cemetery', 'Abbot of Keral Keep', 'Sigil of the Empty Throne', 'Wild Pair', 'Rustvale Bridge', 'Hooting Mandrills', 'Oblivion Ring', 'Angel of Glory''s Rise', 'Chittering Rats', 'Blackbloom Rogue', 'Pillage', 'Garruk Relentless', 'Cloudshredder Sliver', 'Bridge from Below', 'Lantern of the Lost', 'Drowned Catacomb', 'Gavony Township', 'Ancient Stirrings', 'Ravenous Rats', 'Stigma Lasher', 'Opt', 'Bala Ged Recovery', 'Quicken', 'Test of Talents', 'Balustrade Spy', 'Commune with the Gods', 'Gigantomancer', 'Witching Well', 'Flame Rift', 'Dosan the Falling Leaf', 'Ondu Inversion', 'Steel Overseer', 'Muldrotha, the Gravetide', 'Hinterland Harbor', 'Dennick, Pious Apprentice', 'Compulsive Research', 'Bloodchief''s Thirst', 'Glacial Floodplain', 'Baffling End', 'Kazandu Mammoth', 'Explore', 'Sign in Blood', 'Makindi Stampede', 'Doomskar Oracle', 'Buried Ruin', 'Karn''s Bastion', 'Harmonic Prodigy', 'Grasp of Darkness', 'Experiment One', 'Bow of Nylea', 'Jaddi Offshoot', 'Dead Weight', 'Okina, Temple to the Grandfathers', 'Baloth Null', 'Tempered Sliver', 'Clarion Spirit', 'Kogla, the Titan Ape', 'Boon Satyr', 'Zenith Flare', 'Power Sink', 'Hypnotic Specter', 'Dregscape Zombie', 'Prophetic Prism', 'Shimmering Grotto', 'Vampire Nighthawk', 'Dwynen, Gilt-Leaf Daen', 'Animate Dead', 'Heartless Summoning', 'Predatory Sliver', 'Dragonskull Summit', 'Commence the Endgame', 'Myr Battlesphere', 'Elixir of Immortality', 'Cascading Cataracts', 'Bedlam Reveler', 'Spell Burst', 'Lava Dart', 'Springleaf Drum', 'Wedding Invitation', 'Turnabout', 'Nissa, Vastwood Seer', 'Castigate', 'Clifftop Retreat', 'Birds of Paradise', 'Eyetwitch', 'Graf Rats', 'Ranger of Eos', 'Pillar of the Paruns', 'Concerted Defense', 'Skirk Prospector', 'Jubilant Skybonder', 'Simian Spirit Guide', 'See the Truth', 'Silundi Vision', 'Hellhole Rats', 'Goblin Bombardment', 'Geomancer''s Gambit', 'Arcum''s Astrolabe', 'Power Word Kill', 'Jace Beleren', 'Smother', 'Spiteful Sliver', 'Shrine of Burning Rage', 'Muddle the Mixture', 'Hermit Druid', 'Mirari''s Wake', 'Tarfire', 'Blacklance Paragon', 'Gatekeeper of Malakir', 'Cloudpost', 'Polukranos, Unchained', 'Abundant Harvest', 'Fell Stinger', 'Rimewind Taskmage', 'Tangled Florahedron', 'Fertile Ground', 'Malakir Rebirth', 'Orzhov Guildgate', 'Westvale Abbey', 'Aphemia, the Cacophony', 'Cerulean Drake', 'Hateful Eidolon', 'Master of Death', 'Reckless Impulse', 'Sliver Queen', 'Twinflame', 'Shard Volley', 'Raise the Alarm', 'Diregraf Ghoul', 'Simic Guildgate', 'Spell Pierce', 'Erebos''s Intervention', 'Quench', 'Ghoulcaller''s Bell', 'Wargate', 'Favorable Winds', 'Jwari Disruption', 'Korlash, Heir to Blackblade', 'Humiliate', 'Escape to the Wilds', 'Jund Charm', 'Abominable Treefolk', 'Reflector Mage', 'Sheltered Thicket', 'Prism Ring', 'Tendrils of Agony', 'Myojin of Life''s Web', 'Goblin Chieftain', 'Hazoret''s Undying Fury', 'Rishadan Dockhand', 'Retriever Phoenix', 'Arbor Elf', 'Arcum Dagsson', 'Skirge Familiar', 'Azami, Lady of Scrolls', 'Vivid Crag', 'Spark Spray', 'Thaumatic Compass', 'Temple of Malady', 'Day of Judgment', 'Kambal, Consul of Allocation', 'Mount Velus Manticore', 'Possessed Portal', 'Ensoul Artifact', 'Shred Memory', 'Satyr Wayfinder', 'Gaea''s Revenge', 'Darigaaz Reincarnated', 'Trading Post', 'Myr Superion', 'Earwig Squad', 'Sulfurous Mire', 'Lochmere Serpent', 'Shriekmaw', 'Brain Maggot', 'Undead Butler', 'Rime Tender', 'Hostage Taker', 'Dreadhorde Invasion', 'Cryptic Caves', 'Lonis, Cryptozoologist', 'Gideon Jura', 'Slaughter Pact', 'Thought Scour', 'Paralyze', 'Volatile Fjord', 'Blistercoil Weird', 'Ancestral Anger', 'Magus of the Vineyard', 'Earthen Arms', 'Commit // Memory', 'Memory Lapse', 'Codespell Cleric', 'Mina and Denn, Wildborn', 'Poet''s Quill', 'Geier Reach Sanitarium', 'Madcap Experiment', 'Forbid', 'Mindslaver', 'Dovin Baan', 'Secluded Steppe', 'Legion Angel', 'Stinkdrinker Bandit', 'Stonehorn Dignitary', 'Neheb, Dreadhorde Champion', 'Spore Frog', 'Deep Forest Hermit', 'Doom Foretold', 'Zurgo Bellstriker', 'Drag to the Underworld', 'Plague Boiler', 'Hornet Queen', 'Sakiko, Mother of Summer', 'Meteor Golem', 'Basking Rootwalla', 'Sultai Charm', 'Arc Trail', 'Yawgmoth''s Bargain', 'Mantis Rider', 'Baloth Woodcrasher', 'Runed Halo', 'Salvage Titan', 'Kodama''s Reach', 'Armistice', 'High Tide', 'Wayward Guide-Beast', 'Crash Through', 'Mythos of Nethroi', 'Wall of Omens', 'Woodland Chasm', 'Benevolent Bodyguard', 'Myth Realized', 'Knollspine Dragon', 'Magistrate''s Scepter', 'Expedition Envoy', 'Sculptor of Winter', 'Vraska, Relic Seeker', 'Centaur Garden', 'Aetherspouts', 'Rage Forger', 'Expedite', 'Esper Charm', 'Pore Over the Pages', 'Duskwatch Recruiter', 'Bloodsky Berserker', 'Hypnotic Sprite', 'Painful Truths', 'Delay', 'Giant Killer', 'Emeria, the Sky Ruin', 'Survivors'' Encampment', 'Spikefield Hazard', 'Maze''s End', 'Search for Tomorrow', 'Gather the Townsfolk', 'Ghalta, Primal Hunger', 'Goblin Matron', 'Discovery // Dispersal', 'Void', 'Infernal Grasp', 'Reap the Past', 'Orcish Lumberjack', 'Stubborn Denial', 'Exquisite Firecraft', 'Vivien''s Arkbow', 'The Great Aurora', 'Leaden Myr', 'Graveyard Marshal', 'Recurring Nightmare', 'Ethersworn Sphinx', 'Fact or Fiction', 'Zof Consumption', 'Aether Spellbomb', 'Dragon Tyrant', 'Obstinate Baloth', 'Repeal', 'Contagion Engine', 'Opaline Sliver', 'Arcbound Ravager', 'Everflowing Chalice', 'Wolfir Silverheart', 'Gemhide Sliver', 'Vendetta', 'Niv-Mizzet, Parun', 'Ultimate Price', 'Lose Focus', 'Into the North', 'Monastery Swiftspear', 'Starstorm', 'Ghoulcaller''s Chant', 'Guild Summit', 'Primal Command', 'Supernatural Stamina', 'Foe-Razer Regent', 'Militia''s Pride', 'Touch of the Eternal', 'Apostle''s Blessing', 'Tamiyo''s Journal', 'Beskir Shieldmate', 'Viashino Pyromancer', 'Increasing Ambition', 'Leechridden Swamp', 'Acidic Slime', 'Virulent Sliver', 'Nested Shambler', 'Delver of Secrets', 'Jokulhaups', 'Scrabbling Claws', 'Sliver Legion', 'Winter''s Rest', 'Goblin Electromancer', 'Pack Rat', 'Kami of False Hope', 'Ambush Viper', 'Woe Strider', 'Ravenous Squirrel', 'Seasons Past', 'Beastcaller Savant', 'Chain Lightning', 'Garrison Cat', 'Usher of the Fallen', 'Woodland Champion', 'Banefire', 'Jadelight Ranger', 'Scattered Groves', 'Constricting Sliver', 'Archon of Sun''s Grace', 'Sulfurous Springs', 'Bramblecrush', 'Dark Ritual', 'Garruk''s Harbinger', 'Vivid Grove', 'Ivy Lane Denizen', 'Galerider Sliver', 'Control Magic', 'Blacksmith''s Skill', 'Glorybringer', 'Drossforge Bridge', 'Tragic Poet', 'Agonizing Remorse', 'Yeva, Nature''s Herald', 'Stirring Wildwood', 'Thrashing Brontodon', 'Divest', 'Blazing Shoal', 'Unmoored Ego', 'Ranger''s Guile', 'Snowfield Sinkhole', 'Oriss, Samite Guardian', 'Dregscape Sliver', 'Vengeful Pharaoh', 'Oona, Queen of the Fae', 'Mishra''s Factory', 'Blazing Rootwalla', 'Llanowar Wastes', 'Reveillark', 'Chandra, Fire Artisan', 'Skyblade''s Boon', 'Mythos of Brokkos', 'Ghost Quarter', 'Vindicate', 'Hellspark Elemental', 'Assault Strobe', 'Spine of Ish Sah', 'Honor of the Pure', 'The Birth of Meletis', 'Search for Azcanta', 'Stone Rain', 'Secluded Glen', 'Gates Ablaze', 'Scour All Possibilities', 'Descendants'' Path', 'Eternal Dragon', 'Mana Tithe', 'Lashwrithe', 'Radha, Heart of Keld', 'Distended Mindbender', 'Conqueror''s Galleon', 'Blessed Defiance', 'Voldaren Epicure', 'Master of Etherium', 'Temple of Mystery', 'Dreadbore', 'Dimir Guildgate', 'Legion''s Landing', 'Ashiok''s Erasure', 'Viridian Emissary', 'Labyrinth of Skophos', 'Nevinyrral''s Disk', 'Druid Class', 'Dragon''s Approach', 'Krydle of Baldur''s Gate', 'Professor of Symbology', 'Renewed Faith', 'Stormchaser Mage', 'Sea-Dasher Octopus', 'Play with Fire', 'Declaration in Stone', 'Behold the Multiverse', 'Deep Analysis', 'Faerie Vandal', 'Olivia Voldaren', 'Scrap Trawler', 'First Day of Class', 'Battle of Wits', 'Prohibit', 'Sejiri Shelter', 'Field of Ruin', 'Phyrexian Hydra', 'Vivid Creek', 'Terror', 'Putrefy', 'Rune of Sustenance', 'Tombstalker', 'Temple of Deceit', 'Infernal Plunge', 'Darkmoss Bridge', 'Fungus Sliver', 'Leeching Sliver', 'Eat to Extinction', 'Incinerate', 'Demonic Collusion', 'Goblin Anarchomancer', 'Crumbling Necropolis', 'Sanity Gnawers', 'Mogis''s Marauder', 'Liliana Vess', 'Blessed Alliance', 'Exclude', 'Dakmor Salvage', 'Hollowhead Sliver', 'Irencrag Pyromancer', 'Dread Fugue', 'Edge of Autumn', 'Warden of the First Tree', 'Ramunap Excavator', 'Goldmire Bridge', 'Frost Titan', 'Rimewood Falls', 'Thermo-Alchemist', 'Izzet Guildgate', 'Aetherize', 'Mist-Syndicate Naga', 'Flay Essence', 'Oust', 'Rune of Flight', 'Sleeper Dart', 'Samut, Tyrant Smasher', 'Highland Weald', 'Twincast', 'Idyllic Grange', 'Hellkite Overlord', 'Leyline of Punishment', 'Feasting Troll King', 'Murderous Cut', 'Bladeback Sliver', 'Raging Ravine', 'Striking Sliver', 'Shriekhorn', 'Implement of Examination', 'Sterling Grove', 'Murder', 'Sprite Dragon', 'God-Pharaoh''s Gift', 'Marionette Master', 'Marit Lage''s Slumber', 'Bond of Insight', 'Soaring Thought-Thief', 'Tasigur, the Golden Fang', 'Undying Evil', 'Oran-Rief Hydra', 'You See a Guard Approach', 'Bosk Banneret', 'Mindswipe', 'Mistcutter Hydra', 'Invisible Stalker', 'Experimental Frenzy', 'Elspeth''s Nightmare', 'Coretapper', 'Platinum Angel', 'River of Tears', 'Shaman of the Great Hunt', 'Deafening Silence', 'Battlegrowth', 'Sunscour', 'Putrid Goblin', 'Lavaclaw Reaches', 'Demonic Bargain', 'Tidehollow Sculler', 'Forgotten Cave', 'Bane of Bala Ged', 'Ash Zealot', 'Flood Plain', 'Nourishing Shoal', 'Knight of the White Orchid', 'Enchantress''s Presence', 'Timeless Dragon', 'Baru, Fist of Krosa', 'Cathartic Pyre', 'Nekrataal', 'Sea''s Claim', 'Mesmeric Fiend', 'Hall of the Bandit Lord', 'Hanweir Garrison', 'Leaf-Crowned Elder', 'Ghitu Lavarunner', 'Nightveil Specter', 'Quandrix Apprentice', 'Binding the Old Gods', 'Dread Return', 'Hero''s Downfall', 'Faithless Salvaging', 'Second Sunrise', 'Surge Node', 'Traumatize', 'Krosan Wayfarer', 'Blue Sun''s Zenith', 'Temple of Malice', 'Moment of Craving', 'Ammit Eternal', 'Prey Upon', 'Cathartic Reunion', 'Kazandu Blademaster', 'Gitaxian Probe', 'Sunpetal Grove', 'Akoum Battlesinger', 'Garruk''s Companion', 'Vault Skirge', 'Putrid Imp', 'Cruel Bargain', 'Fraying Sanity', 'Silumgar''s Command', 'Golgari Guildgate', 'Setessan Champion', 'Unearth', 'Lifecrafter''s Bestiary', 'Endless Horizons', 'Shambling Ghast', 'Snow-Covered Island', 'Mystifying Maze', 'Dragonsguard Elite', 'Revitalize', 'Harabaz Druid', 'Aethersphere Harvester', 'Thrasta, Tempest''s Roar', 'Hibernation', 'Karok Wrangler', 'Mirrodin''s Core', 'Peek', 'Training Grounds', 'Phantasmagorian', 'Plea for Guidance', 'Summoning Station', 'Temple of Silence', 'Future Sight', 'Cleansing Wildfire', 'Chief Engineer', 'Silver Raven', 'Garruk Wildspeaker', 'Counterbore', 'Cruel Ultimatum', 'Sliver Hive', 'Ritual of Soot', 'Firebolt', 'Murmuring Bosk', 'Frantic Search', 'Doom Blade', 'Suspend', 'Marwyn, the Nurturer', 'Prophet of Kruphix', 'Stormblood Berserker', 'Leyline of Singularity', 'Mistvault Bridge', 'Terramorphic Expanse', 'Scrapheap Scrounger', 'Barbarian Ring', 'Go for Blood', 'Syphon Sliver', 'Ingenious Infiltrator', 'Highland Forest', 'Mizzium Mortars', 'Crawling Barrens', 'Frontier Bivouac', 'Ritual of Subdual', 'Smallpox', 'Diregraf Colossus', 'Duress', 'Glacial Fortress', 'Cultivate', 'Ice Tunnel', 'Yavimaya Coast', 'Ingenious Smith', 'Diamond Lion', 'Kessig Wolf Run', 'Academy Elite', 'Mystic Snake', 'Darksteel Colossus', 'Narfi, Betrayer King', 'Nephalia Drownyard', 'Llanowar Elves', 'Hymn to Tourach', 'Champion of the Parish', 'Forked Bolt', 'Cremate', 'Grand Architect'))) 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.5, mysql)

Reported on decksite by mysql-perf

Location Hash: 5ea914a6bb508d349674ca47ced2e3cc4fb50457

Labels: decksite

vorpal-buildbot commented 2 years ago

Exceeded slow_query limit (67.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 ('Barbarian Ring', 'Shambling Ghast', 'Reality Heist', 'Helm of the Gods', 'Burst Lightning', 'Stone Rain', 'Walk the Aeons', 'Michiko''s Reign of Truth', 'Malakir Rebirth', 'Terastodon', 'Doomed Traveler', 'Hotshot Mechanic', 'Unburial Rites', 'Spirited Companion', 'Mech Hangar', 'Temple of Malice', 'Sunpetal Grove', 'Zulaport Cutthroat', 'Crested Sunmare', 'Treasure Map', 'Glimpse of Tomorrow', 'Kogla, the Titan Ape', 'Early Harvest', 'Explore', 'Empty the Warrens', 'Flood Plain', 'Vivid Meadow', 'Return to the Ranks', 'Daring Sleuth', 'Ravenous Trap', 'Isolated Chapel', 'Expedite', 'Delver of Secrets', 'Failure // Comply', 'Hunted Witness', 'Driven // Despair', 'Spatial Contortion', 'Throes of Chaos', 'Reckless Impulse', 'Dawn of Hope', 'Selesnya Signet', 'Oblivion Ring', 'Mirrorshell Crab', 'Augur of Bolas', 'Mechtitan Core', 'Fieldmist Borderpost', 'Bloodthrone Vampire', 'Rabbit Battery', 'Bad River', 'Goblin Bushwhacker', 'Temple of Enlightenment', 'Old Rutstein', 'Hopeful Eidolon', 'Kambal, Consul of Allocation', 'Wall of Omens', 'Voldaren Epicure', 'Joraga Treespeaker', 'Duskwatch Recruiter', 'Barbed Spike', 'Heartbeat of Spring', 'Giant Spider', 'Scattered Groves', 'Search the Premises', 'Lhurgoyf', 'Goblin Bombardment', 'Harrow', 'Thopter Spy Network', 'Vault of the Archangel', 'Frantic Search', 'Foundation Breaker', 'Wandering Fumarole', 'Forbid', 'Dragon Turtle', 'Imperial Recovery Unit', 'Vivid Grove', 'Porphyry Nodes', 'Titanoth Rex', 'Tithe Taker', 'Angel of Sanctions', 'Laboratory Maniac', 'Metalwork Colossus', 'Midnight Reaper', 'Kazuul''s Fury', 'Dreadhorde Invasion', 'Ornithopter', 'Riptide Laboratory', 'Legion Angel', 'Murderous Redcap', 'Arcane Sanctum', 'Silverbluff Bridge', 'Ajani, Caller of the Pride', 'Sorin''s Vengeance', 'Kabira Takedown', 'Pelakka Predation', 'Tamiyo, Collector of Tales', 'Erdwal Illuminator', 'Thirst for Knowledge', 'Tempered Steel', 'Ulvenwald Mysteries', 'Yorvo, Lord of Garenbrig', 'Shigeki, Jukai Visionary', 'Lunarch Veteran', 'Fleetwheel Cruiser', 'Artisan of Kozilek', 'Miscast', 'Lava Dart', 'Moonsnare Prototype', 'Terramorphic Expanse', 'Force of Nature', 'Enigma Sphinx', 'Deep Analysis', 'Vivid Creek', 'Shriekmaw', 'Vapor Snag', 'Battle Screech', 'Assault Strobe', 'Devout Invocation', 'Aethersphere Harvester', 'Wavesifter', 'Faithful Mending', 'Squadron Hawk', 'Azorius Charm', 'Patchwork Automaton', 'Gavony Township', 'Trelasarra, Moon Dancer', 'Wonder', 'Thalia, Heretic Cathar', 'Power Word Kill', 'Toolcraft Exemplar', 'Giant Growth', 'Teferi''s Ageless Insight', 'Izzet Boilerworks', 'Prodigy''s Prototype', 'Goblin Ruinblaster', 'Knight of the White Orchid', 'Drowned Catacomb', 'Deny Reality', 'You Find a Cursed Idol', 'Prairie Stream', 'Faerie Vandal', 'Nature''s Lore', 'Inevitable Betrayal', 'Gonti, Lord of Luxury', 'Tireless Provisioner', 'Oath of Jace', 'Orim''s Chant', 'Temple of Triumph', 'Young Wolf', 'Pyretic Ritual', 'Secluded Steppe', 'Linden, the Steadfast Queen', 'Polukranos, World Eater', 'Sylvan Anthem', 'Condescend', 'Opulent Palace', 'Moon-Circuit Hacker', 'Firewild Borderpost', 'Dryad Militant', 'Scour All Possibilities', 'Ixalan''s Binding', 'Melira, Sylvok Outcast', 'Leyline of the Meek', 'Wolfbriar Elemental', 'Kitchen Finks', 'Touch the Spirit Realm', 'Thassa''s Intervention', 'Mana Leak', 'Tezzeret the Schemer', 'Mask of the Mimic', 'Whelming Wave', 'Primal Command', 'Hanweir Militia Captain', 'Secluded Courtyard', 'Gavony Dawnguard', 'Signal Pest', 'Servo Exhibition', 'Aria of Flame', 'Sin Collector', 'Intangible Virtue', 'Pious Wayfarer', 'Ethereal Armor', 'Serpentine Ambush', 'Mistvein Borderpost', 'Steel Hellkite', 'Champion of Lambholt', 'Buried Ruin', 'Jace, Memory Adept', 'Westvale Abbey', 'Aether Spellbomb', 'Gaea''s Blessing', 'Master Trinketeer', 'Zealous Persecution', 'Goblin Dark-Dwellers', 'Sorin Markov', 'Gideon Jura', 'Memory Lapse', 'Aegis of the Gods', 'Repeal', 'Rally the Ancestors', 'Lightning Storm', 'See the Truth', 'Kiln Fiend', 'Hada Freeblade', 'Runed Halo', 'Mortician Beetle', 'Resurgent Belief', 'Dragonspark Reactor', 'Dennick, Pious Apprentice', 'Forgotten Cave', 'Cathar Commando', 'Archetype of Endurance', 'Starstorm', 'Brilliant Ultimatum', 'Strike It Rich', 'Phyrexian Revoker', 'Network Disruptor', 'Careful Consideration', 'Barren Moor', 'Galvanic Relay', 'Expedition Envoy', 'Briarbridge Tracker', 'The Antiquities War', 'Confront the Unknown', 'Silumgar''s Command', 'Secluded Glen', 'Soaring Thought-Thief', 'Ricochet Trap', 'Temple of Abandon', 'Hostage Taker', 'Soulscour', 'Tribute Mage', 'Wildborn Preserver', 'Glorious Protector', 'Circuit Mender', 'Heartless Act', 'Nevinyrral''s Disk', 'Temple of Mystery', 'Lumbering Falls', 'Mobilizer Mech', 'Gitaxian Probe', 'Priest of Fell Rites', 'Shrapnel Blast', 'Chatterstorm', 'Rofellos, Llanowar Emissary', 'Research // Development', 'Rush of Adrenaline', 'Molten Rain', 'Deep Forest Hermit', 'Search for Azcanta', 'Greater Sandwurm', 'Basilica Bell-Haunt', 'Negate', 'Carrier Thrall', 'Condemn', 'Karn, Silver Golem', 'Timeless Witness', 'Sudden Edict', 'Aviation Pioneer', 'Putrid Goblin', 'Pathrazer of Ulamog', 'Rootbound Crag', 'Hypergenesis', 'Glorybringer', 'Traverse the Ulvenwald', 'Slitherwisp', 'Sulfur Falls', 'Kessig Malcontents', 'Cloudpost', 'Ravenous Squirrel', 'Winds of Abandon', 'Weathered Wayfarer', 'Soul''s Attendant', 'Tibalt''s Trickery', 'Dispel', 'Shrine of Loyal Legions', 'Rootborn Defenses', 'Thraben Inspector', 'Elvish Archers', 'Consider', 'Orchard Strider', 'Arcbound Overseer', 'Death Grasp', 'Oust', 'Veinfire Borderpost', 'Goblin Anarchomancer', 'Brago, King Eternal', 'Port Town', 'Nissa, Steward of Elements', 'Champion of Wits', 'Jor Kadeen, the Prevailer', 'Experiment One', 'Myth Realized', 'Spelltwine', 'Mindslaver', 'Shambling Vent', 'Kitesail Freebooter', 'Pyroclasm', 'Anafenza, Kin-Tree Spirit', 'Thopter Engineer', 'Magister of Worth', 'Sheltered Thicket', 'Electrolyze', 'Satyr Wayfinder', 'Enlisted Wurm', 'Depala, Pilot Exemplar', 'Ondu Cleric', 'Wingmate Roc', 'Sigrid, God-Favored', 'Simian Spirit Guide', 'Buried Alive', 'Tidehollow Sculler', 'Faerie Miscreant', 'Lurking Predators', 'Bala Ged Recovery', 'Colossal Skyturtle', 'Glimmerpost', 'Inscription of Ruin', 'Flame Slash', 'Ghost Quarter', 'Play with Fire', 'Braingeyser', 'Game Trail', 'Trading Post', 'Reflector Mage', 'Greater Gargadon', 'Brawn', 'Mishra''s Factory', 'Holdout Settlement', 'Terminus', 'Ayara, First of Locthwain', 'Seething Song', 'Containment Construct', 'Hurricane', 'Arch of Orazca', 'Concealing Curtains', 'Ajani Goldmane', 'Urza''s Factory', 'Spell Burst', 'Phyrexia''s Core', 'Chain of Plasma', 'Angel''s Grace', 'Blood Vassal', 'Mulch', 'Terrarion', 'Academy Manufactor', 'Rune Snag', 'Avatar of Might', 'Seaside Citadel', 'Spectral Procession', 'Sprite Dragon', 'Treetop Village', 'Inspiring Statuary', 'Tragic Slip', 'Llanowar Elves', 'Ajani''s Pridemate', 'Cogworker''s Puzzleknot', 'Temple of Malady', 'Ally Encampment', 'Invade the City', 'Mycosynth Wellspring', 'Disfigure', 'Panoptic Mirror', 'Dark Ritual', 'Ominous Seas', 'Ponder', 'Torens, Fist of the Angels', 'Peacewalker Colossus', 'Filigree Familiar', 'Genesis Ultimatum', 'Shape Anew', 'Benalish Marshal', 'Beckon Apparition', 'Lead the Stampede', 'Reinforced Ronin', 'Goldmire Bridge', 'Lingering Souls', 'Sylvan Library', 'Woe Strider', 'Precinct Captain', 'Crash Through', 'Fact or Fiction', 'Vengeful Pharaoh', 'Icy Manipulator', 'Xathrid Necromancer', 'Turnabout', 'Treasure Cruise', 'Fetid Pools', 'Lose Focus', 'Avacyn''s Pilgrim', 'Infernal Grasp', 'Gigapede', 'Blade Splicer', 'Stirring Wildwood', 'Elvish Mystic', 'Polymorph', 'Experimental Synthesizer', 'Venser, Shaper Savant', 'The Eldest Reborn', 'Dream Trawler', 'Bastion of Remembrance', 'Tasigur, the Golden Fang', 'Sunset Revelry', 'Halimar Excavator', 'Spikefield Hazard', 'Moment of Craving', 'Rite of Oblivion', 'Nyxborn Shieldmate', 'Rampant Growth', 'Nether Traitor', 'Field of Ruin', 'Hard Evidence', 'Vindicate', 'Shardless Agent', 'Thirst for Meaning', 'Hieroglyphic Illumination', 'Glass Casket', 'Master of Etherium', 'Woodfall Primus', 'Kunoros, Hound of Athreos', 'Mistvault Bridge', 'Quarantine Field', 'Expedition Map', 'Lonis, Cryptozoologist', 'Frontier Bivouac', 'Abrade', 'Skyclave Cleric', 'Temple of Silence', 'Flickerwisp', 'Kazandu Blademaster', 'Ensoul Artifact', 'Arcbound Worker', 'Fading Hope', 'Ishkanah, Grafwidow', 'Glint-Sleeve Siphoner', 'Wildfield Borderpost', 'Codie, Vociferous Codex', 'Heartwood Storyteller', 'Swans of Bryn Argoll', 'Fabricate', 'Soul Warden', 'Supreme Will', 'Blackmail', 'Juggernaut', 'Thaumatic Compass', 'Goblin Kaboomist', 'Blazing Archon', 'Mystic Monastery', 'Lochmere Serpent', 'Empyrial Plate', 'End-Raze Forerunners', 'Nested Shambler', 'Ethersworn Sphinx', 'The Biblioplex', 'Elvish Piper', 'Bolas''s Citadel', 'Restore Balance', 'Sorcerous Spyglass', 'Arcbound Stinger', 'Viscera Seer', 'Deprive', 'Helm of the Host', 'Honor of the Pure', 'Bedlam Reveler', 'Spell Pierce', 'Spoils of the Vault', 'Razortide Bridge', 'Bloodchief''s Thirst', 'Liquimetal Coating', 'Izzet Charm', 'Notion Thief', 'Godo, Bandit Warlord', 'Burning Inquiry', 'Fiend Hunter', 'Blackbloom Rogue', 'Grisly Salvage', 'Pristine Talisman', 'Demonic Dread', 'Arcbound Mouser', 'Gloomshrieker', 'Jwari Shapeshifter', 'Decree of Justice', 'Arcbound Slith', 'Rise from the Tides', 'Cleric Class', 'Gather the Townsfolk', 'Okina, Temple to the Grandfathers', 'Pore Over the Pages', 'Prophetic Prism', 'Raging Ravine', 'Collected Conjuring', 'Dauntless Escort', 'Chief of the Foundry', 'Raise the Alarm', 'Dead // Gone', 'Mantis Rider', 'Evolving Wilds', 'Silver Raven', 'Sweltering Suns', 'Outland Liberator', 'Day of Judgment', 'Dragonskull Summit', 'Invoke the Winds', 'Firespout', 'Brave the Elements', 'Time Stretch', 'Eldrazi Displacer', 'Birds of Paradise', 'Gravebreaker Lamia', 'Thrill of Possibility', 'Darksteel Colossus', 'Duress', 'Pillage', 'Kefnet the Mindful', 'Whirling Dervish', 'Brainstone', 'Sea-Dasher Octopus', 'Dread Fugue', 'Thought Scour', 'Depths of 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, 67.0, mysql)

Reported on decksite by mysql-perf

Location Hash: 5ea914a6bb508d349674ca47ced2e3cc4fb50457

Labels: decksite