I have a massive table Foo from which I need to pluck all values in a certain field, Foo.who.
The array has millions of rows, but only a few thousand different values in the who
column.
If the table was smaller of course I'd simply use Foo.pluck(:who)
If I use Foo.find_in_batches do |a_batch|
each set is an Array of Foo records, rather than an activerecord collection of Foo records, so I cannot use .pluck()
and AFAIK the only way to extract the who
column is via something like .map(&:who)
that iterates over the array.
Is there a way to pluck the who
column from Foo in batches that does not require then iterating over each element of each batch to extract the who
column?