On Sat, Aug 15, 2009 at 11:14 AM, harryh <har...@gmail.com> wrote: > > > class Foo extends LongKeyedMapper[Foo] with IdPK { > > def getBazes = { > > Baz.findAll(In(Baz.barid, Bar.id, By(Bar.fooid, this))) > > } > > OK, upgrading to 1.1-M4 got rid of the NPE so I'm just gonna assume > there was a bug that has been fixed. However the SQL query that lift > is generating is no good. It's doing something like this: > > SELECT bazes.cityid, bazes.xdatetime, bazes.aliasid, bazes.userid, > bazes.id FROM bazes WHERE barid IN (SELECT id FROM bars WHERE fooid = > 22120 ); > > which is WAY WAY more inefficient than this (by a factor of like > 100x): > > SELECT bazes.cityid, bazes.xdatetime, bazes.aliasid, bazes.userid, > bazes.id FROM bazes, bars WHERE bazes.barid = bars.id AND bars.fooid = > 22120; > > At least on MySQL (which is what I'm using). Is there any way to get > Lift to use a query like the latter instead of the former?
No. Lift uses IN ( ) rather than joins. I know that it's fairly recent that MySQL added nested queries, but I would have thought that they would have had a reasonable optimizer for them. > > > -harryh > > > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---