Consider getting all, and then adding them to an array and using IN Array rather than doing it in the query.
I don't know that this will be faster, but it may be. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Richard Arrano Sent: Saturday, May 21, 2011 6:33 AM To: Google App Engine Subject: [google-appengine] how to avoid an IN query Hello, I'm working on a problem that at the moment seems to me to require an expensive IN query which I'd like to avoid. Basically, each group of users(and there may be thousands of such groups) draws product data from a subset of currently 8 providers(though it could reach ~16). The subset must contain at least 1, and can contain as many as the number of providers. Each user's inventory contains a reference property to the product and the product has a reference to its provider. What I'd like to do is to be able to create a view for each group of the products available given the providers they're drawing from(which can and will vary from user group to user group). So one way to do this is a query like: Product.all().filter('provider IN ', providers) Where providers is a list that represents the subset of providers that user group is drawing from. But this of course is quite slow. Given that the number of providers is relatively small, is there any way to change my approach or how to model the data in such a way that I can create this view in a speedy manner? Thanks, Richard -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
