I have a RoR app and a cron rake-task, something like:
Model.all.each do |m|
if m < some_condition
m.do_something
m.save
end
end
Model has 1 000 000 records (and 200 000 with acceptable conditions). Is there any way to improve task memory usage? It takes gigabytes of memory, and Ruby process is killed by the server on production. My DB is PostgreSQL.