find_in_batches vs limit

4 views
Skip to first unread message

badnaam

unread,
Aug 28, 2010, 5:18:47 PM8/28/10
to Ruby on Rails: Talk
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)

Colin Law

unread,
Aug 28, 2010, 5:22:28 PM8/28/10
to rubyonra...@googlegroups.com

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

Reply all
Reply to author
Forward
0 new messages