Kevin,

I think that these are in there because from a logical view there's
nothing wrong with them (even if they might not be necessary), and
more importantly, because they will ensure consistent ordering across
datastores. Not all datastores do the same default ordering, and this
is a way of making sure results ordering will be consistent.

Obviously there are situations where you don't want/need the side
effects of these operations, as you pointed out. It's good to know
that these have negative impact on performance, but I'm afraid that I
don't know where to point you in the code.

cheers
snusnu

On Wed, Jul 14, 2010 at 00:31, Kevin <[email protected]> wrote:
> Anyone else noticed this strangeness with GROUP BY and ORDER BY being
> included for all association retrievals?  Any tips where to look in
> the source?
>
> -Kevin
>
> On Jun 27, 6:14 pm, Kevin <[email protected]> wrote:
>> Here's my next thing to hack/fix, hopefully:
>>
>> Groups HABTM Users.  Calling group.users loads this SQL:
>>  ~ (0.000226) SELECT `id`, `title`, `group_apps` FROM `groups` WHERE
>> `id` = 1 ORDER BY `id` LIMIT 1
>>  ~ (0.000272) SELECT `users`.`id` FROM `users` INNER JOIN
>> `groups_users` ON `users`.`id` = `groups_users`.`user_id` INNER JOIN
>> `groups` ON `groups_users`.`group_id` = `groups`.`id` WHERE
>> `groups_users`.`group_id` = 1 GROUP BY `users`.`id` ORDER BY
>> `users`.`id`
>>
>> The Group by / Order by causes this in the explain for the query:
>> Using index; Using temporary; Using filesort.  Needless to say, with
>> large result sets this won't work.
>>
>> Any tips?  Is this a known problem anyone else has run into?  Any
>> suggestions where to start looking in the source?
>>
>> Ciao,
>> Kevin
>
> --
> 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.
>
>

-- 
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.

Reply via email to