Noted. I removed some while loops with tremendous results. It now works
well.
Regards.

On Sep 18, 2018 7:02 AM, "Massimo Di Pierro" <massimo.dipie...@gmail.com>
wrote:

> I understand the confusion. In SQLAlchemy for example people use .first()
> for fetch one record. In web2py the feching is by the select. .first() just
> gives you the fist of the records that were retrieved.
>
> On Sunday, 2 September 2018 18:52:35 UTC-7, Anthony wrote:
>>
>> - my first attempt will be to try to add indexes in the post and answers
>>> Table on the field author.
>>> - secondly i will try to change this row
>>>
>>>> row = db(db.post.author== auth.user.id).select(db.post.id, db.post.
>>>> message, orderby=~db.post.id, limitby=(0,1)).first()
>>>
>>> to this
>>>>
>>>> row = db(db.post.author== auth.user.id).select(db.post.id, db.post.
>>>> message, orderby=~db.post.id).first()
>>>
>>>
>>> limitby ist not needed in that case. it is just my opinion.
>>>
>>
>> Why would you not use limitby? Without limitby, the database will return
>> every record in the table, and the the DAL will have to parse every record
>> and convert it to a Row object -- and then all of those Row objects will
>> simply be ignored, as only the first will be used in the code.
>>
>> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/OJRaYk57ZPQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/d/optout.

Reply via email to