If you know what these names and countries are in advance, you can do a write-time check and mark each entity when it's persisted, so you only have to query on a single boolean field, for example. Even if the list of names and countries can change over time, you can write a script to re-process all the entities. Depending on the number of entities you have, this could take a little while, but the one-time hit will be much better than having to do listA.size()*listB.size() checks every query. - Jason
On Tue, Aug 25, 2009 at 7:25 AM, Ray Li <ray.lee....@gmail.com> wrote: > > Thanks for the replies. > Both listA and listB may contain tens of elements, so the combination > may be 10 to 1000. > I am not sure what you mean by "Are the values in listA and listB > stored". As in my example, I am querying against property name, and > its value is surely stored. > Awaiting... > > Thanks, > Ray > On Aug 21, 11:41 pm, objectuser <kevin.k.le...@gmail.com> wrote: > > I agree with Iain: it depends on how many items are in the lists. But > > for large lists, I don't think it would work out very well. > > > > Are the values in listA and listB stored? That might give you more > > options. > > > > On Aug 20, 8:15 pm, Ray Li <ray.lee....@gmail.com> wrote: > > > > > > > > > Hi, > > > > > I have a query filter on an entity Person that person.name be in listA > > > and person.country in listB. As far as I can see, there're 2 options: > > > 1. Create a query "select t from Person t where t.name = :listAElement > > > and t.country = :listBElement" and run it listA.size() * listB.size() > > > times, then combine the result sets. > > > 2. Create a query "select t from Person t where t.name =:listAElement" > > > and run it once, then for each entity in the resultset, check if its > > > country is in listB. > > > > > For option 1, I am not sure about querying the datastore too many > > > times will case a serious performance issue. > > > > > For option 2, I may have to get all results back, may be several > > > several thousands, and this may be not achievable, is it? > > > > > Any help is highly appreciated. > > > > > Thanks, > > > Ray > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~----------~----~----~----~------~----~------~--~---