# Find\_in\_batches vs limit

**URL:** <https://www.ruby-forum.com/t/find-in-batches-vs-limit/194043>\
**Category:** Rails\
**Created:** [August 28, 2010, 11:19pm UTC](https://www.ruby-forum.com/t/find-in-batches-vs-limit/194043 "2010-08-28T23:19:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![badnaam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e36b37/32.png) [@badnaam](https://www.ruby-forum.com/u/badnaam)\
**Post date:** [August 28, 2010, 11:19pm UTC](https://www.ruby-forum.com/t/find-in-batches-vs-limit/194043/1 "2010-08-28T23:19:31Z")

</div>

Is the :limit option in the regular find call effectively same as  
doing find\_in\_batches? or does doing something like the following  
loads “all” of the record and then returns only 5?

find(:all, :conditions =\> [‘age \> ?’, age], :limit =\> 5)

---

<div class="post-metadata">

**Author:** ![badnaam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e36b37/32.png) [@badnaam](https://www.ruby-forum.com/u/badnaam)\
**Post date:** [August 28, 2010, 11:27pm UTC](https://www.ruby-forum.com/t/find-in-batches-vs-limit/194043/2 "2010-08-28T23:27:43Z")

</div>

On 28 August 2010 22:18, badnaam [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is the :limit option in the regular find call effectively same as  
> doing find\_in\_batches? or does doing something like the following  
> loads “all” of the record and then returns only 5?
> 
> find(:all, :conditions =\> [‘age \> ?’, age], :limit =\> 5)

It will only find 5 rows.

By the way you could easily have found this by looking at the docs for  
find, or by trying it and looking in the log to see the SQL generated.

Colin
