Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GAE: Best way to determine how many of a Kind is stored?

What is the best way to determine how many models of a certain kind are in my app's datastore? The documentation says that MyKind.all().count() is only marginally better than retrieving all of the data, and has a limit of 1000. This is not helpful, because I am expecting to have 6000+ instances of MyKind stored.

Is there a better way to do this? What if I just get the keys, and count those?

I'm using Python.

like image 607
Nick Heiner Avatar asked Jul 12 '10 01:07

Nick Heiner


1 Answers

If an approximate count is good enough, you could use the statistics API:

http://code.google.com/appengine/docs/python/datastore/stats.html

like image 80
Saxon Druce Avatar answered Sep 23 '22 01:09

Saxon Druce