From: Alan Chen Date: 2001-12-07T14:26:56+09:00 Subject: [ruby-talk:27785] Re: DBI and large result sets Well, you could declare a cursor in SQL. I believe its a standard SQL92 feature. PostgreSQL supports it. I don't know about MySQL. On Fri, Dec 07, 2001 at 01:26:31PM +0900, JamesBritt wrote: > I'm starting to use Ruby DBI, and I'm wondering about its use when processing > very large result sets. > > Given that DBI sits on top of various DB drivers, is there some way to use DBI > to run a query and process each record set without necessarily having to hold > the entire result set in memory? Or is DBI too abstract to allow you to make > any assumptions about that? > > DBI::StatementHandle has fetch_many, but I think it works on a local store of > the entire result set (whereas I want it to pull the data from the database > only as I request a number of rows). > > Basically I want the SQL query to behave like a stream, not a single, huge, > chunk o' data, but not have to tie the code to a specific database (if > possible). > > > Thanks, > > > James > > -- Alan Chen Digikata LLC alan@digikata.com http://digikata.com