Data design choice: which works better?

3 views
Skip to first unread message

Harshdeep S Jawanda

unread,
Feb 4, 2010, 6:35:57 AM2/4/10
to Google App Engine
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!

Ikai L (Google)

unread,
Feb 9, 2010, 5:46:15 PM2/9/10
to google-a...@googlegroups.com
Hi,

I know this might just me being being crazy, but I'm having a lot of problems following your description. It's, unfortunately, the limitations of my human mind at work. Do you mind describing your question in terms of your problem domain? It'd be easier to wrap my brain around more concrete terms (Person, Group, Order, etc) rather than abstract letters (I suspect that's the reason no one has answered your question, because it's too hard to read).


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




--
Ikai Lan
Developer Programs Engineer, Google App Engine
http://googleappengine.blogspot.com | http://twitter.com/app_engine
Reply all
Reply to author
Forward
0 new messages