On Friday, April 5, 2013 11:58:37 PM UTC+2, Martin Barnard wrote: > > Thanks for the info, Niphlod. > > I will look into the efficiency of the IN clause for my needs, as it > appears to offer a solution which may mollify the IT DBA, and his demands > for bind vars (they are concerned that a looped select will bring the db to > it's knees). > > .... a db(whatever.belongs(a_set)) issues ONE query only.
If you want to "force" a looping query, you should do explicitely with mems = [1,2,3,4,5,6,...] for c in mems: one_result = db(db.table.field == c).select() ...... of course, for zillions values into mems, it's not a smart move. the smartest move with a huge set (i.e. the technique with most of the "balance") would be "paginating" through your "mems" . You'd loop a few times but if you have thousands of values into "mems", a single IN () (or thousands ORs) will take some time .... Try to "draw a limit" with your DBA and if he says that you're "allowed" to do an IN() with 500 values at a times, you have it covered ^_^ On the other end, you have a requirement..... fetch a zillions rows..... either you do it in one shot or in zillions/500 each. -- --- 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.