Performance with multiple OR operators
Does anyone have an idea how the use of multip开发者_如何学Pythonle ORs impacts performance in app engine (cpu time use maybe?). Something like:
select from users where username = 'bob' or
username = 'jane' or
username = 'greg' or
username = 'Nth user';
I think we can only layer 30 of these in at once. I'm curious if this operation would be done in parallel (all the ors go out at once) or each is done serially.
Thanks
You can do:
SELECT FROM users WHERE username IN ('bob', 'jane', 'greg', 'Nth user')
For cleanliness. Here's what Google says about its impact on performance:
Note: The IN and != operators use multiple queries behind the scenes. For example, the IN operator executes a separate underlying datastore query for every item in the list. The entities returned are a result of the cross-product of all the underlying datastore queries and are de-duplicated. A maximum of 30 datastore queries are allowed for any single GQL query.
http://code.google.com/appengine/docs/python/datastore/gqlreference.html
精彩评论