On Wednesday, December 4, 2013 4:57:03 PM UTC+1, Anthony wrote: > > First, if you are using cache=..., you do not also need to set > cacheable=True. Using the former, the DAL automatically handles caching for > you. Setting cacheable=True is only for cases where you want to manually > cache the Rows object, so you wouldn't be using cache=... in that case. >
Uhm... if I don't want auto-references, row.update_record() and row.delete_record() I use cacheable=True AND cache=cache.ram (or something). cacheable=True brings a noticeable speedup for large datasets, however for a small set, I completely agree > > Second, the .find() method is a method of the Rows object and has nothing > to do with caching. It loops through the records in the Rows object and > extracts just the Rows that satisfy the search criteria. In this case, your > filter function includes row.contato.site, which is a recursive select, so > it is doing an additional db select for every Row in reports. Furthermore, > you are not caching the testdrives object, so this happens on every > request, even if the reports object has been cached. > > Instead of using the .find() method to filter the reports objects, it > would probably be much more efficient to simply do an additional database > query to get the testdrives records, using either a join or a nested select. > > +1000 . For any folk listening.....be careful doing things like row.reference_field.referenced_table_field. Use joins! -- 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.