You could just do a IN query. Something like X IN [1,2,3,... ,]. However keep in mind that IN is restricted to using 30 values (as multiple queries are being executed - one per value specified; )
There is a restriction with the IN query for a On Sep 2, 11:11 pm, "Thomas P." <[email protected]> wrote: > Good morning, > > I have to fetch about 100 items from the datastore and I considered > doing it this way: > > select from ... where x == 5 || x== 9 || x==30 || x==2 || x==0 || > x==150 || ... > > The thing is ... I would have to append lots of "x == ... ||". This > could be 100, in the most cases less than 10 but even more than 200 > (which is unlikely but not impossible). > > My question now is, should I use a loop like this: > > for (int i=0;i<list.size();i++) > { > select from ... where x == "+list[i] > > } > > I don't know how expensive requests to the datastore are, but I could > imaging doing one large request could be more efficient than doing > lots of small requests ... > > Can someone help me here? > > Thx in advance, > Thomas P. -- 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 [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-java?hl=en.
