[web2py] Re: Building up a Query from nothing

2011-10-06 Thread howesc
"if an extraneous "db.item.id>0" impacts the query performance at all?" depending on the system it definitely does for sufficiently complex queries. on GAE, probably no effect, on oracle,mysql, postgres it depends on how you setup your indexes - you can probably write indexes so it has close t

[web2py] Re: Building up a Query from nothing

2011-10-06 Thread pbreit
I like the "query &= fragment" approach better but am not sure how or if you can set up the default. Does anyone know if an extraneous "db.item.id>0" impacts the query performance at all?

[web2py] Re: Building up a Query from nothing

2011-10-06 Thread howesc
how about use bruno's suggestion, but leave out the default at the top. if the list of queries is empty when you get to the reduce step then set query=(db.table.id>0) otherwise do the reduce?

[web2py] Re: Building up a Query from nothing

2011-10-05 Thread Kevin Ivarsen
A couple other notes: - I know I could start with a query that will return everything, like "db.person.id > 0", but I'm worried about how that will interact with queries that are optimized by an index that doesn't include the id column - An old trick when building up SQL WHERE statements as strin