Re: Iterators fetch the entire result set into memory
[prev]
[thread]
[next]
[Date index for 2005/01/24]
On Sat, Jan 22, 2005 at 08:06:49PM -0500, Perrin Harkins wrote:
> Brian Doig wrote:
>
> >Is there any
> >way to emulate the equivalent of the DBI fetchrow statements with
> >Class::DBI?
>
> If you're doing a paging-style app, you could look at
> Class::DBI::Plugin::Pager. If you need to go through the whole set one
> row at a time, you would probably need to override some things and make
> more substantial changes.
I think Class::DBI could be 'fixed' so the iterator works at the
statement handle level. But no one has felt sufficiently motivated
to provide a patch.
> Keep in mind, many databases (MySQL, PostgreSQL) fetch all of the data
> at once rather than one row at a time, regardless of how you call DBI.
True, but the memory used by the underlying db row buffer is less
than for the equivalent CDBI row buffer. Performance would also be
better in cases where not all the rows will be iterated over.
> You would have to change parameters or use cursors to avoid that.
But at least you could if you wanted to.
Tim.