Matt S Trout writes:
> George Hartzell wrote:
> > I've put together a dead-simple example that demonstrates the problem
> > that I'm having using prefetch. Three tables, 4 rows of data in
> > total, simple driver script, etc....
>
> You can only prefetch one "direction" of has_many rels at once. Anything
> else
> results in a cross-product return of records which tends to be heinously
> inefficient anyway.
>
> i.e.
>
> [ 'hm_rel', 'other_hm_rel' ] won't work
>
> although
>
> [ { 'hm_rel' => { 'belongs_to_rel' => 'ya_hm_rel' }, 'other_belongs_to_rel' ]
>
> and similar are fine.
Ok.
So, working with the example that I posted, what's the most effecient
thing to do if you want to get back an "A" and all that goes with it?
Sounds like I just have to pick whether I'm more likely to monkey with
the A's b's or c's and just prefetch one or the other.
Right?
Given that I tend to do this (and assuming that I haven't prefetched
the b rows)
grep {$_->b_name eq 'MOOSE'} $a->bs();
is there some way to use cache=>1 to my advantage?
Thanks,
g.
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/