[Dbix-class] Weird RelationShip => SQL behavior and Performance Issue

Matt S Trout dbix-class at trout.me.uk
Thu May 31 15:25:14 GMT 2007


On Thu, May 31, 2007 at 03:37:47PM +0200, Benoit Plessis wrote:
> 
> In fact i think it's the generation of the SQL query that take all the
> time or it could be the prefetching.

It's unlikely to be on the DBIC side.

Try setting DBIC_TRACE=1 and running the query against your DB yourself.

MySQL is notoriously crap at handling prefetches across many rels.

> Is it a way to prepare the resultset with all arguments except the
> search condition value, and just run the query in each loop ?
> Like the famous prepare / execute combo in DBI ?

DBIC effectively does that - for a given query it'll re-use the same
already-prepared $sth.

Don't try and micro-optimise your usage - somebody once built almost
exactly what you describe shortly before we implemented the current approach
and found it provided about a 2% speed improvement.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Dbix-class mailing list