Hi PSL. For a large number of entities, write-time calculation, just as you
suggested in your second solution, is the recommended solution for this type
of problem. As you noted, you won't be able to update both the entity and
aggregate value entity in the same transaction (unless all of your original
entities are in the same entity group), but you may be able to write your
own logic to mitigate the opportunity for inconsistency in the case of write
failure.

- Jason

On Wed, Aug 19, 2009 at 3:00 AM, PSL
<[email protected]>wrote:

>
> Hi,
> I want to implement aggregate functions like sum and avg in Java in
> Google App Engine.
> So as suggested in the forum I created a method to retrieve all the
> records in a List and then calculating the sum and avg on a particular
> field.It works well up to 20000 records  but for large number of
> records (50000) ,it gives HardDeadlineExceededError.( request takes
> more than 30 seconds to complete).
> So how could we remove this error?
>
> We even thought of second approach for aggregate functions.
> Create an entity with entity name , field name on which aggregate
> function required , aggregate function name and value of that
> function. So we need to populate this entity or update this entity
> every time we insert  or update a record in an entity. But this
> approach also has some problems like:-
> 1. As this entity will be a root entity, it cannot be updated in the
> transaction with other entity groups.
> 2. If we want to retrieve sum and avg with some conditions, it will
> not get possible in this approach.
>
> If anybody has some pointers how to cope up with these issues, please
> give your suggestions.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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