Each user U, has 0 or more children data entities corresponding to
days D.

Each day D has 0 or more children data entities of types X, Y and Z.

Is it better to associate items X, Y and Z with an entity of type D
by:

1. creating a collection each of X, Y and Z data entities inside
entity D (e.g., private List<Y> childrenOfTypeY;), or by

2. storing X, Y and Z by generating their Key values such that it
contains the parent entity D's key (e.g., Key k = new
KeyFactory.Builder(D.class.getSimpleName(),
"BlahBlahBlah").addChild(X.class.getSimpleName(),
"YadaYadaYada").getKey();).

My primary concern is which type of data design will be better
resource/time consumption-wise (i.e., which way is "lighter"). AFAIK,
method 1 gives me automatic consistency, method 2 gives me
flexibility.

In method 1, when I fetch an entity of type D, are all children
entities of types X, Y & Z fetched in one go, or lazily (w/o
programmatic intervention) on an as-required basis? In method 2
fetching the children is of course up to me.

Other characteristics of my application:

* As far as writing is concerned, it is more likely that individual
children of an entity of type D will be written to.

* As far as reading from the datastore is concerned, it is more likely
that all children of 1 or more entities of type D will need to be
fetched to satisfy a single request.

* Once an entity of type D is created, it and its children are
unlikely to be deleted, though entities of type X, Y and Z (for a
given entity D) may be individually modified.

* Data consistency is obviously of concern, but since data deletion is
infrequent, app-managed consistency shouldn't be too hard. Plus, a
cleanup Task can delete orphan X, Y, Z objects (should that happen).

If it matters, I am using Java.

If the above explanation is too opaque :-) or I have posted to the
wrong group, please let me know.

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to