Depending on the list of keys, it might be faster to use a query. I have a case, where I have a sorted list of key names and the there is no other key in the datastore that is bigger than the first key and smaller than the last key of the list. I experimented a bit, and for me, the following solution was significantly faster than getting all keys with a batch get.
SELECT * FROM Model WHERE __key__ >= :key_first ORDER BY __key__
(and fetching length(list) entities)

I don't know if your list of keys has a similar structure, but I thought it could help you.

-Ulrich

Josh Rehman wrote:
Thanks! Knew it had to be in there somewhere. :)

http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/DatastoreService.html#get(java.lang.Iterable) <http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/DatastoreService.html#get%28java.lang.Iterable%29>


On Thu, Mar 18, 2010 at 5:39 PM, Tristan <tristan.slomin...@gmail.com <mailto:tristan.slomin...@gmail.com>> wrote:

    look in DatastoreService get()

    On Mar 18, 7:33 pm, JavaJosh <javaj...@gmail.com
    <mailto:javaj...@gmail.com>> wrote:
    > BTW in python this would be db.get(keys). :)
    >
    > On Mar 18, 5:32 pm, JavaJosh <javaj...@gmail.com
    <mailto:javaj...@gmail.com>> wrote:
    >
    >
    >
    > > Hi,
    >
    > > I'd like to use the low-level datastore API (Java) to deference a
    > > (potentially long) list of keys into their respective
    Entities. I've
    > > scoured the API and searched messages in this group, and don't
    see any
    > > answers.
    >
    > > I primarily looked for a method on Query that takes a
    Collection or
    > > Array of Keys. Didn't find it.
    >
    > > For now I can get by with a for loop. Ghetto but it works. I'd
    like to
    > > do better.
    >
    > > Thanks.

    --
    You received this message because you are subscribed to the Google
    Groups "Google App Engine" group.
    To post to this group, send email to
    google-appengine@googlegroups.com
    <mailto:google-appengine@googlegroups.com>.
    To unsubscribe from this group, send email to
    google-appengine+unsubscr...@googlegroups.com
    <mailto:google-appengine%2bunsubscr...@googlegroups.com>.
    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 google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. 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 google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to