pluck_in_batches gem - a faster alternative to custom `in_batches` with `pluck`
I released a new gem - https://github.com/fatkodima/pluck_in_batches
It is 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
Post a comment