[appengine-java] Re: overcome onetomany limitation of 5000

2011-05-29 Thread lp
thanks guys for your suggestions.

but having a separate entity holding the foreign key will make updates
unusable for even moderate size relationships >1000.

i have used essentially the same approach suggested by nicole but each
'relational' entity will hold a list of foreign keys rather than a
single key.
this makes update significantly faster as i have less relational
entities to update.

This provides a solution to what google appengine guys call 'fan out
problem'.

hope this helps others.

-lp

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: overcome onetomany limitation of 5000

2011-05-13 Thread Brandon Donnelson
I would try another JDO class or Entity to store your friends instead of a 
list. I like to use unowned relationships my self.

Brandon Donnelson
http://gwt-examples.googlecode.com

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: overcome onetomany limitation of 5000

2011-05-13 Thread Nichole
You might want to consider denormalizing that table by one field?

That is, create a new entity holding a foreign key relation and the
field of interest,
and create an index for that query equality.

Reads are fast, and updates are slower so creating new entities for
that data
rather than updating an increasingly large entity (the entity with a
list) might be a good approach.


On May 11, 11:08 pm, lp  wrote:
> hi all
> i am modelling a unowned one-to-many relationship using list properties.
>
> @Entity
> public class User{
>
> String name;
>
> Boolean loggedIn;
>
> @Basic
>     private List friends;
>
> }
>
> all is good. i can run queries like
>
> query = "Select p from PositionUser p where p.friends = :userKey and " +
>                 "AND p.loggedIn = true "
>
> However there is a limit on the number of index available per entity of
> 5000. (although i am hitting the limit at 2500 for some reason)
>
>  i have 2 problems with the current approach
>
> #1. below the 5000 limit each addition to the friend list will require a
> fetch of the entire list, then add item and then put to datastore.
> this is rather expensive in CPU.
>
> #2. How can i allow for >5000 in the onetomany?
>
> any suggestion pls
>
> -lp

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.