On May 9, 9:58 pm, Adrian Holovaty <adr...@holovaty.com> wrote:
> > Also I assume you do a fetch on the query rather than iterating of the
> > result (fetch is much quicker).
>
> Oh, we could be onto something here. I'm iterating over the result,
> not using fetch, because I was under the impression fetch() was only
> for a limited number of records. Are you saying that I could pass a
> dummy huge number to fetch(), like fetch(1000000), and it would be
> faster than iterating? If so, that would be an easy win.

I just spent a bit of time testing this, and I wasn't able to get a
measurable difference between fetch() and iterating. Here are the
three approaches I tried:

    for a in MyModel.all().filter('somekey =', x):
        result.append(a)

    for a in MyModel.all().filter('somekey =', x).fetch(10000):
        result.append(a)

    for a in list(MyModel.all().filter('somekey =', x).fetch(10000)):
        result.append(a)

Each of those had 6107api_cpu_ms in my logs. The values for cpu_ms
weren't significantly different. Am I misunderstanding your comment
about fetch()? (I *do* want to get all results, not just a limited
subset.)

Adrian

-- 
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