AnyMode.all.each do |r| # inefficient # will instantiate all the objects at once. end AnyModel.find_each do |r| # efficient # work with the records in batches(batch_size:), thereby greatly reducing memory consumption end