Hahah... I hope that was not meant as a perjorative!! But no... more like a postgresql novice myself..
Anyway, it's hard to see how the two query plans are equivalent... don't have time to work though the example but would be interested to see the comparison if someone tries it. On Wednesday, September 25, 2013 2:56:09 PM UTC+8, Niphlod wrote: > > > > Il giorno mercoledì 25 settembre 2013 08:46:15 UTC+2, onetwomany ha > scritto: >> >> >> >> you can do that with >>> >>> all_courses = db(db.courses.id>0)._select(db.courses.memberid) >>> all_members_not_in_courses = db(~db.members.id.belongs(all_courses)) >>> >>> >>>> >> Would such an approach be computationally expensive particularly if the >> number of rows in courses is high? Perhaps the following raw SQL expression >> would be more efficient: >> >> from gluon.dal import Expression >> all_members_not_in_courses = db((db.members.id>0)&Expression(db, 'NOT >> EXISTS (SELECT courses.memberid FROM courses WHERE courses.memberid= >> members.id)')).select() >> > > > oh boy, a MSSQL user, I guess :P .... The query plan is roughly > equivalent. What instead would be beneficial is "inner selecting" a > distinct set. > -- 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.