[Dbix-class] how do resultsets actually work under the hood?

Carl Franks fireartist at gmail.com
Tue May 28 22:12:34 GMT 2013


Hi Iain,
Setting the ENV variable DBIC_TRACE=3D1 will cause all statements to be
printed to STDERR. - This should show whether it's requesting each row from
the db  individually.
The DBIC docs also show how to send the trace to a file (I forget offhand
how it's done).
Hope this helps,
Carl
 On 28 May 2013 22:38, "Iain C Docherty" <dbix-class at iain-docherty.com>
wrote:

> I was in conversation with a Java programmer today about the design of a
> database system, in a nutshell he was saying that in Java he would create=
 a
> 'collection' of all rows in a table and then iterate over the collection =
of
> objects. If it was too big he would 'split' the query by searching for all
> records starting with 'a', then 'b' etc.
>
> I was appalled that this would eat up memory, and starting going on about
> DBIC and how in Perl I would create a resultset then iterate over it using
> 'next'.
>
> I soon realized that I didn't have much idea how this 'just worked' under
> the surface (in DBI I presume?) without using large amounts of memory to
> hold every row from the table.
>
> I have done some digging since, I have looked at the DBI code, but frankly
> I got rather lost.
>
> So, can anyone give a concise description on how this works, in particula=
r.
>
> Where (if anywhere) does it store a record of every row in a resultset so
> that I can just call 'next' and quickly get the next row.
>
> Or does it do this by making a request to the database for every row?
> Isn't this slow?
>
> Thank you.
> Iain.
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20130528/b69=
e6441/attachment.htm


More information about the DBIx-Class mailing list