[Dbix-class] Avoiding _prune_unused_joins

Peter Rabbitson rabbit+dbic at rabbit.us
Fri May 10 16:04:07 GMT 2013


On Fri, May 10, 2013 at 04:46:45PM +0100, Bob MacCallum wrote:
> (I'm using 0.08250)
> 
> I'll avoid a boring preamble and just ask if anyone could advise on
> how to construct resultsets so that deep in the internals,
> _prune_unused_joins isn't called?  (so as to save me some CPU cycles)
> 
> I have tried to read the code but I'm not really sure what $ident is holding.
> 
> Here's the query that is called most in my code:
> 
>   my $rs = $row->some_relation->search(
>      {},
>      { where => { rank => { '>' => 0 } },
>        order_by => 'rank',
>        prefetch => { type => { 'dbxref' => 'db' } } }
>   );
> 
> Performance with the prefetch is slightly better than with no prefetch at all.
> Appreciate any help!

$schema->storage->_use_join_optimizer(0);

Note - this *will* be deprecated and removed in the future, when the 
internals get rewritten to avoid the perl-side penalty. Make sure you 
write a specific test to catch the disappearance of this method. It is 
not a question of "if" but of "when".

Cheers



More information about the DBIx-Class mailing list