Java ORM related question - SQL Vs Google DB (Big Table?) GAE

Posted by StackerFlow on Stack Overflow See other posts from Stack Overflow or by StackerFlow
Published on 2010-03-03T14:35:06Z Indexed on 2010/04/24 16:33 UTC
Read the original article Hit count: 145

I was wondering about the following two options when one is not using SQL tables but ORM based DBs (Example - when you are using GAE)

Would the second option be less efficient?

Requirement: There is an object. The object has a collection of similar items. I need to store this object. Example, say the object is a tree and it has a collection of leaves.

Option 1: Traditional SQL type structure:

  • Table for the Tree (with TreeId as the identifier for a row in the Table.)
  • Table for the Leaves (where each leaf has a TreeId and to show the leaves of a tree, I query all leaves where the TreeId is the Id of the tree.)
  • Here, the Tree structure DOES NOT have a field with leaves.

Option 2: ORM / GAE Tables: Using the same example above,

  • I have an object for Tree where the object has a collection (Set/List in Java/C++) of leaves.
  • I store and retrieve the Tree together with the leaves (as the leaves are implemented as a Set in the Tree object)

My question is, will the second one be less efficient that the first option?

If so, why? Are there other alternatives?

Thank you!

© Stack Overflow or respective owner

Related posts about datastructures

Related posts about database-design