On Oct 6, 1:42 pm, Jeremy Evans <[email protected]> wrote:
> On Oct 6, 10:10 am, jreidthompson <[email protected]> wrote:
>
> > Does sequel automatically use cursors for postgresql/can I make it use
> > a cursor?
> > I have a table with > 10M rows that I need to iterate over and update
>
> Sequel::Dataset#each iterates over rows as the database adapter
> provides them.  So the answer depends on whether the underlying
> database driver keeps all rows in memory or not.  I've heard from
> multiple users that the MySQL adapter does not keep all rows in
> memory, but I haven't heard reports either way about the PostgreSQL
> adapter.  Can you try the following code:
>
>   DB[:table_with_10m_rows].each{|row|}

DB[:table_with_10m_rows].each{|row| puts row }
top shows memory usage growing, with no output
after it hit ~400 MB I killed it

>
> If memory usage for the process grows without bound, it's probably
> keeping all rows in memory.  If memory usage is fairly constant, it's
> probably not.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" 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/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to