Search code examples
databasedatabase-designarchitecturerdbmsnosql

What database to choose for the hierarchical content with relations?


I want to have a reviews-like website, but not only with reviews, other types of content as well. The design of the website combines both hierarchical structure (each content object/record/entity has a parent - kind of container), and relations - each content object/record/entity has a number of related other objects:

  • an author of the content (i.e. user)
  • related comments (with their own relations, particularly authors)
  • item being reviewed as a separate record in DB
  • images from the gallery

One of the most important things is performance. Relations used to be inefficient in the NoSQL, as I've read on the net and already tried out with other projects. On the other hand, the general design, apart from the relations mentioned, has an obvious content repository like structure, which is the exact reflection of hierarchical arrangement of objects (documents, articles, reviews) websites are designed. Also, I really like the loose structure of the records in NoSQL. Yet, I don't care about (nor use) things like versioning and other things related to NoSQL.

So I want to combine both wordls: hierarchical and relational within one project, or actually, its model. Apart from it, I want the project to be restful, so that a mobile apps could use the same content available through the API. Another requirement is that the content should be searchable.

What type of storage would you choose for a project like this?


Solution

  • I decided to go with the Graph DBs. Here's why I rejected the other ones:

    • I don't want to use NoSQL (Documents), since relations are hard to maintain and often require extra code infrastructure (often custom) to handle them, see e.g. Diaspora NoSQL problems
    • I don't want to use RDBMS, since the structure based DBs impose well known limitations and doesn't reflect the domain
    • I rejected the key-value and big table DBs as they have very specific use cases

    Graph Databases have been used in number of content-oriented projects, and appeared to be doing the job surprisingly well.