It looks like I needed to patch query.rb to no longer raise an exception when it gets a nil order by argument. This allowed the first method to take this:
first(:deleted => false, :order => [nil]) Not the prettiest thing ever, but at least it works. On Nov 18, 1:31 pm, Sam Smoot <[EMAIL PROTECTED]> wrote: > I believe the sort is added by a default scope, so you may just want > to inspect the scoping mechanism to disable this. > > More of a one-line hack than a full on monkey-patch hopefully. > > And BTW, this is on the list to remove for 1.0. > > -Sam > > On Nov 18, 2:51 pm, cliffmoon <[EMAIL PROTECTED]> wrote: > > > Is there a reason why DM will issue an order by id as part of a query > > issued from Model#first? I'm trying to query a rather large table and > > the filesort incurred from the order by is simply killing the > > performance. I'm using dm 0.9.3. > > > A query like: > > > Model.first(:deleted => false) > > > is resulting in this SQL call (a lot of properties have been removed > > for brevity): > > > SELECT `id`, ... FROM `model` WHERE `deleted` = FALSE ORDER BY `id` > > LIMIT 1 > > > Since the list of matching rows is quite large, the order by is using > > a very expensive filesort. How do I turn off the order by? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
