I have an appengine app which has been running for about a year now, i have mainly been using JDO queries until now, but i am trying to collect stats and the queries are taking too long. I have the following entity (Device)
public class Device implements Serializable{ ... @Persistent private Set<Key> feeds;// Key for the Feed entity ... } So I want to get a count of how many Devices have a certain Feed. I was doing it in JDOQL before as such (uses javax.jdo.Query): Query query = pm.newQuery("select from Device where feeds.contains(:feedKey)"); Map<String, Object> paramsf = new HashMap<String, Object>(); paramsf.put("feedKey",feed.getId()); List<Device> results = (List<Device>) query.executeWithMap(paramsf); Though this code times out now. I was trying to use the Datastore API so I could set chunk size,etc to see if i could speed the query up or use a cursor, but I am unsure how to search in a Set field. I was trying this (uses com.google.appengine.api.datastore.Query) Query query = new Query("Device"); query.addFilter("feeds", FilterOperator.IN, feed.getId()); query.setKeysOnly(); final FetchOptions fetchOptions = FetchOptions.Builder.withPrefetchSize(100).chunkSize(100); QueryResultList<Entity> results = dss.prepare(query).asQueryResultList(fetchOptions); Essentially i am unsure how to search in the one-to-many filed (feeds) for a single key. Is it possible to index it somehow? hope it makes sense.... -- 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.