This shouldn't cause an exploding index. Under the hood, we are embedding
Account's key information into the keys of the Child and creating index
entries for each of the Child classes. Now, creating massive entity groups
may certainly have some performance implications, but that's why we
recommend making entity groups as small as possible.
An exploding index occurs if you have an entity that looks like this:
public class Animal {
@Persistent
private List<String> favoriteColors;
@Persistent
private List<String> favoriteFoods;
}
Suppose you created an animal with favoriteColors = { RED, BLUE } and
favoriteFoods = { FISH, CARROTS }. We'd have to create indexes with the
following permutations:
RED, FISH
RED, CARROTS
BLUE, FISH
BLUE, CARROTS
FISH, RED
FISH, BLUE
CARROTS, RED
CARROTS, BLUE
This is considered an "exploding index" because the number of index entries
increases with the number of possible combinations of entities and types of
lists. This is so we can support queries that look like this:
WHERE favoriteColors = BLUE AND favoriteFoods > CARROTS
It's not possible to query on related Objects in this way, so indexes don't
have to be created. You can read more about this here:
http://code.google.com/appengine/docs/python/datastore/queriesandindexes.html
On Wed, Jan 20, 2010 at 11:31 AM, Lucian Baciu <[email protected]>wrote:
> If have a root entity that has many owned one to many relationships
> (say about 10), and each children collection can have hundreds or
> thousands of child entities in them, something like:
>
> public class Account{
> @Persistent(mappedBy = "account")
> @Order(extensions = @Extension(vendorName="datanucleus", key="list-
> ordering", value="key asc"))
> private List<Child1> children1;
>
> @Persistent(mappedBy = "account")
> @Order(extensions = @Extension(vendorName="datanucleus", key="list-
> ordering", value="key asc"))
> private List<Child2> children2;
>
> //....
>
> @Persistent(mappedBy = "account")
> @Order(extensions = @Extension(vendorName="datanucleus", key="list-
> ordering", value="key asc"))
> private List<Child10> children10;
> }
>
> And this root entity has no custom indexes. Is it possible to get an
> exploding index? Is this a bad design model for app engine or is this
> okay?
> I'm just not sure how app engine works with owned one-to-many
> relationships in terms of indexes.
>
>
>
> --
> 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]<google-appengine-java%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>
>
--
Ikai Lan
Developer Programs Engineer, Google App Engine
http://googleappengine.blogspot.com | http://twitter.com/app_engine
--
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.