Announcing pluck_in_batches - a new gem providing a faster alternative to the custom use of `in_batches` with `pluck`

I released a new gem (GitHub - fatkodima/pluck_in_batches: A faster alternative to the custom use of `in_batches` with `pluck`).

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:

# Before
User.in_batches do |batch|
  emails = batch.pluck(:emails)
  # do something with emails
end

# Now, using this gem (up to 2x faster)
User.pluck_in_batches(:email) do |emails|
  # do something with emails
end
2 Likes