Hi Andy, It should always be safe to assume that if fetch returns less than LIMIT (provided that LIMIT is < 1000) the results are the only ones that match the query.
If the number of results you are trying to fetch takes too long, or some other limit is reached, fetch will throw an exception, not return fewer than normal results. It should be noted that iterating over a query with a limit specified behaves differently than explicitly fetch()ing the results. From http://code.google.com/appengine/docs/python/datastore/queryclass.html#Introduction: "* by treating the Query object as an iterable. The iterator retrieves results from the datastore in small batches, allowing for the app to stop iterating on results to avoid fetching more than is needed. Iteration stops when all of the results that match the query have been retrieved. As with fetch(), the iterator interface does not cache results, so creating a new iterator from the Query object will re-execute the query." So it's possible that the loop iteration could stop before the LIMIT is reached due to being stopped by the programmer, or an error that occurs mid-iteration. -Marzia On Tue, Jan 27, 2009 at 1:54 PM, Andy Freeman <ana...@earthlink.net> wrote: > > When is it safe to assume that a fetch that returns less than LIMIT > items has returned all matching items? (Clearly if a fetch returns > LIMIT items, there may be more matching items.) > > "returns" is important - I'm assuming that the fetch isn't running > into cpu quotas. > > For example, is there a limit on the total size of a fetch result? > (If the matching items are 990kbytes, 1000 items is almost a > gigabyte.) > > However, I'm primarily interested in cases where total size isn't an > issue. (My items are reasonably small and I'm specifying a limit that > is significantly less than 1000.) Does the datastore ever just say > "that's enough, if you really want more items, fetch again" before it > reaches the specified limit? (Yes, I know how the LIMIT clause in the > query interacts with the limit specified in the fetch itself.) > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---