Google App Engine Queries with JDOQL, how to just get a count?

533 Views Asked by At

I've used "select from X.class.getName()" to get all records of class X, but if there is a lot of records, it might take a long time to get the results.

I just want a count of how many records are there in the Datastore, what's the fastest query to get this number ? Is there something like "select COUNT() X.class.getName()" that can return , for example, 234000 [ the count of all records ] ?

1

There are 1 best solutions below

0
On BEST ANSWER

See What's the best way to count results in GQL?

(short answer is that you should store the amount of object and update it whenver you add/remove objects from the datastore)