but there are no cursors in this query. and nothing is actually 'fetched'.

lets say i have 2000 entities and i want to iterate over those 2000.

what causes more load? fetching of not fetching? or is it the same?


On Jan 4, 2012, at 4:27 PM, Renzo Nuccitelli wrote:

> Because if you know the desired number of results in advance, fetch
> is faster than iterating over query when you are using cursors. You
> can read it on documentation:
> http://code.google.com/intl/en/appengine/docs/python/datastore/queries.html#Query_Cursors
> just above Limitations of Cursors.
> 
> On 4 jan, 17:46, Andreas <[email protected]> wrote:
>> good question!
>> 
>> On Jan 4, 2012, at 12:53 PM, Kostya wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hi,
>> 
>>> why I need to use the fetch() instance method if every query can
>>> return an iterator and I can access the results of a query by
>>> iterating over it:
>> 
>>> authors = db.Query(Author).filter('name =', 'Kostya')
>>> for i in range(10):
>>>  print authors[i].name
>> 
>>> instead:
>> 
>>> authors = db.Query(Author).filter('name =', 'Kostya')
>>> authors.fetch(10)
>>> for author in authors:
>>>  print author.name
>> 
>>> --
>>> 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 
>>> athttp://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 [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.
> 

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

Reply via email to