Hi, Under the hood count() runs a keys_only query with an offset of MAX_INT. This is faster than running a keys only query yourself as it avoids the transit and serialization costs of returning the keys, however it costs the same. Unlike a fixed-schema database solution, performing a count in the Datastore requires traversing all the data (O(N) instead of O(1)). The cost of count() does reflect how the PAAS-stack actually functions.
Depending on your application's needs you can program around this by either caching counts in memcache or using a scalable counter alternative (such as a sharded counter). We have not built these solutions directly into the datastore because an application's tolerance for inaccuracy can vary drastically (no one size fits all solution). Thanks, Alfred On Thu, Sep 1, 2011 at 1:05 PM, Daniel Florey <[email protected]>wrote: > Thanks a lot for your answer. > ...but I'm still not totally sure how e.g. the count() will be charged. > Does it make any difference if I use the native count() or execute a "key > only" on the same query? > I guess the small datastore operations are somehow related to different > count() statements in my app. > > Daniel > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-appengine/-/KHJlz4TyiLwJ. > > 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.
