>If you have a properly clustered table,  possibly a readonly table, you 
don't need any orderby even paginating through the grid.
Maybe. It appears that will only work if there is a covering index used in 
the query. I don't think Web2Py specifies which indexes are used for a 
query, so even if the data is physically ordered correctly, and you are 
using postgres, you aren't guaranteed that multiple result sets would have 
the same order unless you specify an order (or web2py knows that it's using 
a clustered index and the table is indexed and it's readonly).

Regardless, cluster is not part of the SQL standard, so we can't rely on 
one specific implementation.

On Wednesday, October 9, 2013 2:53:23 PM UTC-7, Michele Comitini wrote:
>
> Just to avoid confusion, when I say clustered I am talking about 
> postgresql.  See: 
> http://www.postgresql.org/docs/current/interactive/sql-cluster.html
>
>
>
>
> 2013/10/9 Derek <sp1...@gmail.com <javascript:>>
>
>> You have a point, if it's a grid or smartgrid, and paging is enabled, it 
>> should be sorted by the developer's preference, and secondly by the primary 
>> key, whether that's an ID or something else.
>>
>>
>> On Wednesday, October 9, 2013 1:41:04 PM UTC-7, Anthony wrote:
>>>
>>>
>>> Good point -- perhaps orderby_on_limitby should default to False -- then 
>>>>> the grid can simply set it to True. Actually, I wonder if the grid should 
>>>>> go further and additionally order on primary keys even when an explicit 
>>>>> orderby is specified (just in case the orderby field(s) do not contain 
>>>>> unique values).
>>>>>
>>>>
>>>> No, it should preserve the order you set. If you know enough to set the 
>>>> order, you can add columns to the order easily enough.
>>>>
>>>
>>> Not sure I agree with that. Users typically specify an orderby only 
>>> because they would like the records displayed in a particular order, not 
>>> because they are seeking to explicitly handle pagination. Let's say I'm 
>>> listing US addresses in a grid and specify orderby=db.address.state. In 
>>> that case, I'm saying I want addresses sorted by state, and within state, I 
>>> don't care about the order. But I'm not saying that I want pagination to 
>>> fail in case records from a given state happen to span from one page to the 
>>> next. Just because I want to order by state doesn't mean I know enough to 
>>> provide all the necessary orderby fields to guarantee proper pagination. If 
>>> the grid does this for me when I specify no orderby, why shouldn't it do it 
>>> for me when I do specify an orderby?
>>>
>>> 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+un...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

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