In ruby on rails, is it possible to do a sum query with group by using the find_each batching?
- by BarryOg
I'm loading data from my database and I'm doing a sum calculation with a group by.
ElectricityReading.sum(:electricity_value, :group => "electricity_timestamp", :having => ["electricity_timestamp = '2010-02-14 23:30:00'"])
My data sets are extremely large, 100k upwards so I was wondering if its possible to use the find_each to batch this to help with memory overhead.
I can write the batching manually use limit and offset I guess but I'd like to avoid that if the code already exists.