Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Avoid using the incorrect index with heavy scheduled event count #7901
Please be sure you are submitting this against the staging branch.
At high volume, when there are a few hundred thousand campaign events scheduled to occur (say you get a bit behind) MySQL will stop using the campaign_events_scheduled index and instead try to use campaign_actions for scheduled campaign event triggers (particularly 5.6+).
This is bad, because it takes a query that may take 7 seconds, and causes it to take more like 900 seconds.
We don't like to force indexes w/ DBAL, but luckily a one-character change to the query will result in more efficiency and no accidental index use (by building on the first join).
Steps to test this PR: