Google app engine designed to work for any numbers of records with in
minimum time, so SQL features like counting the records whenever
needed is not supported.
So you need to take care of such counter by urself at the time of
adding or deleting the records in a table/entity.

If you just want total number of records and dont care if counting
happened in last 24 hours then look into low level api for datastore
statistics, GAE refreshes total count every 24 hours and you can read
the total count from there.

And if you want count of records with some where clause, then you need
to maintain it.

like if u want like this
select count(0) from tb where tb.propA='someValue'

then you may need to create a new entity say counterForTb, and have
few fields entityName and count and where clause columns
and whenevr you add a new record in tb then increase the count of that
record in counter table and on delete decrease it.




Something for google guys
Just realized that all columns are indexed unless we specify to not to
index, and there must be some index meta data/statistics saved
somewhere in google data stores about index(like total records
matching to this index). And if that stats can be accessible through
some APIs then we may be able to get total count just by reading data
from indexes stats.
Is this something feasible?








On Jun 11, 11:39 am, RAVINDER MAAN <[email protected]> wrote:
> How can we get records count for a query in JDO.
> In sql we have select count(*) from <table_name>
> i want to get number of records returned by a query. what is the
> efficient way to do that.One option is to use size() function .I think
> it is not best way.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to