[Feature Request] [Active record] - Add order option to "find_in_batches" and

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Feature Request] [Active record] - Add order option to "find_in_batches" and

佑馬光吉
Currently, if "primary_key" does not exist, "find_in_batches" and "find_each" will result in an error.
Since there may be cases where "primary_key" does not exist when performing batch processing,
I think that it can be solved by adding an order option.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Feature Request] [Active record] - Add order option to "find_in_batches" and

Alberto Almagro
Hi,

in my opinion I would order by something in cases where few objets are retrieved from DB, for example when showing a result on a template to an end user. On the other side I would use find_in_batches or find_each for background jobs or queries dealing with lots of objects to reduce memory consumption... and in those cases I don't feel like any order is needed. Why do you think it is important to have them ordered?

Kind regards,
Alberto Almagro

El domingo, 28 de enero de 2018, 14:31:16 (UTC+1), 佑馬光吉 escribió:
Currently, if "primary_key" does not exist, "find_in_batches" and "find_each" will result in an error.
Since there may be cases where "primary_key" does not exist when performing batch processing,
I think that it can be solved by adding an order option.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Feature Request] [Active record] - Add order option to "find_in_batches" and

Tchoum Tux
In reply to this post by 佑馬光吉
it might be necessary to replay ordered events stored in DB

Le dimanche 28 janvier 2018 14:31:16 UTC+1, 佑馬光吉 a écrit :
Currently, if "primary_key" does not exist, "find_in_batches" and "find_each" will result in an error.
Since there may be cases where "primary_key" does not exist when performing batch processing,
I think that it can be solved by adding an order option.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Feature Request] [Active record] - Add order option to "find_in_batches" and

James Coleman
Fundamentally it’s not efficiently possible to find items in batches without a unique orderable value and and defined ordering by that value, because otherwise you’d have to always include a list excluding everything else you’ve already gotten (and even then you’d need a unique value/set of columns to do that). 

On Tuesday, May 8, 2018, Tchoum Tux <[hidden email]> wrote:
it might be necessary to replay ordered events stored in DB

Le dimanche 28 janvier 2018 14:31:16 UTC+1, 佑馬光吉 a écrit :
Currently, if "primary_key" does not exist, "find_in_batches" and "find_each" will result in an error.
Since there may be cases where "primary_key" does not exist when performing batch processing,
I think that it can be solved by adding an order option.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.