Are you talking about this one:
A. query 20setup
from benchmark.models import Test
from google.appengine.ext import db
import datetime
import random
random.seed(datetime.datetime.now())
key = db.Key.from_path(Test.kind(), random.randrange(1, 1000))
timing
Test.all().filter('__key__ <=', key).fetch(20)
First, the query gets 20 entities sequentially in key order. Keys are stored
in order so they more likely than not hit a single machine. The db.get
lookups multiple keys which might hit more than one machine. Since the call
will wait for all the machines to return you effectively wait for the
slowest machine to return the results.
Second are you sure you are getting 20 entities out of this? What if the id
returned by random is 1?
2009/8/8 Oliver Zheng <[email protected]>
>
> On Aug 7, 1:33 pm, Alkis Evlogimenos ('Αλκης Ευλογημένος)
> <[email protected]> wrote:
> > Oh I see you time only the last db.get() call. Nevertheless you are still
> > not comparing apples to apples. In the db.get case you fetch entities and
> in
> > the query case you fetch keys only.
>
> There is a benchmark for keys_only query and another query for getting
> objects (bottom of the page). I am comparing that one with the db.get
> ().
>
> I am still clueless as to why the query is faster than the get. :(
>
> Oliver
> >
>
--
Alkis
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---