I am optimizing my SQL queries on my heroku server, so I can speed up work on one specific query. Now I mainly look at compressing all INSERT queries into as few queries as possible.
At some point in my code, I have the following:
jobs.each do |j| Delayed::Job.enqueue j end
I found out that each iteration sends BEGIN, INSERT, COMMIT to db. This jobs array can have from several to several hundred objects. I was looking for a way to batch insert slow-motion jobs, but couldn't find anything. Any idea on how to achieve this?
source share