Yes, the reference fields execute a query each time when you access their 
attributes -- there is no caching. I think it might be a good idea to 
implement caching as an option. Even better, there should be an option to 
fetch the related records for all rows along with the initial select, 
either via a join or a single additional select -- this would be much more 
efficient than running a separate select for each row when you've got lots 
of rows.

Anthony

On Tuesday, August 13, 2013 3:34:37 AM UTC-4, Quint wrote:
>
> Hello web2py users,
>  
> I have a question about reference fields.
>  
> When i access a attribute of a reference Field, i notice that the 
> reference field is represented by an instance of the "Reference" class.
> When i access attributes on that reference , will it perform a new query 
> each time or does it cache previous queries somehow?
>  
> BTW, I'm using *GAE*
>  
> Example:
>  
> I have a table "comment" which has a reference field "author auth_user"
> Now i perform a query and i retrieve a list of comments which contains a 
> lot of comments from the same user.
> When i access a attribute on those comments will it query the auth_user 
> table for all comments of the same author?
>  
> Thanks and regards.
>

-- 

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