the smartest thing to do would be to avoid orderby when there are less 
records than paginate.
However, it's unusual to have a query misbehaving for a couple hundreds 
records, and I really don't see the point on using grid with paginate=10000.
Given that pagination is 99% of the time required, we need to orderby on 
something....
What we should orderby to then? The only assured field that has an implicit 
index is the id (being a PK). Orderby(ing) a PK should definitely not 
require a full scan.
I don't see any particular case other than exceptional misbehaving tables 
to turn off the ordering.

On Tuesday, October 8, 2013 1:53:50 PM UTC+2, Anthony wrote:
>
>
> db.table(id=3) is for returning the sole matching record, so you don't 
>>> have to worry about the database's arbitrary ordering of results. But when 
>>> using limitby to return a particular subset of records (e.g., when doing 
>>> pagination), don't you need to specify an orderby to guarantee that the 
>>> results on each query will remain in the same order?
>>>
>>> Yes you need to do it, and you need to do it in a proper way.  That is 
>> why i think that forcing orderby when limitby is used is not a good idea. 
>>  Seems just a hack for the grid, not a generic approach.  IMHO it's better 
>> to be explicit.
>> Consider that on datasets of size comparable to the window imposed by the 
>> limitby, the result is that if one uses limitby then he goes slower than 
>> without it, because of the implicit orderby. Maybe he wonders why (and all 
>> sorts of bad things about web2py ;- )
>>
>
> I suppose we could default orderby_on_limitby to False in the general case 
> and leave it to the developer to explicitly orderby when using limitby, but 
> what do you propose for the grid?
>
> Anthony
>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to