on-internet
← Community

Active Record in_batches vs find_in_batches

Stack Overflow ·

I want to perform batch operations on millions of records from DB. According to the ActiveRecord documentation, there are two methods to perform batch operations, namely #find_in_batches & #in_batches. But, I can't seem to find any difference between them except that one returns an Enumerator and the other an ActiveRecord Relation. So, considering they have different performance, I want to know which performs better in which scenario. And, is there any better way to conditionally update millions of rows except the raw SQL ?

Comments

Sign in or sign up to comment and upvote.

No comments yet.