On Thursday, March 15, 2018 at 12:19:18 AM UTC-7, 
[email protected] wrote:
>
> Hi, I understand that. But paged_each is selecting whole table instead in 
> batches. Maybe it's because I connect additional servers? Im fetching 
> additional server`s database.
>

The query does select the whole table, but results are streamed using 
Mysql2 streaming support.  This is equivalent to a batch size of 1.  You 
don't see the batching, as it's not done with separate queries, but 
internally.

At the risk of being redundant: The purpose of paged_each is to iterate 
over large result sets without keeping all rows in memory.  The default 
implementation of paged_each uses LIMIT/OFFSET since that should work on 
all databases.  paged_each can be made to use ORDER BY and WHERE, which 
should also work on all databases.  However, if streaming results is 
supported, that's usually the fastest approach and the default where it is 
supported.

Thanks,
Jeremy

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

Reply via email to