title: How do I build a flexible counter with 1000+ rows but few reads in Google App Engine?
body: <p>I have a list of users that only administrators can see (= few reads). This list also displays a count of the number of users in the datastore. Because the list could grow larger than 1000 my first thought was to avoid a normal count() and instead use a sharded counter.</p>
  
  <p>However, the problem is that the admins also have access to various search filters (in the GUI), such as only viewing male/female users and so on. It's important that the count reflects these filters, so that they can get the number of female users, male users and a myriad of other combinations.</p>
  
  <p>Because of this, sharded counters and high concurrency counters without sharding don't seem like a good idea, because I would need to create a counter for every combination of search filters.</p>
  
  <p>Should I simply create a loop of count() methods, such as described <a href="https://stackoverflow.com/questions/751124/how-does-one-get-a-count-of-rows-in-a-datastore-model-in-google-appengine">here</a> or is this very bad practice? How would I do it otherwise?</p>
  
  <p>Note that this counter is for an admin interface and would have a very limited number of reads. This is really a case of when I would like to sacrifice some read performance for flexibility and accuracy. Although it should be able to grow beyond 1000, it's not expected to grow larger than 10 000.</p>