开发者

Count of a query as a cron or task [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicates:

Google AppEngine: how to count a database's entries beyond 1000?

how does one get a count of rows in a datastore model in google appengine?

Hi I've got > 10000 entities and would like to do count of a query. Since there going to be more than 1000 results a way I'm thinking to do it could be using a task queue or a cron job to refresh to value of the counter. That way I could use a job that takes more time to partition 开发者_StackOverflowthe count and adding parts that sum up to less than 1000. Do you agree that this is a reasonable way to performs counts that do not need to be exactly up to date all the time and do not need more accuracy than +/- 10 %? Specifically I want to display the number of recent posts where a small error wouldn't matter.

Edit: It seems counting > 1000 entities now works. So we will add these functions to the tabs ie displaying the total number of active entities and for private and company articles also number of active entities / articles. This way to count more than 1000 entities is not found in the documentation but here at another answer. We now do it this simple way that we plan to use with memcache so it only hits the data layer from time to time

self.response.out.write(A.all().count(100000000))`

that will count > 1000.

Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜