On 10 March 2015 at 13:44, Niphlod <niph...@gmail.com> wrote: > 2 queries ? nooooo > > subselect - way, 1 query. > > And you think using a subselect makes it one query?
I had a mistake in my query: orderby should be groupby - which is more efficient (at least on PostgreSQL than using "distinct"). A query explain on your query shows: [image: Inline images 1] Thinking a subselect makes it one query is an illusion. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- 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.