title: Counting entities in particular range in Google Appengine Datastore
body: <p>I am new to Google Datastore. I am building a simple app and I want to count the number of entities satisfying a particular criteria. The obvious way to do this is to first query that entity and then take the count on the result : </p>
  
  <pre><code>// Applying query on the "height" property of the entity "Person
  Filter heightFilter = new FilterPredicate("height",
                    FilterOperator.GREATER_THAN_OR_EQUAL,
                    minHeight);
  
  // Use class Query to assemble a query
  Query q = new Query("Person").setFilter(heightFilter);
  
  // Use PreparedQuery interface to retrieve results
  PreparedQuery pq = datastore.prepare(q);
  
  // And now count.
  </code></pre>
  
  <p>I was wondering if this is the best way to carry out this particular task. The querying mechanism would go through the entire database of this particular entity(Person in this case) and match it one by one. Is there any better way to do this if I just need the count and not the entire entity?</p>