[Dbix-class] Query Building Help

Brandon Black blblack at gmail.com
Thu Aug 10 17:08:17 CEST 2006


On 8/10/06, Ash Berlin <ash at cpan.org> wrote:
>
> Right then guys:
>
> I am trying to build the following query:
> [......]
> Any recourse?


I don't think you've got enough join/prefetch's in your DBIC version to be
doing what you want it to do.  All total, there should be three JOIN
operations taking place.

I would suggest re-writing your original query using real JOINs first, then
attacking it from DBIC.  I know Pg accepts what you've got (maybe other DBs
do too?) by basically running a query analysis and then creating what it
thinks is the optimal set of JOINs for your list of tables and WHERE
conditions.  But it will be easier to see the discrepancies if you specify
your JOINs explicitly (its also easier to tune your queries for performance
that way).  DBIC will always generate explicit JOIN syntax.

-- Brandon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/dbix-class/attachments/20060810/f289fe4c/attachment.htm 


More information about the Dbix-class mailing list