Forum: Ruby on Rails ActiveRecord and Cursors (with PostgreSQL)

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
B9f28a2235697025ebfcebb81575a6b8?d=identicon&s=25 Allen Fair (Guest)
on 2006-01-10 00:05
(Received via mailing list)

Is there a way to access database cursors using Rails, preferably
through ActiveRecord? I believe the standard usage loads the entire
result set into memory. However, for extremely large results (or when I
don't want to abuse memory levels), this is sometimes not possible.

While it may not be feasible for a web application to process huge
amounts of data, I want to run this as an asynchronous task, "cron" task
or similar.

I recently encountered this problem with my Perl application returning a
large result set from PostgreSQL. The solution was to execute 'define
cursor' and 'fetch 1000' commands, with the fetch methods. I hope to
port this application or feature to Ruby on Rails.

This topic is locked and can not be replied to.