delayed_job
delayed_job copied to clipboard
DelaydJob SQL request are very slow
NewRelic RPM show me the DelaydJob SQL request as very slow. MySQL Slow Query Log does the same. What exactly column should be indexed? single or multiple columns indexes? Does anybody do an analysis?
I have found an interested article, Tobi, please take a look, can it help? http://www.elevatedcode.com/articles/2009/11/04/speeding-up-delayed-job/
You need this. http://github.com/collectiveidea/delayed_job/commit/c743446a31fe5683544b78e9bf86dec371923b38
Depending on which database you use there are different solutions:
- with MySQL you should reverse priority order and create a composite[:priority, :run_at],
- with Postgres you should create a composite index with different order on both columns priority DESC, run_at ASC.
Hope this helps.
BTW I am using the former "method" with thousands of jobs in table with no problem.
Great thanks! But I'm using of gem instead of plugin. Is it possible to pull request to official version?
You can also use it as a gem. Just look at README http://github.com/collectiveidea/delayed_job#readme