Makes sense. Thanks again! On Friday, December 30, 2016 at 12:21:46 AM UTC-5, Jeremy Evans wrote: > > On Thursday, December 29, 2016 at 5:55:38 PM UTC-8, Greg Gilbert wrote: >> >> Quick update: with those changes, doing the following... >> >> vendors = Vendor >> .where(:user_id => 1) >> .eager(:last_edit) >> .all >> >> yields a query of: >> >> INFO -- : (0.000693s) SELECT * FROM (SELECT * FROM `vendor_revisions` >> WHERE (1 = `vendor_revisions`.`vendor_id`) ORDER BY `created_at` DESC LIMIT >> 1) AS `t1` UNION ALL SELECT * FROM (SELECT * FROM `vendor_revisions` WHERE >> (2 = `vendor_revisions`.`vendor_id`) ORDER BY `created_at` DESC LIMIT 1) AS >> `t1` >> >> and it returns the correct values. Is that the expected behavior? >> > > Yes, that's the optimized behavior I was referring to. For only a couple > of edits, it actually performs worse, but once you get to lots of edits, it > should perform much better. You can always choose to use a different eager > limit strategy other than the default of :union with the appropriate option > if you find it doesn't produce the most optimized code in your application. > > Thanks, > Jeremy >
-- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
