Well even if you're writing the query using the DAL the actual data processing is being done by the database itself so that's where the "short circuiting" would need to happen and is dependent on the database's query optimization. Try running a SQL version of the query directly against the DB and see if it's any faster. You can try some optimizations in the database tables, for example setting up an index on webhook_table.status may help.
On Friday, November 25, 2016 at 10:11:38 PM UTC-6, Albert Rothman wrote: > > Do conditionals short circuit in DAL queries? Is there a way to force them > to. For example I have the following query: > count = db((db.webhook_table.status==3) & (db.webhook_table.webhook_data. > contains(premsys.form_id))).count() > None of the entries have a status of 3, so I expect the query to return 0 > very quickly. I expect the contains function to run fairly slowly since it > has to check every string, but I was expecting the status=3 portion to > short-circuit the conditional and make the query execute fast. Is there a > way to force short circuiting? > > -- 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.