The repair SQL to delete expired jobs and old jobs with no unresolved dependencies was basically scanning the whole minion_jobs table. Splitting it into two simper queries allows each of them to use the index on the "state" column (and only do the JOINs when actually needed), so overall it runs faster and reduces the likelihood of lock wait timeouts.
The repair SQL to delete expired jobs and old jobs with no unresolved dependencies was basically scanning the whole minion_jobs table. Splitting it into two simper queries allows each of them to use the index on the "state" column (and only do the JOINs when actually needed), so overall it runs faster and reduces the likelihood of lock wait timeouts.