0

I'm looking for a way to store hierarchical data, in a way that will facilitate "inheritance" queries that will coalesce upwards in the hierarchy.

Simple example:

Level 1, property X = 123
 - Level 2, property x  = null
 - - Level 3, property x = null

What is the effective value of property x at level 3? Answer: 123 (because it coalesces up to level 1).

Is there a database engine that is purposely made for this type of structure? This can be done relationally, or possibly in a graph, with some effort, but I am trying to find an engine natively optimized for this.

1 Answers1

0

Is there a database engine that is purposely made for this type of structure?

There are multiple ways to store hierarchical data in relational database. Simplest to understand and great to search is materialized path (similar to the file system).

More normalized approach is to use (id, parent_id) - it is better for updates but harder to query.

SergeyA
  • 474
  • 3
  • 6