paginate very slow on large queries with :group
-
Mislav
- State changed from new to open
That's rather unfortunate.
Does this help?
Model.paginate :page => 1, :per_page => 10, :group => 'foo', :count => { :group => nil }That will cause the count to be performed like the
:groupoption wasn't even there. -
Michael Ragalie
That worked like a charm. All I did was use
Model.paginate :page => 1, :per_page => 10, :group => 'foo.id', :count => {:group => nil, :select => "DISTINCT foo.id"}and got the expected behavior.
Thanks for your help!
-
Sebastian
I*m sorry. But I think this is absolutly wrong, and will return wrong results.
When you group something by a specific value, and then count without the group option as described above you'll get the count of all ungrouped results.
I don't know about a better workaround to speed things up.
-
Mislav
You may be right.
But still, little can be done from will_paginate. Maybe you guys should open a Rails ticket? On the other hand, the internal implementation of OrderedHash was rewritten and now the problem may be gone (better check to be sure)
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.