We are trying to query the App Engine datastore for some common statistics using NDB. They should not be 100% accurate (i.e. I am not interested in the final sequence); they simply should generally reflect the number of objects.
With NDB, we simply produce something like:
query = MyModel.query(MyModel.source==source, MyModel.created<=some_time).order(-MyModel.created) count = query.count(keys_only=True)
This is a timeout after the 60s. We regularly use entity groups and transactions, but I hope that this does not affect these count requests. We currently have about 4.2M MyModel objects, although a source filter would limit this to 210,000.
Is there an alternative way to count numbers of this value without a heap of user-defined memcache-y logic? Remember that numbers do not have to be accurate, just "generally correct."
source share