A faster alternative to the custom use of `in_batches` with `pluck`

ActiveRecord comes with find_each / find_in_batches / in_batches methods to batch process records from a database. ActiveRecord also has the pluck method which allows the selection of a set of fields without pulling the entire record into memory.This gem combines these ideas and provides pluck_each and pluck_in_batches methods to allow batch processing of plucked fields from the database.It performs half of the number of SQL queries, allocates up to half of the memory and is up to 2x faster (or more, depending on how far is your database from the application) than the available alternative:.
A faster alternative to the custom use of `in_batches` with `pluck` #ruby #rubydeveloper #rubyonrails https://www.rubyonrails.ba/single/a-faster-alternative-to-the-custom-use-of-in_batches-with-pluck

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles