title: Is there a way to do aggregate functions on Google App Engine?
body: <p>One of the nice things relational databases support are the aggregate functions like count, sum, avg etc. But it seems that if you are using GAE, when inserting or updating a record you must calculate and store the count, sum, avg, etc. values of the whole table. But what if you have many conditional groupings? Given a Person:</p>
  
  <pre><code>class Person {
      @Id
      Integer age;
      String city;
  }
  </code></pre>
  
  <p>If I want </p>
  
  <ol>
  <li>the total number of persons
  and</li>
  <li>the average age</li>
  </ol>
  
  <p>Is it correct that everytime I create, update or delete a person I should also calculate both aggregates and store them as separate columns in the same table. If I also want the total and average values per city, should I store these values for each city also as separate columns in the same table? </p>