I don't think the implementation core functionality should be based on
on how MySql handles something.

:limit, :offset, and :order are only options parameters that I'm
exposing in case the developer needs them. If you want to iterate over
the entire data set you can certainly do so and these options will not
be sent to the database. In fact, in some circumstances, the query
will end up more efficient. If you construct a horrendously complex
query that the optimizer doesn't come up with a good plan for, the
code in my patch will execute the horrible query once and afterward do
a simple "WHERE id IN (?, ?, ...)" query for every batch. Using "id
> ?" will execute the same query for every batch.

On Mar 5, 7:20 pm, Mislav Marohnić <[email protected]> wrote:
> Ordering is forced to the "id" column because:
>
>    1. mysql optimizes iterating over huge datasets when you use the "WHERE
>    id > ?" clause much better than with LIMIT and OFFSET;
>    2. you don't need ordering -- every single record gets yielded.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to