Am 09.04.2010 17:10, schrieb Bernhard Graf:
> Meanwhile I found out, that the resultset attribute "rows" is
> "responsible" for switching to the big SQL code:
Thinking again I realized that this makes pretty much sence.
> my $new_rs = $artist_rs->search(
> undef, {
> prefetch => 'cds',
> rows => 2,
> }
> );
>
> [...]
>
>
> SELECT me.id, me.name, cds.id, cds.artist_id, cds.title
> FROM (
> SELECT me.id, me.name
> FROM artist me
> GROUP BY me.id, me.name
> LIMIT 2
> ) me
> LEFT JOIN cd cds ON cds.artist_id = me.id
> ORDER BY cds.artist_id
That way really only two artists are fetched - well done! :)
Is the GROUP BY on all columns useful? Does that affects perfomance?
Bernhard Graf
_______________________________________________
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/[email protected]